Rev 11 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 11 | Rev 13 | ||
---|---|---|---|
Line 28... | Line 28... | ||
28 | display_t(int const width, int const height, int const ramwidth, |
28 | display_t(int const width, int const height, int const ramwidth, |
29 | uint8_t *const data); |
29 | uint8_t *const data); |
30 | 30 | ||
31 | virtual ~display_t(); |
31 | virtual ~display_t(); |
32 | 32 | ||
33 | /// \brief get the current rotation of the display |
33 | /// \brief get the current rotation of the display : doesnt work too well. |
34 | uint8_t |
34 | uint8_t |
35 | getRotation(); |
35 | getRotation(); |
36 | 36 | ||
- | 37 | /// @brief Get pixel width |
|
- | 38 | /// @return width |
|
37 | int16_t |
39 | int16_t |
38 | width(); |
40 | width(); |
- | 41 | /// @brief Get pixel height |
|
- | 42 | /// @return height |
|
39 | int16_t |
43 | int16_t |
40 | height(); |
44 | height(); |
41 | 45 | ||
42 | // common hardware reset . |
46 | /// @brief common hardware reset, resets ALL displays |
43 | void |
47 | void |
44 | reset(); |
48 | reset(); |
45 | 49 | ||
46 | void |
50 | void |
47 | init(); |
51 | init(); |
48 | 52 | ||
49 | /// \brief Clear display to colour |
53 | /// \brief Clear display to colour |
50 | void |
54 | void |
51 | clearDisplay(colour_t colour = colour_t::BLACK); |
55 | clearDisplay(colour_t colour = colour_t::BLACK); |
- | 56 | ||
- | 57 | /// @brief Invert display |
|
- | 58 | /// @param i true : invert display |
|
52 | void |
59 | void |
53 | invertDisplay(uint8_t i); |
60 | invertDisplay(uint8_t i); |
- | 61 | ||
- | 62 | /// @brief Show the workspace on the screen |
|
54 | void |
63 | void |
55 | display(); |
64 | display(); |
56 | 65 | ||
57 | void |
66 | void |
58 | startscrollright(uint8_t start, uint8_t stop); |
67 | startscrollright(uint8_t start, uint8_t stop); |
Line 64... | Line 73... | ||
64 | void |
73 | void |
65 | startscrolldiagleft(uint8_t start, uint8_t stop); |
74 | startscrolldiagleft(uint8_t start, uint8_t stop); |
66 | void |
75 | void |
67 | stopscroll(void); |
76 | stopscroll(void); |
68 | 77 | ||
- | 78 | /// @brief Set display contrast |
|
- | 79 | /// @param contrast 0..255 but theres really only two values worth bothering with, 0 and 255 |
|
69 | void |
80 | void |
70 | dim(uint8_t contrast); |
81 | dim(uint8_t contrast); |
71 | 82 | ||
72 | // set drawing mode |
83 | // set drawing mode |
73 | void |
84 | void |
74 | setPixelMode(colour_t colour) |
85 | setPixelMode(colour_t colour) |
75 | { |
86 | { |
76 | m_colour = colour; |
87 | m_colour = colour; |
77 | } |
88 | } |
78 | 89 | ||
- | 90 | /// @brief Draw a single pixel |
|
- | 91 | /// @param x |
|
- | 92 | /// @param y |
|
- | 93 | /// @param pixel |
|
79 | void |
94 | void |
80 | drawPixel(int16_t x, int16_t y, bool pixel); |
95 | drawPixel(int16_t x, int16_t y, bool pixel); |
81 | 96 | ||
- | 97 | /// @brief Draw a line according to Bressenham algorithm, with optional dash / dot patternign |
|
- | 98 | /// @param x1 coordinate start |
|
- | 99 | /// @param y1 coordinate start |
|
- | 100 | /// @param x2 coordinate end |
|
- | 101 | /// @param y2 coordinate end |
|
- | 102 | /// @param color colour code |
|
- | 103 | /// @param pattern a binary pattern with at least a single bit set - if least significant bit set, draw pixel |
|
- | 104 | /// if bit zero dont draw pixel. After drawing a pixel, shift pattern right one bit. If pattern becomes all zeros, reset with function argument. |
|
82 | void |
105 | void |
83 | drawLine(int16_t x1, int16_t y1, int16_t x2, int16_t y2, colour_t color = WHITE, int8_t pattern = 1); |
106 | drawLine(int16_t x1, int16_t y1, int16_t x2, int16_t y2, colour_t color = WHITE, int8_t pattern = 1); |
84 | 107 | ||
- | 108 | /// @brief Draw a solid rectangle using byte operations, rather than line draw |
|
- | 109 | /// @param x1 top left |
|
- | 110 | /// @param y1 top left |
|
- | 111 | /// @param x2 bottom right |
|
- | 112 | /// @param y2 bottom right |
|
- | 113 | /// @param color colour code |
|
85 | void |
114 | void |
86 | drawRectangle(int16_t x1, int16_t y1, int16_t x2, int16_t y2, |
115 | drawRectangle(int16_t x1, int16_t y1, int16_t x2, int16_t y2, |
87 | colour_t color=WHITE); |
116 | colour_t color = WHITE); |
88 | 117 | ||
89 | // position cursor absolute |
118 | /// @brief Position cursor for text drawing |
- | 119 | /// @param x top left |
|
- | 120 | /// @param y top left |
|
90 | void |
121 | void |
91 | gotoxy(int x, int y) |
122 | gotoxy(int x, int y) |
92 | { |
123 | { |
93 | m_cursor_x = x; |
124 | m_cursor_x = x; |
94 | m_cursor_y = y; |
125 | m_cursor_y = y; |
95 | } |
126 | } |
96 | 127 | ||
- | 128 | /// @brief Position cursor relative for text drawing |
|
- | 129 | /// @param x relative |
|
97 | // position cursor relative |
130 | /// @param y relative |
98 | void |
131 | void |
99 | moveby(int x, int y) |
132 | moveby(int x, int y) |
100 | { |
133 | { |
101 | m_cursor_x += x; |
134 | m_cursor_x += x; |
102 | m_cursor_y += y; |
135 | m_cursor_y += y; |
103 | } |
136 | } |
104 | 137 | ||
105 | // pixel to pixel plotting |
138 | // pixel to pixel plotting |
106 | /// \param font The font to use |
139 | /// \param font The font to use |
107 | /// \param string The characters to plot |
140 | /// \param string The characters to plot |
108 | /// \param length The length of the string |
141 | /// \param length The length of the string (0 means use strlen(string)) |
109 | /// \param colour |
142 | /// \param colour colour code |
110 | void |
143 | void |
111 | printString(font_t &font, char const *string, uint16_t length, |
144 | printString(font_t &font, char const *string, uint16_t length, |
112 | colour_t colour = WHITE); |
145 | colour_t colour = WHITE); |
113 | 146 | ||
114 | // scaled plotting |
147 | // scaled plotting |
115 | /// \param font The font to use |
148 | /// \param font The font to use |
116 | /// \param string The characters to plot |
149 | /// \param string The characters to plot |
117 | /// \param length The length of the string |
150 | /// \param length The length of the string |
118 | /// \param scale The scale factor is 256/scale so 256 is 1:1, 128 is twice the size |
151 | /// \param scale The scale factor is 256/scale so 256 is 1:1, 128 is twice the size |
119 | /// \param colour |
152 | /// \param colour colour code |
120 | void |
153 | void |
121 | printScaledString(font_t &font, char const *string, uint16_t length, |
154 | printScaledString(font_t &font, char const *string, uint16_t length, |
122 | uint16_t scale, colour_t colour = WHITE); |
155 | uint16_t scale, colour_t colour = WHITE); |
123 | 156 | ||
124 | static const uint8_t NO_DECIMAL = 255; |
157 | static const uint8_t NO_DECIMAL = 255; |