Rev 13 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 11 | mjames | 1 | // A display for X, Y data |
| 2 | |||
| 3 | #pragma once |
||
| 4 | #include "libOLED/displayclass.H" |
||
| 5 | class displayXY_t |
||
| 6 | { |
||
| 7 | /// \param display the parent display |
||
| 8 | /// \param xmin minimum X axis value |
||
| 9 | /// \param xmax maximum X axis value |
||
| 10 | public: |
||
| 11 | /// \param siz = size |
||
| 12 | displayXY_t(display_t &disp, |
||
| 13 | int xmin, int xmax, int ymin, int ymax); |
||
| 14 | |||
| 15 | void drawAxes(); |
||
| 16 | |||
| 17 | void plotPoint(int x, int y, char *message = nullptr,char * message_lower = nullptr, char * message_upper=nullptr); |
||
| 18 | |||
| 19 | private: |
||
| 20 | display_t &display; |
||
| 21 | const int x_min; |
||
| 22 | const int x_max; |
||
| 23 | const int y_min; |
||
| 24 | const int y_max; |
||
| 25 | |||
| 26 | const int left_margin; |
||
| 27 | const int right_margin; |
||
| 28 | const int plot_width; |
||
| 29 | const int top_margin; |
||
| 30 | const int bottom_margin; |
||
| 31 | const int plot_height; |
||
| 32 | |||
| 33 | /// @brief persistent storage - a trail of pixels follow the plotted point. . |
||
| 19 | mjames | 34 | static unsigned const PERSIST= 300; |
| 11 | mjames | 35 | |
| 36 | uint8_t persist_x[PERSIST]; |
||
| 37 | uint8_t persist_y[PERSIST]; |
||
| 19 | mjames | 38 | // large enough to hold value 0..PERSIST-1 |
| 39 | uint16_t next_persist; |
||
| 11 | mjames | 40 | }; |