Subversion Repositories libOLED

Rev

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

Rev Author Line No. Line
15 mjames 1
///
2
/// Dial drawing library : used to display anything from compass display to arcs of "meter" displays
3
///
4 mjames 4
#pragma once
5 mjames 5
#include <cstdint>
4 mjames 6
 
7
class displayDial_t
8
{
9
public:
5 mjames 10
  /// \param display the parent display
11
  /// \param x x pos
12
  /// \param y y pos
13
  /// \param siz = size
14 mjames 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);
4 mjames 20
 
14 mjames 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);
4 mjames 34
 
15 mjames 35
  /// @brief  Put the dial needle on the display 
36
  /// @param position values are from  0 .. math.SINE_STEPS 
14 mjames 37
  void draw_needle(int16_t position);
4 mjames 38
 
15 mjames 39
 
14 mjames 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);
4 mjames 47
 
14 mjames 48
  /// print min/max limits
49
  void draw_limits();
50
 
4 mjames 51
private:
14 mjames 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
};