Subversion Repositories libOLED

Rev

Rev 16 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 16 Rev 17
Line 2... Line 2...
2
/// Dial drawing library : used to display anything from compass display to arcs of "meter" displays
2
/// Dial drawing library : used to display anything from compass display to arcs of "meter" displays
3
///
3
///
4
#pragma once
4
#pragma once
5
#include <cstdint>
5
#include <cstdint>
6
 
6
 
-
 
7
namespace
-
 
8
{
-
 
9
  constexpr unsigned DEFAULT_WIDTH = 3;
-
 
10
}
-
 
11
 
7
class displayDial_t
12
class displayDial_t
8
{
13
{
9
public:
14
public:
10
  /// \param display the parent display
15
  /// \param display the parent display
11
  /// \param x x pos
16
  /// \param x x pos
Line 42... Line 47...
42
  /// \param width length of long marker
47
  /// \param width length of long marker
43
  /// \param num_step number of ticks
48
  /// \param num_step number of ticks
44
  /// \param scale
49
  /// \param scale
45
  void draw_scale(int16_t low, int16_t high, uint8_t width, uint8_t num_step, int16_t scale);
50
  void draw_scale(int16_t low, int16_t high, uint8_t width, uint8_t num_step, int16_t scale);
46
 
51
 
47
  /// @brief print min/max limits
52
  /// @brief print min/max limits and print the title
48
  virtual void draw_limits(){};
53
  virtual void draw_limits(){};
49
 
54
 
50
  /// @brief Draw value on display
55
  /// @brief Draw value on display
51
  /// @param val integer value to show with fake decimal point
56
  /// @param val integer value to show with fake decimal point
52
  /// @param dp  decimal point code
57
  /// @param dp  decimal point code
-
 
58
  /// @param width number of digits plus sign
53
  virtual void draw_value(int val, int dp){};
59
  virtual void draw_value(int val, int dp, int width= DEFAULT_WIDTH){};
54
 
60
 
55
  /// @brief Set units string on display
61
  /// @brief Set units string on display
56
  /// @param str Constant string to refer to
62
  /// @param str Constant string to refer to
57
  void set_units(char const *str){m_unitStr = str; };
63
  void set_units(char const *str){m_unitStr = str; };
58
 
64
 
-
 
65
  /// @brief Set title on the screen
-
 
66
  /// @param str Constant string to display
-
 
67
  void set_title(char const * str){m_titleStr = str; };
-
 
68
 
59
protected:
69
protected:
60
 
70
 
61
  void draw_value_items(int val, int dpCode, int wid,  int x , int y );
71
  void draw_value_items(int val, int dpCode, int wid,  int x , int y );
62
 
72
 
63
 
73
 
64
  display_t &m_display;
74
  display_t &m_display;
65
  uint8_t const m_xo;         ///< Position of origin
75
  uint8_t const m_xo;         ///< Position of origin
66
  uint8_t const m_yo;         ///< Position of origin
76
  uint8_t const m_yo;         ///< Position of origin
67
  uint8_t const m_siz;        ///< Display size
77
  uint8_t const m_siz;        ///< Display size
68
  int16_t const m_angleLow;   ///< Angle for lowest value
78
  int16_t const m_angleLow;   ///< Angle for lowest value
69
  int16_t const m_angleRange; ///< Angle range from lowest to highest  value
79
  int16_t const m_angleRange; ///< Angle range from lowest to highest  value
70
  int16_t m_low;              ///< lower scale limit
80
  int16_t m_low;              ///< lower scale limit
71
  int16_t m_high;             ///< upper scale limit
81
  int16_t m_high;             ///< upper scale limit
72
  char const *  m_unitStr;     ///< Units_string 
82
  char const * m_unitStr;     ///< Units_string
-
 
83
  char const * m_titleStr;    ///< Title_string
73
};
84
};
74
 
85
 
75
//////////////////////////////////////////////////
86
//////////////////////////////////////////////////
76
/// A display using the whole graphics area, 180 degree sweep
87
/// A display using the whole graphics area, 180 degree sweep
77
class displayFullDial_t : public displayDial_t
88
class displayFullDial_t : public displayDial_t
Line 85... Line 96...
85
  virtual void draw_limits() final;
96
  virtual void draw_limits() final;
86
 
97
 
87
  /// @brief Draw value on display
98
  /// @brief Draw value on display
88
  /// @param val integer value to show with fake decimal point
99
  /// @param val integer value to show with fake decimal point
89
  /// @param dp  decimal point code
100
  /// @param dp  decimal point code
90
  virtual void draw_value(int val, int dp) final;
101
  virtual void draw_value(int val, int dp, int width= DEFAULT_WIDTH) final;
91
 
102
 
92
 
103
 
93
};
104
};
94
 
105
 
95
//////////////////////////////////////////////////
106
//////////////////////////////////////////////////
Line 105... Line 116...
105
  virtual void draw_limits() final;
116
  virtual void draw_limits() final;
106
 
117
 
107
  /// @brief Draw value on display
118
  /// @brief Draw value on display
108
  /// @param val integer value to show with fake decimal point
119
  /// @param val integer value to show with fake decimal point
109
  /// @param dp  decimal point code
120
  /// @param dp  decimal point code
110
  virtual void draw_value(int val, int dp) final;
121
  virtual void draw_value(int val, int dp,int width= DEFAULT_WIDTH) final;
111
 
122
 
112
 
123
 
113
};
124
};
114
 
125
 
115
//////////////////////////////////////////////////
126
//////////////////////////////////////////////////
Line 124... Line 135...
124
  virtual void draw_limits() final;
135
  virtual void draw_limits() final;
125
 
136
 
126
  /// @brief Draw value on display
137
  /// @brief Draw value on display
127
  /// @param val integer value to show with fake decimal point
138
  /// @param val integer value to show with fake decimal point
128
  /// @param dp  decimal point code
139
  /// @param dp  decimal point code
129
  virtual void draw_value(int val, int dp) final;
140
  virtual void draw_value(int val, int dp,int width = DEFAULT_WIDTH) final;
130
 
141
 
131
 
142
 
132
};
143
};
133
144