Rev 6 | Rev 9 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6 | Rev 7 | ||
---|---|---|---|
Line 15... | Line 15... | ||
15 | return (width * height / 8); |
15 | return (width * height / 8); |
16 | } |
16 | } |
17 | 17 | ||
18 | enum colour_t |
18 | enum colour_t |
19 | { |
19 | { |
20 | BLACK, WHITE, INVERT |
20 | BLACK, /* and 0, invert 0 */ |
- | 21 | WHITE, /* and 0, invert 1 */ |
|
- | 22 | OVERLAY, /* and 1, invert 0 */ |
|
- | 23 | INVERT, /* and 1, invert 1 */ |
|
21 | }; |
24 | }; |
22 | 25 | ||
23 | class display_t |
26 | class display_t |
24 | { |
27 | { |
25 | public: |
28 | public: |
Line 34... | Line 37... | ||
34 | int16_t |
37 | int16_t |
35 | width (); |
38 | width (); |
36 | int16_t |
39 | int16_t |
37 | height (); |
40 | height (); |
38 | 41 | ||
- | 42 | // common hardware reset . |
|
- | 43 | void reset(); |
|
- | 44 | ||
39 | void |
45 | void |
40 | init (); |
46 | init (); |
41 | 47 | ||
42 | /// \brief Clear display to colour |
48 | /// \brief Clear display to colour |
43 | void |
49 | void |
Line 60... | Line 66... | ||
60 | stopscroll (void); |
66 | stopscroll (void); |
61 | 67 | ||
62 | void |
68 | void |
63 | dim (uint8_t contrast); |
69 | dim (uint8_t contrast); |
64 | 70 | ||
- | 71 | // set drawing mode |
|
- | 72 | void setPixelMode(colour_t colour) |
|
- | 73 | { m_colour = colour; } |
|
- | 74 | ||
- | 75 | ||
65 | void |
76 | void |
66 | drawPixel (int16_t x, int16_t y, colour_t color); |
77 | drawPixel (int16_t x, int16_t y, bool pixel); |
67 | 78 | ||
68 | void |
79 | void |
69 | drawLine (int16_t x1, int16_t y1, int16_t x2, int16_t y2, colour_t color); |
80 | drawLine (int16_t x1, int16_t y1, int16_t x2, int16_t y2, colour_t color); |
70 | 81 | ||
71 | void drawRectangle (int16_t x1, int16_t y1, int16_t x2, int16_t y2, colour_t color); |
82 | void drawRectangle (int16_t x1, int16_t y1, int16_t x2, int16_t y2, colour_t color); |
Line 84... | Line 95... | ||
84 | /// \param string The characters to plot |
95 | /// \param string The characters to plot |
85 | /// \param length The length of the string |
96 | /// \param length The length of the string |
86 | /// \param colour |
97 | /// \param colour |
87 | void |
98 | void |
88 | printString (font_t &font, char const *string, uint16_t length, |
99 | printString (font_t &font, char const *string, uint16_t length, |
89 | colour_t colour); |
100 | colour_t colour=WHITE); |
90 | 101 | ||
91 | // scaled plotting |
102 | // scaled plotting |
92 | /// \param font The font to use |
103 | /// \param font The font to use |
93 | /// \param string The characters to plot |
104 | /// \param string The characters to plot |
94 | /// \param length The length of the string |
105 | /// \param length The length of the string |
95 | /// \param scale The scale factor is 256/scale so 256 is 1:1, 128 is twice the size |
106 | /// \param scale The scale factor is 256/scale so 256 is 1:1, 128 is twice the size |
96 | /// \param colour |
107 | /// \param colour |
97 | void |
108 | void |
98 | printScaledString (font_t &font, char const *string, |
109 | printScaledString (font_t &font, char const *string, |
99 | uint16_t length, uint16_t scale, |
110 | uint16_t length, uint16_t scale, |
100 | colour_t colour); |
111 | colour_t colour=WHITE); |
- | 112 | ||
- | 113 | ||
- | 114 | static const uint8_t NO_DECIMAL = 255; |
|
101 | 115 | ||
102 | void |
116 | void |
103 | fontDigits (font_t &font, uint8_t digits, uint8_t dp_pos, int val); |
117 | fontDigits (font_t &font, uint8_t digits, uint8_t dp_pos, int val, colour_t colour=WHITE); |
104 | 118 | ||
105 | void |
119 | void |
106 | fontSigDigits (font_t &font,uint8_t x, uint8_t y, bool right_justify, uint8_t dp_pos, |
120 | fontSigDigits (font_t &font,uint8_t x, uint8_t y, bool right_justify, uint8_t dp_pos, |
107 | int val); |
121 | int val, colour_t colour = WHITE); |
108 | 122 | ||
109 | int |
123 | int |
110 | cursor_x () |
124 | cursor_x () |
111 | { |
125 | { |
112 | return m_cursor_x; |
126 | return m_cursor_x; |
Line 145... | Line 159... | ||
145 | 159 | ||
146 | int m_cursor_x; |
160 | int m_cursor_x; |
147 | int m_cursor_y; |
161 | int m_cursor_y; |
148 | int m_rotation; |
162 | int m_rotation; |
149 | 163 | ||
- | 164 | // currently selected colour mode |
|
- | 165 | colour_t m_colour; |
|
- | 166 | ||
150 | uint8_t *const m_data; |
167 | uint8_t *const m_data; |
151 | 168 | ||
152 | }; |
169 | }; |