Rev 7 | Rev 15 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4 | mjames | 1 | #pragma once |
5 | mjames | 2 | #include <cstdint> |
4 | mjames | 3 | |
4 | class displayDial_t |
||
5 | { |
||
6 | public: |
||
5 | mjames | 7 | /// \param display the parent display |
8 | /// \param x x pos |
||
9 | /// \param y y pos |
||
10 | /// \param siz = size |
||
14 | mjames | 11 | /// \param angle Angle from straight up for lowest (-angle) and highest (angle) reading |
12 | displayDial_t(display_t &display, |
||
13 | uint8_t x, |
||
14 | uint8_t y, |
||
15 | uint8_t siz, |
||
16 | uint16_t angle = 90); |
||
4 | mjames | 17 | |
14 | mjames | 18 | /// @brief Construct a display with angle from Angle high to angle low |
19 | /// @param display |
||
20 | /// @param x |
||
21 | /// @param y |
||
22 | /// @param siz |
||
23 | /// @param angle_high Angle relative to straight up for highest reading |
||
24 | /// @param angle_low Angle relative to straight up for lowest reading |
||
25 | displayDial_t(display_t &display, |
||
26 | uint8_t x, |
||
27 | uint8_t y, |
||
28 | uint8_t siz, |
||
29 | int16_t angle_low, |
||
30 | int16_t angle_high); |
||
4 | mjames | 31 | |
14 | mjames | 32 | // put the dial needle on the display |
33 | void draw_needle(int16_t position); |
||
4 | mjames | 34 | |
14 | mjames | 35 | // draw the scale |
36 | /// \param low low end of range |
||
37 | /// \param high high end of range |
||
38 | /// \param width length of long marker |
||
39 | /// \param num_step number of ticks |
||
40 | /// \param scale |
||
41 | void draw_scale(int16_t low, int16_t high, uint8_t width, uint8_t num_step, int16_t scale); |
||
4 | mjames | 42 | |
14 | mjames | 43 | /// print min/max limits |
44 | void draw_limits(); |
||
45 | |||
4 | mjames | 46 | private: |
14 | mjames | 47 | display_t &m_display; |
48 | uint8_t const m_xo; ///< Position of origin |
||
49 | uint8_t const m_yo; ///< Position of origin |
||
50 | uint8_t const m_siz; ///< Display size |
||
51 | int16_t const m_angleLow; ///< Angle for lowest value |
||
52 | int16_t const m_angleRange; ///< Angle range from lowest to highest value |
||
53 | int16_t m_low; ///< lower scale limit |
||
54 | int16_t m_high; ///< upper scale limit |
||
55 | }; |