Subversion Repositories libOLED

Rev

Rev 14 | Rev 16 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ///
  2. /// Dial drawing library : used to display anything from compass display to arcs of "meter" displays
  3. ///
  4. #pragma once
  5. #include <cstdint>
  6.  
  7. class displayDial_t
  8. {
  9. public:
  10.   /// \param display the parent display
  11.   /// \param x x pos
  12.   /// \param y y pos
  13.   /// \param siz = size
  14.   /// \param angle Angle from straight up for lowest (-angle) and highest (angle) reading
  15.   displayDial_t(display_t &display,
  16.                 uint8_t x,
  17.                 uint8_t y,
  18.                 uint8_t siz,
  19.                 uint16_t angle = 90);
  20.  
  21.   /// @brief Construct a display with angle from Angle high to angle low
  22.   /// @param display
  23.   /// @param x
  24.   /// @param y
  25.   /// @param siz
  26.   /// @param angle_high Angle relative to straight up for highest reading
  27.   /// @param angle_low Angle relative to straight up for lowest reading
  28.   displayDial_t(display_t &display,
  29.                 uint8_t x,
  30.                 uint8_t y,
  31.                 uint8_t siz,
  32.                 int16_t angle_low,
  33.                 int16_t angle_high);
  34.  
  35.   /// @brief  Put the dial needle on the display
  36.   /// @param position values are from  0 .. math.SINE_STEPS
  37.   void draw_needle(int16_t position);
  38.  
  39.  
  40.   // draw the scale
  41.   /// \param low low end of range
  42.   /// \param high high end of range
  43.   /// \param width length of long marker
  44.   /// \param num_step number of ticks
  45.   /// \param scale
  46.   void draw_scale(int16_t low, int16_t high, uint8_t width, uint8_t num_step, int16_t scale);
  47.  
  48.   /// print min/max limits
  49.   void draw_limits();
  50.  
  51. private:
  52.   display_t &m_display;
  53.   uint8_t const m_xo;    ///< Position of origin
  54.   uint8_t const m_yo;    ///< Position of origin
  55.   uint8_t const m_siz;   ///< Display size
  56.   int16_t const m_angleLow;  ///< Angle for lowest value
  57.   int16_t const m_angleRange; ///< Angle range from lowest to highest  value
  58.   int16_t m_low;         ///< lower scale limit
  59.   int16_t m_high;        ///< upper scale limit
  60. };
  61.