Forked para SNOCC
Fork of RA8875 by
RA8875.h@96:40b74dd3695b, 2015-11-28 (annotated)
- Committer:
- WiredHome
- Date:
- Sat Nov 28 15:39:44 2015 +0000
- Revision:
- 96:40b74dd3695b
- Parent:
- 90:d113d71ae4f0
- Child:
- 98:ecebed9b80b2
Changes for the print screen function to use callbacks.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
WiredHome | 78:faf49c381591 | 1 | /// |
WiredHome | 78:faf49c381591 | 2 | /// @mainpage RA8875 Display Controller Driver library |
WiredHome | 78:faf49c381591 | 3 | /// |
WiredHome | 78:faf49c381591 | 4 | /// The RA8875 Display controller is a powerful interface for low cost displays. It |
WiredHome | 78:faf49c381591 | 5 | /// can support displays up to 800 x 600 pixels x 16-bit color. Another common |
WiredHome | 78:faf49c381591 | 6 | /// implementation is 480 x 272 x 16 with two layers. The two layers can be |
WiredHome | 78:faf49c381591 | 7 | /// exchanged, or blended in various ways (transparency, OR, AND, and more). |
WiredHome | 78:faf49c381591 | 8 | /// It includes graphics acceleration capabilities for drawing primitives, |
WiredHome | 78:faf49c381591 | 9 | /// such as line, rectangle, circles, and more. |
WiredHome | 78:faf49c381591 | 10 | /// |
WiredHome | 78:faf49c381591 | 11 | /// The controller additionally supports backlight control (via PWM), keypad scanning |
WiredHome | 78:faf49c381591 | 12 | /// (for a 4 x 5 matrix) and resistive touch-panel support. |
WiredHome | 78:faf49c381591 | 13 | /// |
WiredHome | 78:faf49c381591 | 14 | /// @section Display_Config Display Configuration |
WiredHome | 78:faf49c381591 | 15 | /// |
WiredHome | 78:faf49c381591 | 16 | /// This section details basics for bringing the display online. At a minimum, |
WiredHome | 78:faf49c381591 | 17 | /// the display is instantiated. After that any of the available commands |
WiredHome | 78:faf49c381591 | 18 | /// may be issued. |
WiredHome | 78:faf49c381591 | 19 | /// |
WiredHome | 78:faf49c381591 | 20 | /// During the instantiation, the display is powered on, cleared, and the backlight |
WiredHome | 78:faf49c381591 | 21 | /// is energized. Additionally, the keypad and touchscreen features are activated. |
WiredHome | 78:faf49c381591 | 22 | /// It is important to keep in mind that the keypad had the default mapping, and |
WiredHome | 78:faf49c381591 | 23 | /// the touchscreen does not have the calibration matrix configured, so additional |
WiredHome | 78:faf49c381591 | 24 | /// steps may be necessary. |
WiredHome | 78:faf49c381591 | 25 | /// |
WiredHome | 78:faf49c381591 | 26 | /// @code |
WiredHome | 78:faf49c381591 | 27 | /// RA8875 lcd(p5, p6, p7, p12, NC, "tft"); |
WiredHome | 81:01da2e34283d | 28 | /// lcd.init(); |
WiredHome | 78:faf49c381591 | 29 | /// lcd.foreground(Blue); |
WiredHome | 78:faf49c381591 | 30 | /// lcd.line(0,0, 479,271); |
WiredHome | 78:faf49c381591 | 31 | /// ... |
WiredHome | 78:faf49c381591 | 32 | /// @endcode |
WiredHome | 78:faf49c381591 | 33 | /// |
WiredHome | 78:faf49c381591 | 34 | /// @section Touch_Panel Touch Panel |
WiredHome | 78:faf49c381591 | 35 | /// |
WiredHome | 78:faf49c381591 | 36 | /// The supported touch panel interface is for a resistive panel, and is natively |
WiredHome | 78:faf49c381591 | 37 | /// supported by the RA8875 controller. There are a few steps to enable this interface. |
WiredHome | 78:faf49c381591 | 38 | /// |
WiredHome | 78:faf49c381591 | 39 | /// @subsection Touch_Panel_Enable Touch Panel Enable |
WiredHome | 78:faf49c381591 | 40 | /// |
WiredHome | 78:faf49c381591 | 41 | /// @see TouchPanelInit has two forms - fully automatic, and controlled. See the APIs for |
WiredHome | 78:faf49c381591 | 42 | /// details. |
WiredHome | 78:faf49c381591 | 43 | /// |
WiredHome | 78:faf49c381591 | 44 | /// @subsection Touch_Panel_Calibration |
WiredHome | 78:faf49c381591 | 45 | /// |
WiredHome | 78:faf49c381591 | 46 | /// The touch panel is not initially calibrated on startup. The application should |
WiredHome | 78:faf49c381591 | 47 | /// provide a means to activate the calibration process, and that should not require |
WiredHome | 78:faf49c381591 | 48 | /// the touchscreen as it may not yet be usable. Alternately, a calibration matrix |
WiredHome | 78:faf49c381591 | 49 | /// can be loaded from non-volatile and installed. |
WiredHome | 78:faf49c381591 | 50 | /// |
WiredHome | 78:faf49c381591 | 51 | /// @section Keypad Keypad |
WiredHome | 78:faf49c381591 | 52 | /// |
WiredHome | 78:faf49c381591 | 53 | /// The keypad has a default keypad mapping, but there is an API that permits |
WiredHome | 78:faf49c381591 | 54 | /// installing a custom keymap. |
WiredHome | 78:faf49c381591 | 55 | /// |
WiredHome | 19:3f82c1161fd2 | 56 | #ifndef RA8875_H |
WiredHome | 19:3f82c1161fd2 | 57 | #define RA8875_H |
WiredHome | 19:3f82c1161fd2 | 58 | #include <mbed.h> |
WiredHome | 19:3f82c1161fd2 | 59 | |
WiredHome | 77:9206c13aa527 | 60 | #include "RA8875_Regs.h" |
WiredHome | 19:3f82c1161fd2 | 61 | #include "GraphicsDisplay.h" |
WiredHome | 19:3f82c1161fd2 | 62 | |
WiredHome | 41:2956a0a221e5 | 63 | #define RA8875_DEFAULT_SPI_FREQ 5000000 |
WiredHome | 19:3f82c1161fd2 | 64 | |
WiredHome | 19:3f82c1161fd2 | 65 | // Define this to enable code that monitors the performance of various |
WiredHome | 19:3f82c1161fd2 | 66 | // graphics commands. |
WiredHome | 78:faf49c381591 | 67 | //#define PERF_METRICS |
WiredHome | 19:3f82c1161fd2 | 68 | |
WiredHome | 23:a50ded45dbaf | 69 | // What better place for some test code than in here and the companion |
WiredHome | 23:a50ded45dbaf | 70 | // .cpp file. See also the bottom of this file. |
WiredHome | 79:544eb4964795 | 71 | //#define TESTENABLE |
WiredHome | 19:3f82c1161fd2 | 72 | |
WiredHome | 19:3f82c1161fd2 | 73 | /// DOS colors - slightly color enhanced |
WiredHome | 20:6e2e4a8372eb | 74 | #define Black (color_t)(RGB(0,0,0)) |
WiredHome | 20:6e2e4a8372eb | 75 | #define Blue (color_t)(RGB(0,0,187)) |
WiredHome | 20:6e2e4a8372eb | 76 | #define Green (color_t)(RGB(0,187,0)) |
WiredHome | 20:6e2e4a8372eb | 77 | #define Cyan (color_t)(RGB(0,187,187)) |
WiredHome | 20:6e2e4a8372eb | 78 | #define Red (color_t)(RGB(187,0,0)) |
WiredHome | 20:6e2e4a8372eb | 79 | #define Magenta (color_t)(RGB(187,0,187)) |
WiredHome | 81:01da2e34283d | 80 | #define Brown (color_t)(RGB(63,63,0)) |
WiredHome | 20:6e2e4a8372eb | 81 | #define Gray (color_t)(RGB(187,187,187)) |
WiredHome | 20:6e2e4a8372eb | 82 | #define Charcoal (color_t)(RGB(85,85,85)) |
WiredHome | 62:ba5d33438fda | 83 | #define BrightBlue (color_t)(RGB(0,0,255)) |
WiredHome | 62:ba5d33438fda | 84 | #define BrightGreen (color_t)(RGB(0,255,0)) |
WiredHome | 62:ba5d33438fda | 85 | #define BrightCyan (color_t)(RGB(0,255,255)) |
WiredHome | 62:ba5d33438fda | 86 | #define BrightRed (color_t)(RGB(255,0,0)) |
WiredHome | 20:6e2e4a8372eb | 87 | #define Orange (color_t)(RGB(255,85,85)) |
WiredHome | 20:6e2e4a8372eb | 88 | #define Pink (color_t)(RGB(255,85,255)) |
WiredHome | 81:01da2e34283d | 89 | #define Yellow (color_t)(RGB(187,187,0)) |
WiredHome | 20:6e2e4a8372eb | 90 | #define White (color_t)(RGB(255,255,255)) |
WiredHome | 20:6e2e4a8372eb | 91 | |
WiredHome | 62:ba5d33438fda | 92 | #define DarkBlue (color_t)(RGB(0,0,63)) |
WiredHome | 62:ba5d33438fda | 93 | #define DarkGreen (color_t)(RGB(0,63,0)) |
WiredHome | 62:ba5d33438fda | 94 | #define DarkCyan (color_t)(RGB(0,63,63)) |
WiredHome | 62:ba5d33438fda | 95 | #define DarkRed (color_t)(RGB(63,0,0)) |
WiredHome | 62:ba5d33438fda | 96 | #define DarkMagenta (color_t)(RGB(63,0,63)) |
WiredHome | 62:ba5d33438fda | 97 | #define DarkBrown (color_t)(RGB(63,63,0)) |
WiredHome | 62:ba5d33438fda | 98 | #define DarkGray (color_t)(RGB(63,63,63)) |
WiredHome | 61:8f3153bf0baa | 99 | |
WiredHome | 82:f7d300f26540 | 100 | #define min(a,b) ((a<b)?a:b) |
WiredHome | 82:f7d300f26540 | 101 | #define max(a,b) ((a>b)?a:b) |
WiredHome | 82:f7d300f26540 | 102 | |
WiredHome | 19:3f82c1161fd2 | 103 | |
WiredHome | 19:3f82c1161fd2 | 104 | //namespace SW_graphics |
WiredHome | 19:3f82c1161fd2 | 105 | //{ |
WiredHome | 19:3f82c1161fd2 | 106 | |
WiredHome | 96:40b74dd3695b | 107 | class FPointerDummy; // used by the callback methods. |
WiredHome | 24:8ca861acf12d | 108 | |
WiredHome | 21:3c1efb192927 | 109 | /// This is a graphics library for the Raio RA8875 Display Controller chip |
WiredHome | 21:3c1efb192927 | 110 | /// attached to a 4-wire SPI interface. |
WiredHome | 21:3c1efb192927 | 111 | /// |
WiredHome | 56:7a85d226ad0d | 112 | /// It offers both primitive and high level APIs. |
WiredHome | 56:7a85d226ad0d | 113 | /// |
WiredHome | 21:3c1efb192927 | 114 | /// Central to this API is a coordinate system, where the origin (0,0) is in |
WiredHome | 56:7a85d226ad0d | 115 | /// the top-left corner of the display, and the width (x) extends positive to the |
WiredHome | 56:7a85d226ad0d | 116 | /// right and the height (y) extends positive toward the bottom. |
WiredHome | 21:3c1efb192927 | 117 | /// |
WiredHome | 56:7a85d226ad0d | 118 | /// @caution As there are both graphics and text commands, one must take care to use |
WiredHome | 21:3c1efb192927 | 119 | /// the proper coordinate system for each. Some of the text APIs are in units |
WiredHome | 29:422616aa04bd | 120 | /// of column and row, which is measured in character positions (and dependent |
WiredHome | 56:7a85d226ad0d | 121 | /// on the font size), where other text APIs permit pixel level positioning. |
WiredHome | 56:7a85d226ad0d | 122 | /// |
WiredHome | 56:7a85d226ad0d | 123 | /// @code |
WiredHome | 56:7a85d226ad0d | 124 | /// #include "RA8875.h" |
WiredHome | 56:7a85d226ad0d | 125 | /// RA8875 lcd(p5, p6, p7, p12, NC, "tft"); |
WiredHome | 56:7a85d226ad0d | 126 | /// |
WiredHome | 56:7a85d226ad0d | 127 | /// int main() |
WiredHome | 56:7a85d226ad0d | 128 | /// { |
WiredHome | 81:01da2e34283d | 129 | /// lcd.init(); |
WiredHome | 56:7a85d226ad0d | 130 | /// lcd.printf("printing 3 x 2 = %d", 3*2); |
WiredHome | 56:7a85d226ad0d | 131 | /// lcd.circle( 400,25, 25, BrightRed); |
WiredHome | 56:7a85d226ad0d | 132 | /// lcd.fillcircle( 400,25, 15, RGB(128,255,128)); |
WiredHome | 56:7a85d226ad0d | 133 | /// lcd.ellipse( 440,75, 35,20, BrightBlue); |
WiredHome | 56:7a85d226ad0d | 134 | /// lcd.fillellipse( 440,75, 25,10, Blue); |
WiredHome | 56:7a85d226ad0d | 135 | /// lcd.triangle( 440,100, 475,110, 450,125, Magenta); |
WiredHome | 56:7a85d226ad0d | 136 | /// lcd.filltriangle( 445,105, 467,111, 452,120, Cyan); |
WiredHome | 56:7a85d226ad0d | 137 | /// lcd.rect( 400,130, 475,155, Brown); |
WiredHome | 56:7a85d226ad0d | 138 | /// lcd.fillrect( 405,135, 470,150, Pink); |
WiredHome | 56:7a85d226ad0d | 139 | /// lcd.roundrect( 410,160, 475,190, 10,8, Yellow); |
WiredHome | 56:7a85d226ad0d | 140 | /// lcd.fillroundrect(415,165, 470,185, 5,3, Orange); |
WiredHome | 56:7a85d226ad0d | 141 | /// lcd.line( 430,200, 460,230, RGB(0,255,0)); |
WiredHome | 56:7a85d226ad0d | 142 | /// for (int i=0; i<=30; i+=5) |
WiredHome | 56:7a85d226ad0d | 143 | /// lcd.pixel(435+i,200+i, White); |
WiredHome | 56:7a85d226ad0d | 144 | /// } |
WiredHome | 56:7a85d226ad0d | 145 | /// @endcode |
WiredHome | 29:422616aa04bd | 146 | /// |
WiredHome | 31:c72e12cd5c67 | 147 | /// @todo Add Scroll support for text. |
WiredHome | 37:f19b7e7449dc | 148 | /// @todo Improve sync between internal and external font support - cursor, window, scroll. |
WiredHome | 75:ca78388cfd77 | 149 | /// @todo Add Hardware reset signal - but testing to date indicates it is not needed. |
WiredHome | 44:207594dece70 | 150 | /// @todo Add high level objects - x-y graph, meter, others... but these will |
WiredHome | 44:207594dece70 | 151 | /// probably be best served in another class, since they may not |
WiredHome | 44:207594dece70 | 152 | /// be needed for many uses. |
WiredHome | 21:3c1efb192927 | 153 | /// |
WiredHome | 19:3f82c1161fd2 | 154 | class RA8875 : public GraphicsDisplay |
WiredHome | 19:3f82c1161fd2 | 155 | { |
WiredHome | 19:3f82c1161fd2 | 156 | public: |
WiredHome | 53:86d24b9480b9 | 157 | /// cursor type to be shown as the text cursor. |
WiredHome | 53:86d24b9480b9 | 158 | typedef enum |
WiredHome | 53:86d24b9480b9 | 159 | { |
WiredHome | 53:86d24b9480b9 | 160 | NOCURSOR, ///< cursor is hidden |
WiredHome | 53:86d24b9480b9 | 161 | IBEAM, ///< | cursor |
WiredHome | 53:86d24b9480b9 | 162 | UNDER, ///< _ cursor |
WiredHome | 53:86d24b9480b9 | 163 | BLOCK ///< Block cursor |
WiredHome | 53:86d24b9480b9 | 164 | } cursor_t; |
WiredHome | 53:86d24b9480b9 | 165 | |
WiredHome | 19:3f82c1161fd2 | 166 | /// font type selection. |
WiredHome | 19:3f82c1161fd2 | 167 | typedef enum |
WiredHome | 19:3f82c1161fd2 | 168 | { |
WiredHome | 31:c72e12cd5c67 | 169 | ISO8859_1, ///< ISO8859-1 font |
WiredHome | 31:c72e12cd5c67 | 170 | ISO8859_2, ///< ISO8859-2 font |
WiredHome | 31:c72e12cd5c67 | 171 | ISO8859_3, ///< ISO8859-3 font |
WiredHome | 31:c72e12cd5c67 | 172 | ISO8859_4 ///< ISO8859-4 font |
WiredHome | 19:3f82c1161fd2 | 173 | } font_t; |
WiredHome | 19:3f82c1161fd2 | 174 | |
WiredHome | 84:e102021864b5 | 175 | /// display orientation |
WiredHome | 19:3f82c1161fd2 | 176 | typedef enum |
WiredHome | 19:3f82c1161fd2 | 177 | { |
WiredHome | 84:e102021864b5 | 178 | normal, ///< normal (landscape) orientation |
WiredHome | 84:e102021864b5 | 179 | rotate_0 = normal, ///< alternate to 'normal' |
WiredHome | 84:e102021864b5 | 180 | rotate_90, ///< rotated clockwise 90 degree |
WiredHome | 84:e102021864b5 | 181 | rotate_180, ///< rotated (clockwise) 180 degree |
WiredHome | 84:e102021864b5 | 182 | rotate_270, ///< rotated clockwise 270 degree |
WiredHome | 84:e102021864b5 | 183 | } orientation_t; |
WiredHome | 19:3f82c1161fd2 | 184 | |
WiredHome | 19:3f82c1161fd2 | 185 | /// alignment |
WiredHome | 19:3f82c1161fd2 | 186 | typedef enum |
WiredHome | 19:3f82c1161fd2 | 187 | { |
WiredHome | 31:c72e12cd5c67 | 188 | align_none, ///< align - none |
WiredHome | 31:c72e12cd5c67 | 189 | align_full ///< align - full |
WiredHome | 19:3f82c1161fd2 | 190 | } alignment_t; |
WiredHome | 19:3f82c1161fd2 | 191 | |
WiredHome | 19:3f82c1161fd2 | 192 | /// Scale factor - 1, 2, 3 4 |
WiredHome | 40:04aa280dfa39 | 193 | typedef int HorizontalScale; |
WiredHome | 19:3f82c1161fd2 | 194 | |
WiredHome | 19:3f82c1161fd2 | 195 | /// Scale factor - 1, 2, 3, 4 |
WiredHome | 40:04aa280dfa39 | 196 | typedef int VerticalScale; |
WiredHome | 19:3f82c1161fd2 | 197 | |
WiredHome | 19:3f82c1161fd2 | 198 | /// Clear screen region |
WiredHome | 19:3f82c1161fd2 | 199 | typedef enum |
WiredHome | 19:3f82c1161fd2 | 200 | { |
WiredHome | 31:c72e12cd5c67 | 201 | FULLWINDOW, ///< Full screen |
WiredHome | 31:c72e12cd5c67 | 202 | ACTIVEWINDOW ///< active window/region |
WiredHome | 19:3f82c1161fd2 | 203 | } Region_t; |
WiredHome | 19:3f82c1161fd2 | 204 | |
WiredHome | 61:8f3153bf0baa | 205 | /// Set the Layer Display Mode. @ref SetLayerMode |
WiredHome | 53:86d24b9480b9 | 206 | typedef enum |
WiredHome | 53:86d24b9480b9 | 207 | { |
WiredHome | 61:8f3153bf0baa | 208 | ShowLayer0, ///< Only layer 0 is visible, layer 1 is hidden (default) |
WiredHome | 56:7a85d226ad0d | 209 | ShowLayer1, ///< Only layer 1 is visible, layer 0 is hidden |
WiredHome | 53:86d24b9480b9 | 210 | LightenOverlay, ///< Lighten-overlay mode |
WiredHome | 53:86d24b9480b9 | 211 | TransparentMode, ///< Transparent mode |
WiredHome | 53:86d24b9480b9 | 212 | BooleanOR, ///< Boolean OR mode |
WiredHome | 53:86d24b9480b9 | 213 | BooleanAND, ///< Boolean AND mode |
WiredHome | 53:86d24b9480b9 | 214 | FloatingWindow ///< Floating Window mode |
WiredHome | 53:86d24b9480b9 | 215 | } LayerMode_T; |
WiredHome | 53:86d24b9480b9 | 216 | |
hexley | 54:e117ad10fba6 | 217 | /// Touch Panel modes |
hexley | 54:e117ad10fba6 | 218 | typedef enum |
hexley | 54:e117ad10fba6 | 219 | { |
hexley | 54:e117ad10fba6 | 220 | TP_Auto, ///< Auto touch detection mode |
hexley | 54:e117ad10fba6 | 221 | TP_Manual, ///< Manual touch detection mode |
hexley | 54:e117ad10fba6 | 222 | } tpmode_t; |
WiredHome | 96:40b74dd3695b | 223 | |
WiredHome | 96:40b74dd3695b | 224 | /// printscreen callback commands |
WiredHome | 96:40b74dd3695b | 225 | typedef enum |
WiredHome | 96:40b74dd3695b | 226 | { |
WiredHome | 96:40b74dd3695b | 227 | OPEN, ///< command to open the file. cast uint32_t * to the buffer to get the total size to be written. |
WiredHome | 96:40b74dd3695b | 228 | WRITE, ///< command to write some data, buffer points to the data and the size is in bytes. |
WiredHome | 96:40b74dd3695b | 229 | CLOSE, ///< command to close the file |
WiredHome | 96:40b74dd3695b | 230 | } filecmd_t; |
WiredHome | 96:40b74dd3695b | 231 | |
WiredHome | 96:40b74dd3695b | 232 | /// print screen callback |
WiredHome | 96:40b74dd3695b | 233 | /// |
WiredHome | 96:40b74dd3695b | 234 | /// The special form of the print screen will pass one blob at a time |
WiredHome | 96:40b74dd3695b | 235 | /// to the callback. There are basic command declaring that the stream |
WiredHome | 96:40b74dd3695b | 236 | /// can be opened, a block written, and the stream closed. There is |
WiredHome | 96:40b74dd3695b | 237 | /// also a command to communicate the total size being delivered. |
WiredHome | 96:40b74dd3695b | 238 | /// |
WiredHome | 96:40b74dd3695b | 239 | /// @code |
WiredHome | 96:40b74dd3695b | 240 | /// lcd.PrintScreen(x,y,w,h,callback); |
WiredHome | 96:40b74dd3695b | 241 | /// ... |
WiredHome | 96:40b74dd3695b | 242 | /// void callback(filecmd_t cmd, uint8_t * buffer, uint16_t size) { |
WiredHome | 96:40b74dd3695b | 243 | /// switch(cmd) { |
WiredHome | 96:40b74dd3695b | 244 | /// case OPEN: |
WiredHome | 96:40b74dd3695b | 245 | /// pc.printf("About to write %u bytes\r\n", *(uint32_t *)buffer); |
WiredHome | 96:40b74dd3695b | 246 | /// fh = fopen("file.bmp", "w+b"); |
WiredHome | 96:40b74dd3695b | 247 | /// break; |
WiredHome | 96:40b74dd3695b | 248 | /// case WRITE: |
WiredHome | 96:40b74dd3695b | 249 | /// fwrite(buffer, size, fh); |
WiredHome | 96:40b74dd3695b | 250 | /// break; |
WiredHome | 96:40b74dd3695b | 251 | /// case CLOSE: |
WiredHome | 96:40b74dd3695b | 252 | /// fclose(fh); |
WiredHome | 96:40b74dd3695b | 253 | /// break; |
WiredHome | 96:40b74dd3695b | 254 | /// default: |
WiredHome | 96:40b74dd3695b | 255 | /// pc.printf("Unexpected callback %d\r\n", cmd); |
WiredHome | 96:40b74dd3695b | 256 | /// break; |
WiredHome | 96:40b74dd3695b | 257 | /// } |
WiredHome | 96:40b74dd3695b | 258 | /// } |
WiredHome | 96:40b74dd3695b | 259 | /// @endcode |
WiredHome | 96:40b74dd3695b | 260 | /// |
WiredHome | 96:40b74dd3695b | 261 | /// @param cmd is the command to execute. @see filecmd_t. |
WiredHome | 96:40b74dd3695b | 262 | /// @param buffer is a pointer to the buffer being passed. |
WiredHome | 96:40b74dd3695b | 263 | /// @param size is the number of bytes in the buffer. |
WiredHome | 96:40b74dd3695b | 264 | /// |
WiredHome | 96:40b74dd3695b | 265 | typedef RetCode_t (* PrintCallback_T)(filecmd_t cmd, uint8_t * buffer, uint16_t size); |
hexley | 54:e117ad10fba6 | 266 | |
WiredHome | 19:3f82c1161fd2 | 267 | /// Constructor for a display based on the RAiO RA8875 |
WiredHome | 19:3f82c1161fd2 | 268 | /// display controller. |
WiredHome | 19:3f82c1161fd2 | 269 | /// |
WiredHome | 61:8f3153bf0baa | 270 | /// This configures the registers and calls the @ref init method. |
WiredHome | 61:8f3153bf0baa | 271 | /// |
WiredHome | 56:7a85d226ad0d | 272 | /// @code |
WiredHome | 56:7a85d226ad0d | 273 | /// #include "RA8875.h" |
WiredHome | 56:7a85d226ad0d | 274 | /// RA8875 lcd(p5, p6, p7, p12, NC, "tft"); |
WiredHome | 56:7a85d226ad0d | 275 | /// |
WiredHome | 56:7a85d226ad0d | 276 | /// int main() |
WiredHome | 56:7a85d226ad0d | 277 | /// { |
WiredHome | 81:01da2e34283d | 278 | /// lcd.init(); |
WiredHome | 56:7a85d226ad0d | 279 | /// lcd.printf("printing 3 x 2 = %d", 3*2); |
WiredHome | 56:7a85d226ad0d | 280 | /// lcd.circle(400,25, 25, BrightRed); |
WiredHome | 56:7a85d226ad0d | 281 | /// } |
WiredHome | 56:7a85d226ad0d | 282 | /// @endcode |
WiredHome | 56:7a85d226ad0d | 283 | /// |
WiredHome | 72:ecffe56af969 | 284 | /// @param[in] mosi is the SPI master out slave in pin on the mbed. |
WiredHome | 72:ecffe56af969 | 285 | /// @param[in] miso is the SPI master in slave out pin on the mbed. |
WiredHome | 72:ecffe56af969 | 286 | /// @param[in] sclk is the SPI shift clock pin on the mbed. |
WiredHome | 72:ecffe56af969 | 287 | /// @param[in] csel is the DigitalOut pin on the mbed to use as the |
WiredHome | 19:3f82c1161fd2 | 288 | /// active low chip select for the display controller. |
WiredHome | 72:ecffe56af969 | 289 | /// @param[in] reset is the DigitalOut pin on the mbed to use as the |
WiredHome | 19:3f82c1161fd2 | 290 | /// active low reset input on the display controller - |
WiredHome | 19:3f82c1161fd2 | 291 | /// but this is not currently used. |
WiredHome | 72:ecffe56af969 | 292 | /// @param[in] name is a text name for this object, which will permit |
WiredHome | 72:ecffe56af969 | 293 | /// capturing stdout to puts() and printf() directly to it. |
WiredHome | 19:3f82c1161fd2 | 294 | /// |
WiredHome | 19:3f82c1161fd2 | 295 | RA8875(PinName mosi, PinName miso, PinName sclk, PinName csel, PinName reset, const char * name = "lcd"); |
WiredHome | 19:3f82c1161fd2 | 296 | |
WiredHome | 45:679c2fb8480c | 297 | // Destructor doesn't have much to do as this would typically be created |
WiredHome | 45:679c2fb8480c | 298 | // at startup, and not at runtime. |
WiredHome | 19:3f82c1161fd2 | 299 | //~RA8875(); |
WiredHome | 19:3f82c1161fd2 | 300 | |
WiredHome | 79:544eb4964795 | 301 | /// Initialize the driver. |
WiredHome | 79:544eb4964795 | 302 | /// |
WiredHome | 81:01da2e34283d | 303 | /// @param[in] width in pixels to configure the display for. This parameter is optional |
WiredHome | 81:01da2e34283d | 304 | /// and the default is 480. |
WiredHome | 81:01da2e34283d | 305 | /// @param[in] height in pixels to configure the display for. This parameter is optional |
WiredHome | 81:01da2e34283d | 306 | /// and the default is 272. |
WiredHome | 81:01da2e34283d | 307 | /// @param[in] color_bpp can be either 8 or 16, but must be consistent |
WiredHome | 81:01da2e34283d | 308 | /// with the width and height parameters. This parameter is optional |
WiredHome | 81:01da2e34283d | 309 | /// and the default is 16. |
WiredHome | 79:544eb4964795 | 310 | /// @param[in] power defines if the display should be left in the power-on or off state. |
WiredHome | 81:01da2e34283d | 311 | /// If power is true (on), the backlight is set to 100%. This parameter is optional |
WiredHome | 81:01da2e34283d | 312 | /// and the default is true (on). @see Power. |
WiredHome | 81:01da2e34283d | 313 | /// @param[in] keypadon defines if the keypad support should be enabled. This parameter is optional |
WiredHome | 81:01da2e34283d | 314 | /// and the default is true (enabled). @see KeypadInit. |
WiredHome | 81:01da2e34283d | 315 | /// @param[in] touchscreeenon defines if the keypad support should be enabled. This parameter is optional |
WiredHome | 81:01da2e34283d | 316 | /// and the default is true (enabled). @see TouchPanelInit. |
WiredHome | 79:544eb4964795 | 317 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 79:544eb4964795 | 318 | /// |
WiredHome | 81:01da2e34283d | 319 | RetCode_t init(int width = 480, int height = 272, int color_bpp = 16, |
WiredHome | 81:01da2e34283d | 320 | bool poweron = true, bool keypadon = true, bool touchscreeenon = true); |
WiredHome | 79:544eb4964795 | 321 | |
WiredHome | 79:544eb4964795 | 322 | /// Get a pointer to the error code. |
WiredHome | 79:544eb4964795 | 323 | /// |
WiredHome | 79:544eb4964795 | 324 | /// This method returns a pointer to a text string that matches the |
WiredHome | 79:544eb4964795 | 325 | /// code. @see RetCode_t. |
WiredHome | 79:544eb4964795 | 326 | /// |
WiredHome | 79:544eb4964795 | 327 | /// @param[in] code is the return value from RetCode_t to look up. |
WiredHome | 79:544eb4964795 | 328 | /// @returns a pointer to the text message representing code. If code |
WiredHome | 79:544eb4964795 | 329 | /// is not a valid value, then it returns the text for bad_parameter; |
WiredHome | 79:544eb4964795 | 330 | const char * GetErrorMessage(RetCode_t code); |
WiredHome | 79:544eb4964795 | 331 | |
WiredHome | 79:544eb4964795 | 332 | |
WiredHome | 50:2c4f474a2453 | 333 | /// Select the drawing layer for subsequent commands. |
WiredHome | 43:3becae133285 | 334 | /// |
WiredHome | 43:3becae133285 | 335 | /// If the screen configuration is 480 x 272, or if it is 800 x 480 |
WiredHome | 43:3becae133285 | 336 | /// and 8-bit color, the the display supports two layers, which can |
WiredHome | 43:3becae133285 | 337 | /// be independently drawn on and shown. Additionally, complex |
WiredHome | 43:3becae133285 | 338 | /// operations involving both layers are permitted. |
WiredHome | 43:3becae133285 | 339 | /// |
WiredHome | 56:7a85d226ad0d | 340 | /// @code |
WiredHome | 56:7a85d226ad0d | 341 | /// //lcd.SetLayerMode(OnlyLayer0); // default is layer 0 |
WiredHome | 56:7a85d226ad0d | 342 | /// lcd.rect(400,130, 475,155,Brown); |
WiredHome | 56:7a85d226ad0d | 343 | /// lcd.SelectDrawingLayer(1); |
WiredHome | 56:7a85d226ad0d | 344 | /// lcd.circle(400,25, 25, BrightRed); |
WiredHome | 56:7a85d226ad0d | 345 | /// wait(1); |
WiredHome | 56:7a85d226ad0d | 346 | /// lcd.SetLayerMode(ShowLayer1); |
WiredHome | 56:7a85d226ad0d | 347 | /// @endcode |
WiredHome | 56:7a85d226ad0d | 348 | /// |
WiredHome | 61:8f3153bf0baa | 349 | /// @attention The user manual refers to Layer 1 and Layer 2, however the |
WiredHome | 61:8f3153bf0baa | 350 | /// actual register values are value 0 and 1. This API as well as |
WiredHome | 61:8f3153bf0baa | 351 | /// others that reference the layers use the values 0 and 1 for |
WiredHome | 61:8f3153bf0baa | 352 | /// cleaner iteration in the code. |
WiredHome | 43:3becae133285 | 353 | /// |
WiredHome | 72:ecffe56af969 | 354 | /// @param[in] layer is 0 or 1 to select the layer for subsequent |
WiredHome | 61:8f3153bf0baa | 355 | /// commands. |
WiredHome | 43:3becae133285 | 356 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 43:3becae133285 | 357 | /// |
WiredHome | 50:2c4f474a2453 | 358 | RetCode_t SelectDrawingLayer(uint16_t layer); |
WiredHome | 43:3becae133285 | 359 | |
WiredHome | 61:8f3153bf0baa | 360 | /// Get the currently active drawing layer. |
WiredHome | 61:8f3153bf0baa | 361 | /// |
WiredHome | 61:8f3153bf0baa | 362 | /// This returns a value, 0 or 1, based on the screen configuration |
WiredHome | 61:8f3153bf0baa | 363 | /// and the currently active drawing layer. |
WiredHome | 61:8f3153bf0baa | 364 | /// |
WiredHome | 61:8f3153bf0baa | 365 | /// @code |
WiredHome | 61:8f3153bf0baa | 366 | /// uint16_t prevLayer = lcd.GetDrawingLayer(); |
WiredHome | 61:8f3153bf0baa | 367 | /// lcd.SelectDrawingLayer(x); |
WiredHome | 61:8f3153bf0baa | 368 | /// lcd.circle(400,25, 25, BrightRed); |
WiredHome | 61:8f3153bf0baa | 369 | /// lcd.SelectDrawingLayer(prevLayer); |
WiredHome | 61:8f3153bf0baa | 370 | /// @endcode |
WiredHome | 61:8f3153bf0baa | 371 | /// |
WiredHome | 61:8f3153bf0baa | 372 | /// @attention The user manual refers to Layer 1 and Layer 2, however the |
WiredHome | 61:8f3153bf0baa | 373 | /// actual register values are value 0 and 1. This API as well as |
WiredHome | 61:8f3153bf0baa | 374 | /// others that reference the layers use the values 0 and 1 for |
WiredHome | 61:8f3153bf0baa | 375 | /// cleaner iteration in the code. |
WiredHome | 61:8f3153bf0baa | 376 | /// |
WiredHome | 61:8f3153bf0baa | 377 | /// @returns the current drawing layer; 0 or 1. |
WiredHome | 61:8f3153bf0baa | 378 | /// |
WiredHome | 61:8f3153bf0baa | 379 | uint16_t GetDrawingLayer(void); |
WiredHome | 61:8f3153bf0baa | 380 | |
WiredHome | 44:207594dece70 | 381 | /// Set the Layer presentation mode. |
WiredHome | 44:207594dece70 | 382 | /// |
WiredHome | 44:207594dece70 | 383 | /// This sets the presentation mode for layers, and permits showing |
WiredHome | 44:207594dece70 | 384 | /// a single layer, or applying a mode where the two layers |
WiredHome | 44:207594dece70 | 385 | /// are combined using one of the hardware methods. |
WiredHome | 44:207594dece70 | 386 | /// |
WiredHome | 61:8f3153bf0baa | 387 | /// Refer to the RA8875 data sheet for full details. |
WiredHome | 61:8f3153bf0baa | 388 | /// |
WiredHome | 56:7a85d226ad0d | 389 | /// @code |
WiredHome | 56:7a85d226ad0d | 390 | /// //lcd.SetLayerMode(OnlyLayer0); // default is layer 0 |
WiredHome | 56:7a85d226ad0d | 391 | /// lcd.rect(400,130, 475,155,Brown); |
WiredHome | 56:7a85d226ad0d | 392 | /// lcd.SelectDrawingLayer(1); |
WiredHome | 56:7a85d226ad0d | 393 | /// lcd.circle(400,25, 25, BrightRed); |
WiredHome | 56:7a85d226ad0d | 394 | /// wait(1); |
WiredHome | 56:7a85d226ad0d | 395 | /// lcd.SetLayerMode(ShowLayer1); |
WiredHome | 56:7a85d226ad0d | 396 | /// @endcode |
WiredHome | 56:7a85d226ad0d | 397 | /// |
WiredHome | 72:ecffe56af969 | 398 | /// @param[in] mode sets the mode in the Layer Transparency Register. |
WiredHome | 44:207594dece70 | 399 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 44:207594dece70 | 400 | /// |
WiredHome | 53:86d24b9480b9 | 401 | RetCode_t SetLayerMode(LayerMode_T mode); |
WiredHome | 44:207594dece70 | 402 | |
WiredHome | 82:f7d300f26540 | 403 | /// Get the Layer presentation mode. |
WiredHome | 82:f7d300f26540 | 404 | /// |
WiredHome | 82:f7d300f26540 | 405 | /// This gets the current layer mode. @see LayerMode_T. |
WiredHome | 82:f7d300f26540 | 406 | /// |
WiredHome | 82:f7d300f26540 | 407 | /// @returns layer mode. |
WiredHome | 82:f7d300f26540 | 408 | /// |
WiredHome | 82:f7d300f26540 | 409 | LayerMode_T GetLayerMode(void); |
WiredHome | 82:f7d300f26540 | 410 | |
WiredHome | 44:207594dece70 | 411 | /// Set the layer transparency for each layer. |
WiredHome | 44:207594dece70 | 412 | /// |
WiredHome | 44:207594dece70 | 413 | /// Set the transparency, where the range of values is |
WiredHome | 44:207594dece70 | 414 | /// from zero (fully visible) to eight (fully transparent). |
WiredHome | 44:207594dece70 | 415 | /// The input value is automatically limited to this range. |
WiredHome | 44:207594dece70 | 416 | /// |
WiredHome | 56:7a85d226ad0d | 417 | /// @code |
WiredHome | 56:7a85d226ad0d | 418 | /// // draw something on each layer, then step-fade across |
WiredHome | 56:7a85d226ad0d | 419 | /// display.SetLayerMode(RA8875::TransparentMode); |
WiredHome | 56:7a85d226ad0d | 420 | /// for (i=0; i<=8; i++) { |
WiredHome | 56:7a85d226ad0d | 421 | /// display.SetLayerTransparency(i, 8-i); |
WiredHome | 56:7a85d226ad0d | 422 | /// wait_ms(200); |
WiredHome | 56:7a85d226ad0d | 423 | /// } |
WiredHome | 56:7a85d226ad0d | 424 | /// @endcode |
WiredHome | 56:7a85d226ad0d | 425 | /// |
WiredHome | 72:ecffe56af969 | 426 | /// @param[in] layer1 sets the layer 1 transparency. |
WiredHome | 72:ecffe56af969 | 427 | /// @param[in] layer2 sets the layer 2 transparency. |
WiredHome | 44:207594dece70 | 428 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 44:207594dece70 | 429 | /// |
WiredHome | 44:207594dece70 | 430 | RetCode_t SetLayerTransparency(uint8_t layer1, uint8_t layer2); |
WiredHome | 44:207594dece70 | 431 | |
WiredHome | 53:86d24b9480b9 | 432 | /// Set the background color register used for transparency. |
WiredHome | 53:86d24b9480b9 | 433 | /// |
WiredHome | 53:86d24b9480b9 | 434 | /// This command sets the background color registers that are used |
WiredHome | 53:86d24b9480b9 | 435 | /// in the transparent color operations involving the layers. |
WiredHome | 53:86d24b9480b9 | 436 | /// |
WiredHome | 72:ecffe56af969 | 437 | /// @param[in] color is optional and expressed in 16-bit format. If not |
WiredHome | 53:86d24b9480b9 | 438 | /// supplied, a default of Black is used. |
WiredHome | 53:86d24b9480b9 | 439 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 53:86d24b9480b9 | 440 | /// |
WiredHome | 53:86d24b9480b9 | 441 | RetCode_t SetBackgroundTransparencyColor(color_t color = RGB(0,0,0)); |
hexley | 54:e117ad10fba6 | 442 | |
WiredHome | 73:f22a18707b5e | 443 | |
WiredHome | 73:f22a18707b5e | 444 | /// Get the background color value used for transparency. |
WiredHome | 73:f22a18707b5e | 445 | /// |
WiredHome | 73:f22a18707b5e | 446 | /// This command reads the background color registers that define |
WiredHome | 73:f22a18707b5e | 447 | /// the transparency color for operations involving layers. |
WiredHome | 73:f22a18707b5e | 448 | /// |
WiredHome | 73:f22a18707b5e | 449 | /// @returns the color. |
WiredHome | 73:f22a18707b5e | 450 | /// |
WiredHome | 73:f22a18707b5e | 451 | color_t GetBackgroundTransparencyColor(void); |
WiredHome | 73:f22a18707b5e | 452 | |
hexley | 54:e117ad10fba6 | 453 | /// Initialize theTouch Panel controller with default values |
hexley | 54:e117ad10fba6 | 454 | /// |
WiredHome | 78:faf49c381591 | 455 | /// This activates the simplified touch panel init, which may work for |
WiredHome | 78:faf49c381591 | 456 | /// most uses. The alternate API is available if fine-grained control |
WiredHome | 78:faf49c381591 | 457 | /// is needed for the numerous settings. |
WiredHome | 78:faf49c381591 | 458 | /// |
WiredHome | 56:7a85d226ad0d | 459 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 56:7a85d226ad0d | 460 | /// |
hexley | 54:e117ad10fba6 | 461 | RetCode_t TouchPanelInit(void); |
hexley | 54:e117ad10fba6 | 462 | |
hexley | 54:e117ad10fba6 | 463 | /// Initialize the Touch Panel controller with detailed settings. |
hexley | 54:e117ad10fba6 | 464 | /// |
WiredHome | 78:faf49c381591 | 465 | /// This is the detailed touch panel init, which provides the ability |
WiredHome | 78:faf49c381591 | 466 | /// to set nearly every possible option. |
WiredHome | 78:faf49c381591 | 467 | /// |
hexley | 54:e117ad10fba6 | 468 | /// @param[in] bTpEnable Touch Panel enable/disable control: |
hexley | 54:e117ad10fba6 | 469 | /// - TP_ENABLE: enable the touch panel |
hexley | 54:e117ad10fba6 | 470 | /// - TP_DISABLE: disable the touch panel |
WiredHome | 56:7a85d226ad0d | 471 | /// @param[in] bTpAutoManual Touch Panel operating mode: |
hexley | 54:e117ad10fba6 | 472 | /// - TP_MODE_AUTO: automatic capture |
hexley | 54:e117ad10fba6 | 473 | /// - TP_MODE_MANUAL: manual capture |
WiredHome | 56:7a85d226ad0d | 474 | /// @param[in] bTpDebounce Debounce circuit enable for touch panel interrupt: |
hexley | 54:e117ad10fba6 | 475 | /// - TP_DEBOUNCE_OFF: disable the debounce circuit |
hexley | 54:e117ad10fba6 | 476 | /// - TP_DEBOUNCE_ON: enable the debounce circuit |
WiredHome | 56:7a85d226ad0d | 477 | /// @param[in] bTpManualMode When Manual Mode is selected, this sets the mode: |
hexley | 54:e117ad10fba6 | 478 | /// - TP_MANUAL_IDLE: touch panel is idle |
hexley | 54:e117ad10fba6 | 479 | /// - TP_MANUAL_WAIT: wait for touch panel event |
hexley | 54:e117ad10fba6 | 480 | /// - TP_MANUAL_LATCH_X: latch X data |
hexley | 54:e117ad10fba6 | 481 | /// - TP_MANUAL_LATCH_Y: latch Y data |
WiredHome | 56:7a85d226ad0d | 482 | /// @param[in] bTpAdcClkDiv Sets the ADC clock as a fraction of the System CLK: |
hexley | 54:e117ad10fba6 | 483 | /// - TP_ADC_CLKDIV_1: Use CLK |
hexley | 54:e117ad10fba6 | 484 | /// - TP_ADC_CLKDIV_2: Use CLK/2 |
hexley | 54:e117ad10fba6 | 485 | /// - TP_ADC_CLKDIV_4: Use CLK/4 |
hexley | 54:e117ad10fba6 | 486 | /// - TP_ADC_CLKDIV_8: Use CLK/8 |
hexley | 54:e117ad10fba6 | 487 | /// - TP_ADC_CLKDIV_16: Use CLK/16 |
hexley | 54:e117ad10fba6 | 488 | /// - TP_ADC_CLKDIV_32: Use CLK/32 |
hexley | 54:e117ad10fba6 | 489 | /// - TP_ADC_CLKDIV_64: Use CLK/64 |
hexley | 54:e117ad10fba6 | 490 | /// - TP_ADC_CLKDIV_128: Use CLK/128 |
WiredHome | 56:7a85d226ad0d | 491 | /// @param[in] bTpAdcSampleTime Touch Panel sample time delay before ADC data is ready: |
hexley | 54:e117ad10fba6 | 492 | /// - TP_ADC_SAMPLE_512_CLKS: Wait 512 system clocks |
hexley | 54:e117ad10fba6 | 493 | /// - TP_ADC_SAMPLE_1024_CLKS: Wait 1024 system clocks |
hexley | 54:e117ad10fba6 | 494 | /// - TP_ADC_SAMPLE_2048_CLKS: Wait 2048 system clocks |
hexley | 54:e117ad10fba6 | 495 | /// - TP_ADC_SAMPLE_4096_CLKS: Wait 4096 system clocks |
hexley | 54:e117ad10fba6 | 496 | /// - TP_ADC_SAMPLE_8192_CLKS: Wait 8192 system clocks |
hexley | 54:e117ad10fba6 | 497 | /// - TP_ADC_SAMPLE_16384_CLKS: Wait 16384 system clocks |
hexley | 54:e117ad10fba6 | 498 | /// - TP_ADC_SAMPLE_32768_CLKS: Wait 32768 system clocks |
hexley | 54:e117ad10fba6 | 499 | /// - TP_ADC_SAMPLE_65536_CLKS: Wait 65536 system clocks |
WiredHome | 56:7a85d226ad0d | 500 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 56:7a85d226ad0d | 501 | /// |
WiredHome | 78:faf49c381591 | 502 | RetCode_t TouchPanelInit(uint8_t bTpEnable, uint8_t bTpAutoManual, uint8_t bTpDebounce, |
WiredHome | 78:faf49c381591 | 503 | uint8_t bTpManualMode, uint8_t bTpAdcClkDiv, uint8_t bTpAdcSampleTime); |
WiredHome | 53:86d24b9480b9 | 504 | |
WiredHome | 79:544eb4964795 | 505 | /// Poll the TouchPanel and on a touch event return the a to d filtered x, y coordinates. |
hexley | 54:e117ad10fba6 | 506 | /// |
WiredHome | 78:faf49c381591 | 507 | /// This method reads the touch controller, which has a 10-bit range for each the |
WiredHome | 79:544eb4964795 | 508 | /// x and the y axis. |
WiredHome | 79:544eb4964795 | 509 | /// |
WiredHome | 79:544eb4964795 | 510 | /// @note The returned values are not in display (pixel) units but are in analog to |
WiredHome | 79:544eb4964795 | 511 | /// digital converter units. |
WiredHome | 78:faf49c381591 | 512 | /// |
WiredHome | 81:01da2e34283d | 513 | /// @note This API is usually not needed. @see TouchPanelComputeCalibration. |
WiredHome | 79:544eb4964795 | 514 | /// @see TouchPanelReadable. |
WiredHome | 78:faf49c381591 | 515 | /// |
WiredHome | 79:544eb4964795 | 516 | /// @param[out] x is the x scale a/d value. |
WiredHome | 79:544eb4964795 | 517 | /// @param[out] y is the y scale a/d value. |
WiredHome | 83:7bad0068cca0 | 518 | /// @returns a value indicating the state of the touch, |
WiredHome | 83:7bad0068cca0 | 519 | /// - no_cal: no calibration matrix is available, touch coordinates are not returned. |
WiredHome | 83:7bad0068cca0 | 520 | /// - no_touch: no touch is detected, touch coordinates are not returned. |
WiredHome | 83:7bad0068cca0 | 521 | /// - touch: touch is detected, touch coordinates are returned. |
WiredHome | 83:7bad0068cca0 | 522 | /// - held: held after touch, touch coordinates are returned. |
WiredHome | 83:7bad0068cca0 | 523 | /// - release: indicates a release, touch coordinates are returned. |
WiredHome | 56:7a85d226ad0d | 524 | /// |
WiredHome | 83:7bad0068cca0 | 525 | TouchCode_t TouchPanelA2DFiltered(int *x, int *y); |
hexley | 54:e117ad10fba6 | 526 | |
WiredHome | 79:544eb4964795 | 527 | /// Poll the TouchPanel and on a touch event return the a to d raw x, y coordinates. |
hexley | 54:e117ad10fba6 | 528 | /// |
WiredHome | 78:faf49c381591 | 529 | /// This method reads the touch controller, which has a 10-bit range for each the |
WiredHome | 78:faf49c381591 | 530 | /// x and the y axis. A number of samples of the raw data are taken, filtered, |
WiredHome | 79:544eb4964795 | 531 | /// and the results are returned. |
WiredHome | 78:faf49c381591 | 532 | /// |
WiredHome | 79:544eb4964795 | 533 | /// @note The returned values are not in display (pixel) units but are in analog to |
WiredHome | 79:544eb4964795 | 534 | /// digital converter units. |
WiredHome | 79:544eb4964795 | 535 | /// |
WiredHome | 81:01da2e34283d | 536 | /// @note This API is usually not needed. @see TouchPanelComputeCalibration. |
WiredHome | 79:544eb4964795 | 537 | /// @see TouchPanelReadable. |
WiredHome | 78:faf49c381591 | 538 | /// |
WiredHome | 79:544eb4964795 | 539 | /// @param[out] x is the x scale a/d value. |
WiredHome | 79:544eb4964795 | 540 | /// @param[out] y is the y scale a/d value. |
WiredHome | 83:7bad0068cca0 | 541 | /// @returns a value indicating the state of the touch, |
WiredHome | 83:7bad0068cca0 | 542 | /// - no_cal: no calibration matrix is available, touch coordinates are not returned. |
WiredHome | 83:7bad0068cca0 | 543 | /// - no_touch: no touch is detected, touch coordinates are not returned. |
WiredHome | 83:7bad0068cca0 | 544 | /// - touch: touch is detected, touch coordinates are returned. |
WiredHome | 83:7bad0068cca0 | 545 | /// - held: held after touch, touch coordinates are returned. |
WiredHome | 83:7bad0068cca0 | 546 | /// - release: indicates a release, touch coordinates are returned. |
WiredHome | 83:7bad0068cca0 | 547 | /// |
WiredHome | 83:7bad0068cca0 | 548 | TouchCode_t TouchPanelA2DRaw(int *x, int *y); |
WiredHome | 83:7bad0068cca0 | 549 | |
WiredHome | 83:7bad0068cca0 | 550 | /// Get the screen calibrated point of touch. |
WiredHome | 83:7bad0068cca0 | 551 | /// |
WiredHome | 83:7bad0068cca0 | 552 | /// This method determines if there is a touch and if so it will provide |
WiredHome | 83:7bad0068cca0 | 553 | /// the screen-relative touch coordinates. This method can be used in |
WiredHome | 83:7bad0068cca0 | 554 | /// a manner similar to Serial.readable(), to determine if there was a |
WiredHome | 83:7bad0068cca0 | 555 | /// touch and indicate that - but not care about the coordinates. Alternately, |
WiredHome | 83:7bad0068cca0 | 556 | /// if a valid pointer to a point_t is provided, then if a touch is detected |
WiredHome | 83:7bad0068cca0 | 557 | /// the point_t will be populated with data. |
WiredHome | 56:7a85d226ad0d | 558 | /// |
WiredHome | 83:7bad0068cca0 | 559 | /// @code |
WiredHome | 83:7bad0068cca0 | 560 | /// Timer t; |
WiredHome | 83:7bad0068cca0 | 561 | /// t.start(); |
WiredHome | 83:7bad0068cca0 | 562 | /// do { |
WiredHome | 83:7bad0068cca0 | 563 | /// point_t point = {0, 0}; |
WiredHome | 83:7bad0068cca0 | 564 | /// if (display.TouchPanelReadable(&point)) { |
WiredHome | 85:022bba13c5c4 | 565 | /// display.pixel(point, Red); |
WiredHome | 83:7bad0068cca0 | 566 | /// } |
WiredHome | 83:7bad0068cca0 | 567 | /// } while (t.read_ms() < 30000); |
WiredHome | 83:7bad0068cca0 | 568 | /// @endcode |
WiredHome | 83:7bad0068cca0 | 569 | /// |
WiredHome | 85:022bba13c5c4 | 570 | /// @param[out] TouchPoint is the touch point, if a touch is registered. |
WiredHome | 83:7bad0068cca0 | 571 | /// @returns a value indicating the state of the touch, |
WiredHome | 83:7bad0068cca0 | 572 | /// - no_cal: no calibration matrix is available, touch coordinates are not returned. |
WiredHome | 83:7bad0068cca0 | 573 | /// - no_touch: no touch is detected, touch coordinates are not returned. |
WiredHome | 83:7bad0068cca0 | 574 | /// - touch: touch is detected, touch coordinates are returned. |
WiredHome | 83:7bad0068cca0 | 575 | /// - held: held after touch, touch coordinates are returned. |
WiredHome | 83:7bad0068cca0 | 576 | /// - release: indicates a release, touch coordinates are returned. |
WiredHome | 83:7bad0068cca0 | 577 | /// |
WiredHome | 85:022bba13c5c4 | 578 | TouchCode_t TouchPanelReadable(point_t * TouchPoint = NULL); |
WiredHome | 85:022bba13c5c4 | 579 | |
WiredHome | 85:022bba13c5c4 | 580 | |
WiredHome | 85:022bba13c5c4 | 581 | /// Wait for a touch panel touch and return it. |
WiredHome | 85:022bba13c5c4 | 582 | /// |
WiredHome | 85:022bba13c5c4 | 583 | /// This method is similar to Serial.getc() in that it will wait for a touch |
WiredHome | 85:022bba13c5c4 | 584 | /// and then return. In order to extract the coordinates of the touch, a |
WiredHome | 85:022bba13c5c4 | 585 | /// valid pointer to a point_t must be provided. |
WiredHome | 85:022bba13c5c4 | 586 | /// |
WiredHome | 85:022bba13c5c4 | 587 | /// @note There is no timeout on this function, so its use is not recommended. |
WiredHome | 85:022bba13c5c4 | 588 | /// |
WiredHome | 85:022bba13c5c4 | 589 | /// @code |
WiredHome | 85:022bba13c5c4 | 590 | /// Timer t; |
WiredHome | 85:022bba13c5c4 | 591 | /// t.start(); |
WiredHome | 85:022bba13c5c4 | 592 | /// do { |
WiredHome | 85:022bba13c5c4 | 593 | /// point_t point = {0, 0}; |
WiredHome | 85:022bba13c5c4 | 594 | /// display.TouchPanelGet(&point); // hangs here until touch |
WiredHome | 85:022bba13c5c4 | 595 | /// display.pixel(point, Red); |
WiredHome | 85:022bba13c5c4 | 596 | /// } while (t.read_ms() < 30000); |
WiredHome | 85:022bba13c5c4 | 597 | /// @endcode |
WiredHome | 85:022bba13c5c4 | 598 | /// |
WiredHome | 85:022bba13c5c4 | 599 | /// @param[out] TouchPoint is the touch point, if a touch is registered. |
WiredHome | 85:022bba13c5c4 | 600 | /// @returns a value indicating the state of the touch, |
WiredHome | 85:022bba13c5c4 | 601 | /// - no_cal: no calibration matrix is available, touch coordinates are not returned. |
WiredHome | 85:022bba13c5c4 | 602 | /// - no_touch: no touch is detected, touch coordinates are not returned. |
WiredHome | 85:022bba13c5c4 | 603 | /// - touch: touch is detected, touch coordinates are returned. |
WiredHome | 85:022bba13c5c4 | 604 | /// - held: held after touch, touch coordinates are returned. |
WiredHome | 85:022bba13c5c4 | 605 | /// - release: indicates a release, touch coordinates are returned. |
WiredHome | 85:022bba13c5c4 | 606 | /// |
WiredHome | 85:022bba13c5c4 | 607 | TouchCode_t TouchPanelGet(point_t * TouchPoint); |
WiredHome | 85:022bba13c5c4 | 608 | |
WiredHome | 83:7bad0068cca0 | 609 | |
WiredHome | 77:9206c13aa527 | 610 | /// Calibrate the touch panel. |
WiredHome | 77:9206c13aa527 | 611 | /// |
WiredHome | 77:9206c13aa527 | 612 | /// This method accepts two lists - one list is target points in , |
WiredHome | 77:9206c13aa527 | 613 | /// display coordinates and the other is a lit of raw touch coordinate |
WiredHome | 77:9206c13aa527 | 614 | /// values. It generates a calibration matrix for later use. This |
WiredHome | 77:9206c13aa527 | 615 | /// matrix is also accessible to the calling API, which may store |
WiredHome | 77:9206c13aa527 | 616 | /// the matrix in persistent memory and then install the calibration |
WiredHome | 77:9206c13aa527 | 617 | /// matrix on the next power cycle. By doing so, it can avoid the |
WiredHome | 77:9206c13aa527 | 618 | /// need to calibrate on every power cycle. |
WiredHome | 77:9206c13aa527 | 619 | /// |
WiredHome | 81:01da2e34283d | 620 | /// @note The methods "TouchPanelComputeCalibration", "TouchPanelReadable", and |
WiredHome | 77:9206c13aa527 | 621 | /// indirectly the "TouchPanelSetMatrix" methods are all derived |
WiredHome | 77:9206c13aa527 | 622 | /// from a program by Carlos E. Vidales. See the copyright note |
WiredHome | 77:9206c13aa527 | 623 | /// for further details. See also the article |
WiredHome | 77:9206c13aa527 | 624 | /// http://www.embedded.com/design/system-integration/4023968/How-To-Calibrate-Touch-Screens |
WiredHome | 77:9206c13aa527 | 625 | /// |
WiredHome | 77:9206c13aa527 | 626 | /// @copyright Copyright (c) 2001, Carlos E. Vidales. All rights reserved. |
WiredHome | 78:faf49c381591 | 627 | /// This sample program was written and put in the public domain |
WiredHome | 78:faf49c381591 | 628 | /// by Carlos E. Vidales. The program is provided "as is" |
WiredHome | 78:faf49c381591 | 629 | /// without warranty of any kind, either expressed or implied. |
WiredHome | 78:faf49c381591 | 630 | /// If you choose to use the program within your own products |
WiredHome | 78:faf49c381591 | 631 | /// you do so at your own risk, and assume the responsibility |
WiredHome | 78:faf49c381591 | 632 | /// for servicing, repairing or correcting the program should |
WiredHome | 78:faf49c381591 | 633 | /// it prove defective in any manner. |
WiredHome | 78:faf49c381591 | 634 | /// You may copy and distribute the program's source code in any |
WiredHome | 78:faf49c381591 | 635 | /// medium, provided that you also include in each copy an |
WiredHome | 78:faf49c381591 | 636 | /// appropriate copyright notice and disclaimer of warranty. |
WiredHome | 78:faf49c381591 | 637 | /// You may also modify this program and distribute copies of |
WiredHome | 78:faf49c381591 | 638 | /// it provided that you include prominent notices stating |
WiredHome | 78:faf49c381591 | 639 | /// that you changed the file(s) and the date of any change, |
WiredHome | 78:faf49c381591 | 640 | /// and that you do not charge any royalties or licenses for |
WiredHome | 78:faf49c381591 | 641 | /// its use. |
WiredHome | 77:9206c13aa527 | 642 | /// |
WiredHome | 77:9206c13aa527 | 643 | /// @param[in] display is a pointer to a set of 3 points, which |
WiredHome | 77:9206c13aa527 | 644 | /// are in display units of measure. These are the targets |
WiredHome | 77:9206c13aa527 | 645 | /// the calibration was aiming for. |
WiredHome | 77:9206c13aa527 | 646 | /// @param[in] screen is a pointer to a set of 3 points, which |
WiredHome | 77:9206c13aa527 | 647 | /// are in touchscreen units of measure. These are the |
WiredHome | 77:9206c13aa527 | 648 | /// registered touches. |
WiredHome | 77:9206c13aa527 | 649 | /// @param[out] matrix is an optional parameter to hold the calibration matrix |
WiredHome | 77:9206c13aa527 | 650 | /// as a result of the calibration. This can be saved in |
WiredHome | 77:9206c13aa527 | 651 | /// non-volatile memory to recover the calibration after a power fail. |
WiredHome | 77:9206c13aa527 | 652 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 77:9206c13aa527 | 653 | /// |
WiredHome | 81:01da2e34283d | 654 | RetCode_t TouchPanelComputeCalibration(point_t display[3], point_t screen[3], tpMatrix_t * matrix); |
WiredHome | 81:01da2e34283d | 655 | |
WiredHome | 81:01da2e34283d | 656 | |
WiredHome | 81:01da2e34283d | 657 | /// Perform the touch panel calibration process. |
WiredHome | 81:01da2e34283d | 658 | /// |
WiredHome | 81:01da2e34283d | 659 | /// This method provides the easy "shortcut" to calibrating the touch panel. |
WiredHome | 81:01da2e34283d | 660 | /// The process will automatically generate the calibration points, present |
WiredHome | 81:01da2e34283d | 661 | /// the targets on-screen, detect the touches, compute the calibration |
WiredHome | 81:01da2e34283d | 662 | /// matrix, and optionally provide the calibration matrix to the calling code |
WiredHome | 81:01da2e34283d | 663 | /// for persistence in non-volatile memory. |
WiredHome | 81:01da2e34283d | 664 | /// |
WiredHome | 81:01da2e34283d | 665 | /// @param[out] matrix is an optional parameter to hold the calibration matrix |
WiredHome | 81:01da2e34283d | 666 | /// as a result of the calibration. This can be saved in |
WiredHome | 81:01da2e34283d | 667 | /// non-volatile memory to recover the calibration after a power fail. |
WiredHome | 81:01da2e34283d | 668 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 81:01da2e34283d | 669 | /// |
WiredHome | 85:022bba13c5c4 | 670 | RetCode_t TouchPanelCalibrate(tpMatrix_t * matrix = NULL); |
WiredHome | 81:01da2e34283d | 671 | |
WiredHome | 81:01da2e34283d | 672 | /// Perform the touch panel calibration process. |
WiredHome | 81:01da2e34283d | 673 | /// |
WiredHome | 81:01da2e34283d | 674 | /// This method provides the easy "shortcut" to calibrating the touch panel. |
WiredHome | 81:01da2e34283d | 675 | /// The process will automatically generate the calibration points, present |
WiredHome | 81:01da2e34283d | 676 | /// the targets on-screen, detect the touches, compute the calibration |
WiredHome | 81:01da2e34283d | 677 | /// matrix, and optionally provide the calibration matrix to the calling code |
WiredHome | 81:01da2e34283d | 678 | /// for persistence in non-volatile memory. |
WiredHome | 81:01da2e34283d | 679 | /// |
WiredHome | 81:01da2e34283d | 680 | /// @param[in] msg is a text message to present on the screen during the |
WiredHome | 81:01da2e34283d | 681 | /// calibration process. |
WiredHome | 81:01da2e34283d | 682 | /// @param[out] matrix is an optional parameter to hold the calibration matrix |
WiredHome | 81:01da2e34283d | 683 | /// as a result of the calibration. This can be saved in |
WiredHome | 81:01da2e34283d | 684 | /// non-volatile memory to recover the calibration after a power fail. |
WiredHome | 88:bfddef6ec836 | 685 | /// @param[in] maxwait_s is the maximum number of seconds to wait for a touch |
WiredHome | 88:bfddef6ec836 | 686 | /// calibration. If no touch panel installed, it then reports |
WiredHome | 88:bfddef6ec836 | 687 | /// touch_cal_timeout. |
WiredHome | 81:01da2e34283d | 688 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 81:01da2e34283d | 689 | /// |
WiredHome | 88:bfddef6ec836 | 690 | RetCode_t TouchPanelCalibrate(const char * msg, tpMatrix_t * matrix = NULL, int maxwait_s = 15); |
WiredHome | 77:9206c13aa527 | 691 | |
WiredHome | 77:9206c13aa527 | 692 | /// Set the calibration matrix for the touch panel. |
WiredHome | 77:9206c13aa527 | 693 | /// |
WiredHome | 77:9206c13aa527 | 694 | /// This method is used to set the calibration matrix for the touch panel. After |
WiredHome | 81:01da2e34283d | 695 | /// performing the calibration (@see TouchPanelComputeCalibration), the matrix can be stored. |
WiredHome | 77:9206c13aa527 | 696 | /// On a subsequence power cycle, the matrix may be restored from non-volatile and |
WiredHome | 77:9206c13aa527 | 697 | /// passed in to this method. It will then be held to perform the corrections when |
WiredHome | 77:9206c13aa527 | 698 | /// reading the touch panel point. |
WiredHome | 77:9206c13aa527 | 699 | /// |
WiredHome | 78:faf49c381591 | 700 | /// @code |
WiredHome | 78:faf49c381591 | 701 | /// FILE * fh = fopen("/local/tpmatrix.cfg", "r"); |
WiredHome | 78:faf49c381591 | 702 | /// if (fh) { |
WiredHome | 78:faf49c381591 | 703 | /// tpMatrix_t matrix; |
WiredHome | 78:faf49c381591 | 704 | /// if (fread(fh, &matrix, sizeof(tpMatrix_t))) { |
WiredHome | 78:faf49c381591 | 705 | /// lcd.TouchPanelSetMatrix(&matrix); |
WiredHome | 78:faf49c381591 | 706 | /// } |
WiredHome | 78:faf49c381591 | 707 | /// fclose(fh); |
WiredHome | 78:faf49c381591 | 708 | /// } |
WiredHome | 78:faf49c381591 | 709 | /// @endcode |
WiredHome | 78:faf49c381591 | 710 | /// |
WiredHome | 77:9206c13aa527 | 711 | /// @param[in] matrix is a pointer to the touch panel calibration matrix. |
WiredHome | 77:9206c13aa527 | 712 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 77:9206c13aa527 | 713 | /// |
WiredHome | 77:9206c13aa527 | 714 | RetCode_t TouchPanelSetMatrix(tpMatrix_t * matrix); |
WiredHome | 78:faf49c381591 | 715 | |
WiredHome | 75:ca78388cfd77 | 716 | #if 0 |
hexley | 54:e117ad10fba6 | 717 | /// Append interrupt handler for specific RA8875 interrupt source |
hexley | 54:e117ad10fba6 | 718 | /// |
hexley | 54:e117ad10fba6 | 719 | /// @param[in] bISRType Interrupt Source, should be: |
hexley | 54:e117ad10fba6 | 720 | /// - RA8875_INT_KEYSCAN: KEYCAN interrupt |
hexley | 54:e117ad10fba6 | 721 | /// - RA8875_INT_DMA: DMA interrupt |
hexley | 54:e117ad10fba6 | 722 | /// - RA8875_INT_TP: Touch panel interrupt |
hexley | 54:e117ad10fba6 | 723 | /// - RA8875_INT_BTE: BTE process complete interrupt |
hexley | 54:e117ad10fba6 | 724 | /// - RA8875_INT_BTEMCU_FONTWR: Multi-purpose interrupt (see spec sheet) |
WiredHome | 56:7a85d226ad0d | 725 | /// @param[in] fptr is a callback function to handle the interrupt event. |
WiredHome | 56:7a85d226ad0d | 726 | /// @returns none |
hexley | 54:e117ad10fba6 | 727 | /// |
hexley | 54:e117ad10fba6 | 728 | void AppendISR(uint8_t bISRType, void(*fptr)(void)); |
hexley | 54:e117ad10fba6 | 729 | |
hexley | 54:e117ad10fba6 | 730 | /// Unappend interrupt handler for specific RA8875 interrupt source |
hexley | 54:e117ad10fba6 | 731 | /// |
hexley | 54:e117ad10fba6 | 732 | /// @param[in] bISRType Interrupt Source, should be: |
hexley | 54:e117ad10fba6 | 733 | /// - RA8875_INT_KEYSCAN: KEYCAN interrupt |
hexley | 54:e117ad10fba6 | 734 | /// - RA8875_INT_DMA: DMA interrupt |
hexley | 54:e117ad10fba6 | 735 | /// - RA8875_INT_TP: Touch panel interrupt |
hexley | 54:e117ad10fba6 | 736 | /// - RA8875_INT_BTE: BTE process complete interrupt |
hexley | 54:e117ad10fba6 | 737 | /// - RA8875_INT_BTEMCU_FONTWR: Multi-purpose interrupt (see spec sheet) |
hexley | 54:e117ad10fba6 | 738 | /// @return none |
hexley | 54:e117ad10fba6 | 739 | /// |
hexley | 54:e117ad10fba6 | 740 | void UnAppendISR(uint8_t bISRType); |
WiredHome | 75:ca78388cfd77 | 741 | #endif |
WiredHome | 77:9206c13aa527 | 742 | |
WiredHome | 71:dcac8efd842d | 743 | /// Initialize the keypad interface on the RA8875 controller. |
WiredHome | 71:dcac8efd842d | 744 | /// |
WiredHome | 71:dcac8efd842d | 745 | /// Enables the keypad subsystem. It will scan the 4 x 5 matrix |
WiredHome | 71:dcac8efd842d | 746 | /// and make available key presses. |
WiredHome | 71:dcac8efd842d | 747 | /// |
WiredHome | 71:dcac8efd842d | 748 | /// @note See section 5-13 of RAIO RA8875 data sheet for more details. |
WiredHome | 71:dcac8efd842d | 749 | /// @caution When using the display from buy-display.com, be sure that |
WiredHome | 71:dcac8efd842d | 750 | /// the option for the keypad is configured on the hardware. |
WiredHome | 71:dcac8efd842d | 751 | /// |
WiredHome | 71:dcac8efd842d | 752 | /// All parameters are optional. |
WiredHome | 76:c981284eb513 | 753 | /// @param[in] scanEnable when true, enables the key scan function (default: true). |
WiredHome | 76:c981284eb513 | 754 | /// @param[in] longDetect when true, additionally enables the long key held detection (default: false). |
WiredHome | 71:dcac8efd842d | 755 | /// @param[in] sampleTime setting (range: 0 - 3, default: 0). |
WiredHome | 71:dcac8efd842d | 756 | /// @param[in] scanFrequency setting (range: 0 - 7, default: 0). |
WiredHome | 71:dcac8efd842d | 757 | /// @param[in] longTimeAdjustment (range: 0 - 3, default: 0). |
WiredHome | 76:c981284eb513 | 758 | /// @param[in] interruptEnable when true, enables interrupts from keypress (default: false). |
WiredHome | 76:c981284eb513 | 759 | /// @param[in] wakeupEnable when true, activates the wakeup function (default: false). |
WiredHome | 71:dcac8efd842d | 760 | /// |
WiredHome | 71:dcac8efd842d | 761 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 71:dcac8efd842d | 762 | /// |
WiredHome | 71:dcac8efd842d | 763 | RetCode_t KeypadInit(bool scanEnable = true, bool longDetect = false, |
WiredHome | 71:dcac8efd842d | 764 | uint8_t sampleTime = 0, uint8_t scanFrequency = 0, |
WiredHome | 71:dcac8efd842d | 765 | uint8_t longTimeAdjustment = 0, |
WiredHome | 71:dcac8efd842d | 766 | bool interruptEnable = false, bool wakeupEnable = false); |
WiredHome | 71:dcac8efd842d | 767 | |
WiredHome | 75:ca78388cfd77 | 768 | /// Create Key Code definitions for the key matrix. |
WiredHome | 75:ca78388cfd77 | 769 | /// |
WiredHome | 75:ca78388cfd77 | 770 | /// This API provides a table of 22 key-code assignments for the matrix of keys. |
WiredHome | 75:ca78388cfd77 | 771 | /// This can be used to translate the keys 1 - 20 into some other value, as |
WiredHome | 75:ca78388cfd77 | 772 | /// well as to communicate the "no key" (zero) and "error state" (21). |
WiredHome | 75:ca78388cfd77 | 773 | /// |
WiredHome | 75:ca78388cfd77 | 774 | /// In this way, a keypad could easily emulate a piece of a keyboard, transforming |
WiredHome | 75:ca78388cfd77 | 775 | /// 0 - 20 into the values 0, '0', '1', '2', '3', '4', '5', '6', '7', '8', |
WiredHome | 75:ca78388cfd77 | 776 | /// '9', '+', '-', '*' , '/', '=', '<bs>', '<cr>', and so on... |
WiredHome | 75:ca78388cfd77 | 777 | /// |
WiredHome | 75:ca78388cfd77 | 778 | /// @code |
WiredHome | 75:ca78388cfd77 | 779 | /// // Return Value by Row, Column Example reassignment |
WiredHome | 75:ca78388cfd77 | 780 | /// // Column 0 1 2 3 4 |
WiredHome | 75:ca78388cfd77 | 781 | /// // +-------------------------+ +-------------------------+ |
WiredHome | 76:c981284eb513 | 782 | /// // Row 0 | 1 2 3 4 5 | | '7' '8' '9' ',' '<-' | |
WiredHome | 75:ca78388cfd77 | 783 | /// // 1 | 6 7 8 9 10 | | '4' '5' '6' '/' '-' | |
WiredHome | 75:ca78388cfd77 | 784 | /// // 2 | 11 12 13 14 15 | | '1' '2' '3' '*' '+' | |
WiredHome | 76:c981284eb513 | 785 | /// // 3 | 16 17 18 19 20 | | '0' '.' '(' ')' '\n' | |
WiredHome | 75:ca78388cfd77 | 786 | /// // +-------------------------+ +-------------------------+ |
WiredHome | 75:ca78388cfd77 | 787 | /// // Return value 0 = No Key pressed |
WiredHome | 75:ca78388cfd77 | 788 | /// // Return value 21 = Error |
WiredHome | 77:9206c13aa527 | 789 | /// const uint8_t CodeList[22] = |
WiredHome | 77:9206c13aa527 | 790 | /// {0, '7', '8', '9', ',', '\h', |
WiredHome | 77:9206c13aa527 | 791 | /// '4', '5', '6', '/', '-', |
WiredHome | 77:9206c13aa527 | 792 | /// '1', '2', '3', '*', '+', |
WiredHome | 77:9206c13aa527 | 793 | /// '0', '.', '(', ')', '\n', |
WiredHome | 77:9206c13aa527 | 794 | /// '\x1b'}; |
WiredHome | 77:9206c13aa527 | 795 | /// lcd.SetKeyMap(CodeList); |
WiredHome | 75:ca78388cfd77 | 796 | /// @endcode |
WiredHome | 75:ca78388cfd77 | 797 | /// |
WiredHome | 75:ca78388cfd77 | 798 | /// @param[in] CodeList is a pointer to an always available byte-array |
WiredHome | 75:ca78388cfd77 | 799 | /// where the first 22 bytes are used as the transformation |
WiredHome | 75:ca78388cfd77 | 800 | /// from raw code to your reassigned value. |
WiredHome | 75:ca78388cfd77 | 801 | /// If CodeList is NULL, the original raw value key map is |
WiredHome | 75:ca78388cfd77 | 802 | /// restored. |
WiredHome | 75:ca78388cfd77 | 803 | /// @returns noerror. |
WiredHome | 75:ca78388cfd77 | 804 | /// |
WiredHome | 75:ca78388cfd77 | 805 | RetCode_t SetKeyMap(const uint8_t * CodeList = NULL); |
WiredHome | 75:ca78388cfd77 | 806 | |
WiredHome | 71:dcac8efd842d | 807 | /// Determine if a key has been hit |
WiredHome | 71:dcac8efd842d | 808 | /// |
WiredHome | 71:dcac8efd842d | 809 | /// @returns true if a key has been hit |
WiredHome | 71:dcac8efd842d | 810 | /// |
WiredHome | 75:ca78388cfd77 | 811 | bool readable(); |
WiredHome | 71:dcac8efd842d | 812 | |
WiredHome | 71:dcac8efd842d | 813 | /// Blocking read of the keypad. |
WiredHome | 71:dcac8efd842d | 814 | /// |
WiredHome | 71:dcac8efd842d | 815 | /// @caution: This is a blocking read, so it is important to first call _kbhit() |
WiredHome | 71:dcac8efd842d | 816 | /// to avoid hanging your processes. |
WiredHome | 71:dcac8efd842d | 817 | /// |
WiredHome | 71:dcac8efd842d | 818 | /// A keypad connected to the RA8875 is connected in a matrix of 4 rows and 5 columns. |
WiredHome | 75:ca78388cfd77 | 819 | /// When pressed, this method will return a code in the range of 1 through 20, reserving |
WiredHome | 75:ca78388cfd77 | 820 | /// the value 0 to indicate that no key is pressed. |
WiredHome | 71:dcac8efd842d | 821 | /// |
WiredHome | 71:dcac8efd842d | 822 | /// Additionally, if configured to detect a "long press", bit 7 will be set to indicate |
WiredHome | 71:dcac8efd842d | 823 | /// this. In this situation, first a "normal press" would be detected and signaled and |
WiredHome | 71:dcac8efd842d | 824 | /// soon after that a "long press" of the same key would be detected and communicated. |
WiredHome | 71:dcac8efd842d | 825 | /// |
WiredHome | 75:ca78388cfd77 | 826 | /// @return 8-bit where bit 7 indicates a long press. The remaining bits indicate the |
WiredHome | 75:ca78388cfd77 | 827 | /// keypress using 0 = no key pressed, 1 - 20 = the key pressed. |
WiredHome | 71:dcac8efd842d | 828 | /// |
WiredHome | 75:ca78388cfd77 | 829 | uint8_t getc(); |
WiredHome | 75:ca78388cfd77 | 830 | |
WiredHome | 82:f7d300f26540 | 831 | |
WiredHome | 82:f7d300f26540 | 832 | /// Determine if a point is within a rectangle. |
WiredHome | 82:f7d300f26540 | 833 | /// |
WiredHome | 82:f7d300f26540 | 834 | /// @param[in] rect is a rectangular region to use. |
WiredHome | 82:f7d300f26540 | 835 | /// @param[in] p is a point to analyze to see if it is within the rect. |
WiredHome | 82:f7d300f26540 | 836 | /// @returns true if p is within rect. |
WiredHome | 82:f7d300f26540 | 837 | /// |
WiredHome | 82:f7d300f26540 | 838 | bool Intersect(rect_t rect, point_t p); |
WiredHome | 82:f7d300f26540 | 839 | |
WiredHome | 82:f7d300f26540 | 840 | |
WiredHome | 38:38d503b4fad6 | 841 | /// Write a command to the display with a word of data. |
WiredHome | 38:38d503b4fad6 | 842 | /// |
WiredHome | 38:38d503b4fad6 | 843 | /// This is a high level command, and may invoke several primitives. |
WiredHome | 38:38d503b4fad6 | 844 | /// |
WiredHome | 72:ecffe56af969 | 845 | /// @param[in] command is the command to write. |
WiredHome | 72:ecffe56af969 | 846 | /// @param[in] data is data to be written to the command register. |
WiredHome | 38:38d503b4fad6 | 847 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 38:38d503b4fad6 | 848 | /// |
WiredHome | 38:38d503b4fad6 | 849 | RetCode_t WriteCommandW(uint8_t command, uint16_t data); |
WiredHome | 38:38d503b4fad6 | 850 | |
WiredHome | 19:3f82c1161fd2 | 851 | /// Write a command to the display |
WiredHome | 19:3f82c1161fd2 | 852 | /// |
WiredHome | 19:3f82c1161fd2 | 853 | /// This is a high level command, and may invoke several primitives. |
WiredHome | 19:3f82c1161fd2 | 854 | /// |
WiredHome | 72:ecffe56af969 | 855 | /// @param[in] command is the command to write. |
WiredHome | 72:ecffe56af969 | 856 | /// @param[in] data is optional data to be written to the command register |
WiredHome | 19:3f82c1161fd2 | 857 | /// and only occurs if the data is in the range [0 - 0xFF]. |
WiredHome | 19:3f82c1161fd2 | 858 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 859 | /// |
WiredHome | 32:0e4f2ae512e2 | 860 | virtual RetCode_t WriteCommand(unsigned char command, unsigned int data = 0xFFFF); |
WiredHome | 19:3f82c1161fd2 | 861 | |
WiredHome | 38:38d503b4fad6 | 862 | /// Write a data word to the display |
WiredHome | 38:38d503b4fad6 | 863 | /// |
WiredHome | 38:38d503b4fad6 | 864 | /// This is a high level command, and may invoke several primitives. |
WiredHome | 38:38d503b4fad6 | 865 | /// |
WiredHome | 72:ecffe56af969 | 866 | /// @param[in] data is the data to write. |
WiredHome | 38:38d503b4fad6 | 867 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 38:38d503b4fad6 | 868 | /// |
WiredHome | 38:38d503b4fad6 | 869 | RetCode_t WriteDataW(uint16_t data); |
WiredHome | 38:38d503b4fad6 | 870 | |
WiredHome | 19:3f82c1161fd2 | 871 | /// Write a data byte to the display |
WiredHome | 19:3f82c1161fd2 | 872 | /// |
WiredHome | 19:3f82c1161fd2 | 873 | /// This is a high level command, and may invoke several primitives. |
WiredHome | 19:3f82c1161fd2 | 874 | /// |
WiredHome | 72:ecffe56af969 | 875 | /// @param[in] data is the data to write. |
WiredHome | 19:3f82c1161fd2 | 876 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 877 | /// |
WiredHome | 32:0e4f2ae512e2 | 878 | virtual RetCode_t WriteData(unsigned char data); |
WiredHome | 19:3f82c1161fd2 | 879 | |
WiredHome | 19:3f82c1161fd2 | 880 | /// Read a command register |
WiredHome | 19:3f82c1161fd2 | 881 | /// |
WiredHome | 72:ecffe56af969 | 882 | /// @param[in] command is the command register to read. |
WiredHome | 19:3f82c1161fd2 | 883 | /// @returns the value read from the register. |
WiredHome | 19:3f82c1161fd2 | 884 | /// |
WiredHome | 19:3f82c1161fd2 | 885 | unsigned char ReadCommand(unsigned char command); |
WiredHome | 19:3f82c1161fd2 | 886 | |
WiredHome | 41:2956a0a221e5 | 887 | /// Read a data byte from the display |
WiredHome | 19:3f82c1161fd2 | 888 | /// |
WiredHome | 19:3f82c1161fd2 | 889 | /// This is a high level command, and may invoke several primitives. |
WiredHome | 19:3f82c1161fd2 | 890 | /// |
WiredHome | 19:3f82c1161fd2 | 891 | /// @returns data that was read. |
WiredHome | 19:3f82c1161fd2 | 892 | /// |
WiredHome | 19:3f82c1161fd2 | 893 | unsigned char ReadData(void); |
WiredHome | 19:3f82c1161fd2 | 894 | |
WiredHome | 41:2956a0a221e5 | 895 | /// Read a word from the display |
WiredHome | 41:2956a0a221e5 | 896 | /// |
WiredHome | 41:2956a0a221e5 | 897 | /// This is a high level command, and may invoke several primitives. |
WiredHome | 41:2956a0a221e5 | 898 | /// |
WiredHome | 41:2956a0a221e5 | 899 | /// @returns data that was read. |
WiredHome | 41:2956a0a221e5 | 900 | /// |
WiredHome | 41:2956a0a221e5 | 901 | uint16_t ReadDataW(void); |
WiredHome | 41:2956a0a221e5 | 902 | |
WiredHome | 19:3f82c1161fd2 | 903 | /// Read the display status |
WiredHome | 19:3f82c1161fd2 | 904 | /// |
WiredHome | 19:3f82c1161fd2 | 905 | /// This is a high level command, and may invoke several primitives. |
WiredHome | 19:3f82c1161fd2 | 906 | /// |
WiredHome | 19:3f82c1161fd2 | 907 | /// @returns data that was read. |
WiredHome | 19:3f82c1161fd2 | 908 | /// |
WiredHome | 19:3f82c1161fd2 | 909 | unsigned char ReadStatus(void); |
WiredHome | 19:3f82c1161fd2 | 910 | |
WiredHome | 19:3f82c1161fd2 | 911 | /// get the width in pixels of the currently active font |
WiredHome | 19:3f82c1161fd2 | 912 | /// |
WiredHome | 19:3f82c1161fd2 | 913 | /// @returns font width in pixels. |
WiredHome | 19:3f82c1161fd2 | 914 | /// |
WiredHome | 37:f19b7e7449dc | 915 | dim_t fontwidth(void); |
WiredHome | 19:3f82c1161fd2 | 916 | |
WiredHome | 19:3f82c1161fd2 | 917 | /// get the height in pixels of the currently active font |
WiredHome | 19:3f82c1161fd2 | 918 | /// |
WiredHome | 19:3f82c1161fd2 | 919 | /// @returns font height in pixels. |
WiredHome | 19:3f82c1161fd2 | 920 | /// |
WiredHome | 37:f19b7e7449dc | 921 | dim_t fontheight(void); |
WiredHome | 19:3f82c1161fd2 | 922 | |
WiredHome | 19:3f82c1161fd2 | 923 | /// get the number of colums based on the currently active font |
WiredHome | 19:3f82c1161fd2 | 924 | /// |
WiredHome | 19:3f82c1161fd2 | 925 | /// @returns number of columns. |
WiredHome | 19:3f82c1161fd2 | 926 | /// |
WiredHome | 19:3f82c1161fd2 | 927 | virtual int columns(void); |
WiredHome | 19:3f82c1161fd2 | 928 | |
WiredHome | 19:3f82c1161fd2 | 929 | /// get the number of rows based on the currently active font |
WiredHome | 19:3f82c1161fd2 | 930 | /// |
WiredHome | 19:3f82c1161fd2 | 931 | /// @returns number of rows. |
WiredHome | 19:3f82c1161fd2 | 932 | /// |
WiredHome | 19:3f82c1161fd2 | 933 | virtual int rows(void); |
WiredHome | 19:3f82c1161fd2 | 934 | |
WiredHome | 19:3f82c1161fd2 | 935 | /// get the screen width in pixels |
WiredHome | 19:3f82c1161fd2 | 936 | /// |
WiredHome | 19:3f82c1161fd2 | 937 | /// @returns screen width in pixels. |
WiredHome | 19:3f82c1161fd2 | 938 | /// |
WiredHome | 38:38d503b4fad6 | 939 | virtual dim_t width(void); |
WiredHome | 19:3f82c1161fd2 | 940 | |
WiredHome | 19:3f82c1161fd2 | 941 | /// get the screen height in pixels |
WiredHome | 19:3f82c1161fd2 | 942 | /// |
WiredHome | 19:3f82c1161fd2 | 943 | /// @returns screen height in pixels. |
WiredHome | 19:3f82c1161fd2 | 944 | /// |
WiredHome | 38:38d503b4fad6 | 945 | virtual dim_t height(void); |
WiredHome | 19:3f82c1161fd2 | 946 | |
WiredHome | 43:3becae133285 | 947 | /// get the color depth in bits per pixel. |
WiredHome | 43:3becae133285 | 948 | /// |
WiredHome | 43:3becae133285 | 949 | /// @returns 8 or 16 only. |
WiredHome | 43:3becae133285 | 950 | /// |
WiredHome | 43:3becae133285 | 951 | virtual dim_t color_bpp(void); |
WiredHome | 43:3becae133285 | 952 | |
WiredHome | 19:3f82c1161fd2 | 953 | /// Set cursor position based on the current font size. |
WiredHome | 19:3f82c1161fd2 | 954 | /// |
WiredHome | 72:ecffe56af969 | 955 | /// @param[in] column is the horizontal position in character positions |
WiredHome | 72:ecffe56af969 | 956 | /// @param[in] row is the vertical position in character positions |
WiredHome | 19:3f82c1161fd2 | 957 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 958 | /// |
WiredHome | 37:f19b7e7449dc | 959 | virtual RetCode_t locate(textloc_t column, textloc_t row); |
WiredHome | 19:3f82c1161fd2 | 960 | |
WiredHome | 19:3f82c1161fd2 | 961 | /// Prepare the controller to write text to the screen by positioning |
WiredHome | 19:3f82c1161fd2 | 962 | /// the cursor. |
WiredHome | 19:3f82c1161fd2 | 963 | /// |
WiredHome | 56:7a85d226ad0d | 964 | /// @code |
WiredHome | 56:7a85d226ad0d | 965 | /// lcd.SetTextCursor(100, 25); |
WiredHome | 56:7a85d226ad0d | 966 | /// lcd.puts("Hello"); |
WiredHome | 56:7a85d226ad0d | 967 | /// @endcode |
WiredHome | 56:7a85d226ad0d | 968 | /// |
WiredHome | 72:ecffe56af969 | 969 | /// @param[in] x is the horizontal position in pixels (from the left edge) |
WiredHome | 72:ecffe56af969 | 970 | /// @param[in] y is the vertical position in pixels (from the top edge) |
WiredHome | 19:3f82c1161fd2 | 971 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 972 | /// |
WiredHome | 37:f19b7e7449dc | 973 | RetCode_t SetTextCursor(loc_t x, loc_t y); |
WiredHome | 29:422616aa04bd | 974 | |
WiredHome | 37:f19b7e7449dc | 975 | /// Get the current cursor position in pixels. |
WiredHome | 37:f19b7e7449dc | 976 | /// |
WiredHome | 56:7a85d226ad0d | 977 | /// @code |
WiredHome | 56:7a85d226ad0d | 978 | /// point_t point = GetTextCursor(); |
WiredHome | 56:7a85d226ad0d | 979 | /// if (point.x > 100 && point.y > 150) |
WiredHome | 56:7a85d226ad0d | 980 | /// //... |
WiredHome | 56:7a85d226ad0d | 981 | /// @endcode |
WiredHome | 56:7a85d226ad0d | 982 | /// |
WiredHome | 37:f19b7e7449dc | 983 | /// @returns cursor position. |
WiredHome | 37:f19b7e7449dc | 984 | /// |
WiredHome | 37:f19b7e7449dc | 985 | point_t GetTextCursor(void); |
WiredHome | 37:f19b7e7449dc | 986 | |
WiredHome | 29:422616aa04bd | 987 | /// Get the current cursor horizontal position in pixels. |
WiredHome | 29:422616aa04bd | 988 | /// |
WiredHome | 29:422616aa04bd | 989 | /// @returns cursor position horizontal offset. |
WiredHome | 29:422616aa04bd | 990 | /// |
WiredHome | 37:f19b7e7449dc | 991 | loc_t GetTextCursor_X(void); |
WiredHome | 29:422616aa04bd | 992 | |
WiredHome | 29:422616aa04bd | 993 | /// Get the current cursor vertical position in pixels. |
WiredHome | 29:422616aa04bd | 994 | /// |
WiredHome | 29:422616aa04bd | 995 | /// @returns cursor position vertical offset. |
WiredHome | 29:422616aa04bd | 996 | /// |
WiredHome | 37:f19b7e7449dc | 997 | loc_t GetTextCursor_Y(void); |
WiredHome | 29:422616aa04bd | 998 | |
WiredHome | 23:a50ded45dbaf | 999 | /// Configure additional Cursor Control settings. |
WiredHome | 23:a50ded45dbaf | 1000 | /// |
WiredHome | 23:a50ded45dbaf | 1001 | /// This API lets you modify other cursor control settings; |
WiredHome | 23:a50ded45dbaf | 1002 | /// Cursor visible/hidden, Cursor blink/normal, |
WiredHome | 23:a50ded45dbaf | 1003 | /// Cursor I-Beam/underscore/box. |
WiredHome | 23:a50ded45dbaf | 1004 | /// |
WiredHome | 72:ecffe56af969 | 1005 | /// @param[in] cursor can be set to NOCURSOR (default), IBEAM, |
WiredHome | 24:8ca861acf12d | 1006 | /// UNDER, or BLOCK. |
WiredHome | 72:ecffe56af969 | 1007 | /// @param[in] blink can be set to true or false (default false) |
WiredHome | 23:a50ded45dbaf | 1008 | /// @returns success/failure code. @see RetCode_t |
WiredHome | 23:a50ded45dbaf | 1009 | /// |
WiredHome | 24:8ca861acf12d | 1010 | RetCode_t SetTextCursorControl(cursor_t cursor = NOCURSOR, bool blink = false); |
WiredHome | 23:a50ded45dbaf | 1011 | |
WiredHome | 19:3f82c1161fd2 | 1012 | /// Select the ISO 8859-X font to use next. |
WiredHome | 19:3f82c1161fd2 | 1013 | /// |
WiredHome | 19:3f82c1161fd2 | 1014 | /// Supported fonts: ISO 8859-1, -2, -3, -4 |
WiredHome | 19:3f82c1161fd2 | 1015 | /// |
WiredHome | 72:ecffe56af969 | 1016 | /// @param[in] font selects the font for the subsequent text rendering. |
WiredHome | 19:3f82c1161fd2 | 1017 | /// |
WiredHome | 19:3f82c1161fd2 | 1018 | /// @note if either hScale or vScale is outside of its permitted range, |
WiredHome | 19:3f82c1161fd2 | 1019 | /// the command is not executed. |
WiredHome | 19:3f82c1161fd2 | 1020 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1021 | /// |
WiredHome | 19:3f82c1161fd2 | 1022 | RetCode_t SetTextFont(font_t font = ISO8859_1); |
WiredHome | 19:3f82c1161fd2 | 1023 | |
WiredHome | 84:e102021864b5 | 1024 | /// Sets the display orientation. |
WiredHome | 84:e102021864b5 | 1025 | /// |
WiredHome | 84:e102021864b5 | 1026 | /// @note This command does not let you "merge" text onto an existing |
WiredHome | 84:e102021864b5 | 1027 | /// image, since it reuses the memory for the new orientation. |
WiredHome | 84:e102021864b5 | 1028 | /// Therefore, it is recommended that you issue a cls() prior |
WiredHome | 84:e102021864b5 | 1029 | /// to sending text to the screen, or you end with a blended |
WiredHome | 84:e102021864b5 | 1030 | /// image that is probably not as intended. |
WiredHome | 84:e102021864b5 | 1031 | /// |
WiredHome | 84:e102021864b5 | 1032 | /// @code |
WiredHome | 84:e102021864b5 | 1033 | /// lcd.cls(); |
WiredHome | 84:e102021864b5 | 1034 | /// lcd.SetOrientation(RA8875::normal); |
WiredHome | 84:e102021864b5 | 1035 | /// lcd.puts(30,30, "Normal Landscape"); |
WiredHome | 84:e102021864b5 | 1036 | /// wait_ms(2500); |
WiredHome | 84:e102021864b5 | 1037 | /// |
WiredHome | 84:e102021864b5 | 1038 | /// lcd.cls(); |
WiredHome | 84:e102021864b5 | 1039 | /// lcd.SetOrientation(RA8875::rotate_90); |
WiredHome | 84:e102021864b5 | 1040 | /// lcd.puts(30,30, "Rotated 90 Text\r\n"); |
WiredHome | 84:e102021864b5 | 1041 | /// wait_ms(2500); |
WiredHome | 84:e102021864b5 | 1042 | /// |
WiredHome | 84:e102021864b5 | 1043 | /// lcd.cls(); |
WiredHome | 84:e102021864b5 | 1044 | /// lcd.SetOrientation(RA8875::rotate_180); |
WiredHome | 84:e102021864b5 | 1045 | /// lcd.puts(30,30, "Rotated 180 Text\r\n"); |
WiredHome | 84:e102021864b5 | 1046 | /// wait_ms(2500); |
WiredHome | 84:e102021864b5 | 1047 | /// |
WiredHome | 84:e102021864b5 | 1048 | /// lcd.cls(); |
WiredHome | 84:e102021864b5 | 1049 | /// lcd.SetOrientation(RA8875::rotate_270); |
WiredHome | 84:e102021864b5 | 1050 | /// lcd.puts(30,30, "Rotated 270 Text\r\n"); |
WiredHome | 84:e102021864b5 | 1051 | /// wait_ms(2500); |
WiredHome | 84:e102021864b5 | 1052 | /// @endcode |
WiredHome | 84:e102021864b5 | 1053 | /// |
WiredHome | 84:e102021864b5 | 1054 | /// @param[in] angle defaults to normal, but can be rotated |
WiredHome | 84:e102021864b5 | 1055 | /// - normal | rotate_0 |
WiredHome | 84:e102021864b5 | 1056 | /// - rotate_90 (clockwise) |
WiredHome | 84:e102021864b5 | 1057 | /// - rotate_180 |
WiredHome | 84:e102021864b5 | 1058 | /// - rotate_270 (clockwise) |
WiredHome | 84:e102021864b5 | 1059 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 84:e102021864b5 | 1060 | /// |
WiredHome | 84:e102021864b5 | 1061 | RetCode_t SetOrientation(orientation_t angle = normal); |
WiredHome | 84:e102021864b5 | 1062 | |
WiredHome | 19:3f82c1161fd2 | 1063 | /// Control the font behavior. |
WiredHome | 19:3f82c1161fd2 | 1064 | /// |
WiredHome | 19:3f82c1161fd2 | 1065 | /// This command lets you make several modifications to any text that |
WiredHome | 56:7a85d226ad0d | 1066 | /// will be written to the screen. |
WiredHome | 19:3f82c1161fd2 | 1067 | /// |
WiredHome | 19:3f82c1161fd2 | 1068 | /// Options can be combined: |
WiredHome | 19:3f82c1161fd2 | 1069 | /// Default: |
WiredHome | 19:3f82c1161fd2 | 1070 | /// @li Full alignment disabled, |
WiredHome | 19:3f82c1161fd2 | 1071 | /// @li Font with Background color, |
WiredHome | 84:e102021864b5 | 1072 | /// @li Font in normal orientiation, or rotated 90, 180, or 270 clockwise, |
WiredHome | 84:e102021864b5 | 1073 | /// @li Horizontal scale x 1, 2, 3, or 4 |
WiredHome | 84:e102021864b5 | 1074 | /// @li Vertical scale x 1, 2, 3, or 4 |
WiredHome | 84:e102021864b5 | 1075 | /// |
WiredHome | 84:e102021864b5 | 1076 | /// @note alignment is a special mode for the fonts, when mixing half and |
WiredHome | 84:e102021864b5 | 1077 | /// full fonts on one presentation. 'align_full' starts each full |
WiredHome | 84:e102021864b5 | 1078 | /// character on an even alignment. See section 7-4-7 of the RA8875 |
WiredHome | 84:e102021864b5 | 1079 | /// specification. |
WiredHome | 19:3f82c1161fd2 | 1080 | /// |
WiredHome | 72:ecffe56af969 | 1081 | /// @param[in] fillit defaults to FILL, but can be NOFILL |
WiredHome | 72:ecffe56af969 | 1082 | /// @param[in] hScale defaults to 1, but can be 1, 2, 3, or 4, |
WiredHome | 19:3f82c1161fd2 | 1083 | /// and scales the font size by this amount. |
WiredHome | 72:ecffe56af969 | 1084 | /// @param[in] vScale defaults to 1, but can be 1, 2, 3, or 4, |
WiredHome | 19:3f82c1161fd2 | 1085 | /// and scales the font size by this amount. |
WiredHome | 72:ecffe56af969 | 1086 | /// @param[in] alignment defaults to align_none, but can be |
WiredHome | 19:3f82c1161fd2 | 1087 | /// align_full. |
WiredHome | 19:3f82c1161fd2 | 1088 | /// |
WiredHome | 19:3f82c1161fd2 | 1089 | /// @note if either hScale or vScale is outside of its permitted range, |
WiredHome | 19:3f82c1161fd2 | 1090 | /// the command is not executed. |
WiredHome | 19:3f82c1161fd2 | 1091 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1092 | /// |
WiredHome | 19:3f82c1161fd2 | 1093 | RetCode_t SetTextFontControl(fill_t fillit = FILL, |
WiredHome | 19:3f82c1161fd2 | 1094 | HorizontalScale hScale = 1, |
WiredHome | 19:3f82c1161fd2 | 1095 | VerticalScale vScale = 1, |
WiredHome | 19:3f82c1161fd2 | 1096 | alignment_t alignment = align_none); |
WiredHome | 19:3f82c1161fd2 | 1097 | |
WiredHome | 19:3f82c1161fd2 | 1098 | /// Control the font size |
WiredHome | 19:3f82c1161fd2 | 1099 | /// |
WiredHome | 19:3f82c1161fd2 | 1100 | /// This command lets you set the font enlargement for both horizontal |
WiredHome | 19:3f82c1161fd2 | 1101 | /// and vertical, independent of the rotation, background, and |
WiredHome | 19:3f82c1161fd2 | 1102 | /// alignment. @see SetTextFontControl. |
WiredHome | 19:3f82c1161fd2 | 1103 | /// |
WiredHome | 72:ecffe56af969 | 1104 | /// @param[in] hScale defaults to 1, but can be 1, 2, 3, or 4, |
WiredHome | 19:3f82c1161fd2 | 1105 | /// and scales the font size by this amount. |
WiredHome | 72:ecffe56af969 | 1106 | /// @param[in] vScale is an optional parameter that defaults to the hScale value, |
WiredHome | 40:04aa280dfa39 | 1107 | /// but can be 1, 2, 3, or 4, and scales the font size by this amount. |
WiredHome | 40:04aa280dfa39 | 1108 | /// |
WiredHome | 40:04aa280dfa39 | 1109 | /// @code |
WiredHome | 40:04aa280dfa39 | 1110 | /// lcd.SetTextFontSize(2); // Set the font to 2x normal size |
WiredHome | 56:7a85d226ad0d | 1111 | /// lcd.puts("Two times"); |
WiredHome | 40:04aa280dfa39 | 1112 | /// lcd.SetTextFontSize(2,3); // Set the font to 2x Width and 3x Height |
WiredHome | 56:7a85d226ad0d | 1113 | /// lcd.puts("2*2 3*h"); |
WiredHome | 40:04aa280dfa39 | 1114 | /// lcd.SetTextFontSize(); // Restore to normal size in both dimensions |
WiredHome | 56:7a85d226ad0d | 1115 | /// lcd.puts("normal"); |
WiredHome | 40:04aa280dfa39 | 1116 | /// @endcode |
WiredHome | 19:3f82c1161fd2 | 1117 | /// |
WiredHome | 19:3f82c1161fd2 | 1118 | /// @note if either hScale or vScale is outside of its permitted range, |
WiredHome | 19:3f82c1161fd2 | 1119 | /// the command is not executed. |
WiredHome | 19:3f82c1161fd2 | 1120 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1121 | /// |
WiredHome | 40:04aa280dfa39 | 1122 | RetCode_t SetTextFontSize(HorizontalScale hScale = 1, VerticalScale vScale = -1); |
WiredHome | 19:3f82c1161fd2 | 1123 | |
WiredHome | 19:3f82c1161fd2 | 1124 | /// put a character on the screen. |
WiredHome | 19:3f82c1161fd2 | 1125 | /// |
WiredHome | 72:ecffe56af969 | 1126 | /// @param[in] c is the character. |
WiredHome | 19:3f82c1161fd2 | 1127 | /// @returns the character, or EOF if there is an error. |
WiredHome | 19:3f82c1161fd2 | 1128 | /// |
WiredHome | 19:3f82c1161fd2 | 1129 | virtual int _putc(int c); |
WiredHome | 19:3f82c1161fd2 | 1130 | |
WiredHome | 19:3f82c1161fd2 | 1131 | /// Write string of text to the display |
WiredHome | 19:3f82c1161fd2 | 1132 | /// |
WiredHome | 56:7a85d226ad0d | 1133 | /// @code |
WiredHome | 56:7a85d226ad0d | 1134 | /// lcd.puts("Test STring"); |
WiredHome | 56:7a85d226ad0d | 1135 | /// @endcode |
WiredHome | 56:7a85d226ad0d | 1136 | /// |
WiredHome | 72:ecffe56af969 | 1137 | /// @param[in] string is the null terminated string to send to the display. |
WiredHome | 19:3f82c1161fd2 | 1138 | /// |
WiredHome | 19:3f82c1161fd2 | 1139 | void puts(const char * string); |
WiredHome | 19:3f82c1161fd2 | 1140 | |
WiredHome | 19:3f82c1161fd2 | 1141 | /// Write string of text to the display at the specified location. |
WiredHome | 19:3f82c1161fd2 | 1142 | /// |
WiredHome | 56:7a85d226ad0d | 1143 | /// @code |
WiredHome | 56:7a85d226ad0d | 1144 | /// lcd.puts(10,25, "Test STring"); |
WiredHome | 56:7a85d226ad0d | 1145 | /// @endcode |
WiredHome | 56:7a85d226ad0d | 1146 | /// |
WiredHome | 72:ecffe56af969 | 1147 | /// @param[in] x is the horizontal position in pixels (from the left edge) |
WiredHome | 72:ecffe56af969 | 1148 | /// @param[in] y is the vertical position in pixels (from the top edge) |
WiredHome | 72:ecffe56af969 | 1149 | /// @param[in] string is the null terminated string to send to the display. |
WiredHome | 19:3f82c1161fd2 | 1150 | /// |
WiredHome | 37:f19b7e7449dc | 1151 | void puts(loc_t x, loc_t y, const char * string); |
WiredHome | 19:3f82c1161fd2 | 1152 | |
WiredHome | 19:3f82c1161fd2 | 1153 | /// Prepare the controller to write binary data to the screen by positioning |
WiredHome | 19:3f82c1161fd2 | 1154 | /// the memory cursor. |
WiredHome | 19:3f82c1161fd2 | 1155 | /// |
WiredHome | 72:ecffe56af969 | 1156 | /// @param[in] x is the horizontal position in pixels (from the left edge) |
WiredHome | 72:ecffe56af969 | 1157 | /// @param[in] y is the vertical position in pixels (from the top edge) |
WiredHome | 19:3f82c1161fd2 | 1158 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1159 | /// |
WiredHome | 37:f19b7e7449dc | 1160 | virtual RetCode_t SetGraphicsCursor(loc_t x, loc_t y); |
WiredHome | 19:3f82c1161fd2 | 1161 | |
WiredHome | 41:2956a0a221e5 | 1162 | /// Prepare the controller to read binary data from the screen by positioning |
WiredHome | 41:2956a0a221e5 | 1163 | /// the memory read cursor. |
WiredHome | 41:2956a0a221e5 | 1164 | /// |
WiredHome | 72:ecffe56af969 | 1165 | /// @param[in] x is the horizontal position in pixels (from the left edge) |
WiredHome | 72:ecffe56af969 | 1166 | /// @param[in] y is the vertical position in pixels (from the top edge) |
WiredHome | 41:2956a0a221e5 | 1167 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 41:2956a0a221e5 | 1168 | /// |
WiredHome | 41:2956a0a221e5 | 1169 | virtual RetCode_t SetGraphicsCursorRead(loc_t x, loc_t y); |
WiredHome | 41:2956a0a221e5 | 1170 | |
WiredHome | 19:3f82c1161fd2 | 1171 | /// Set the window, which controls where items are written to the screen. |
WiredHome | 19:3f82c1161fd2 | 1172 | /// |
WiredHome | 19:3f82c1161fd2 | 1173 | /// When something hits the window width, it wraps back to the left side |
WiredHome | 19:3f82c1161fd2 | 1174 | /// and down a row. If the initial write is outside the window, it will |
WiredHome | 19:3f82c1161fd2 | 1175 | /// be captured into the window when it crosses a boundary. |
WiredHome | 19:3f82c1161fd2 | 1176 | /// |
WiredHome | 56:7a85d226ad0d | 1177 | /// @code |
WiredHome | 56:7a85d226ad0d | 1178 | /// lcd.window(10,10, 80,80); |
WiredHome | 56:7a85d226ad0d | 1179 | /// lcd.puts("012345678901234567890123456789012345678901234567890"); |
WiredHome | 56:7a85d226ad0d | 1180 | /// @endcode |
WiredHome | 56:7a85d226ad0d | 1181 | /// |
WiredHome | 72:ecffe56af969 | 1182 | /// @param[in] x is the left edge in pixels. |
WiredHome | 72:ecffe56af969 | 1183 | /// @param[in] y is the top edge in pixels. |
WiredHome | 72:ecffe56af969 | 1184 | /// @param[in] width is the window width in pixels. |
WiredHome | 72:ecffe56af969 | 1185 | /// @param[in] height is the window height in pixels. |
WiredHome | 19:3f82c1161fd2 | 1186 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1187 | /// |
WiredHome | 37:f19b7e7449dc | 1188 | virtual RetCode_t window(loc_t x, loc_t y, dim_t width, dim_t height); |
WiredHome | 19:3f82c1161fd2 | 1189 | |
WiredHome | 61:8f3153bf0baa | 1190 | /// Clear either the specified layer, or the active layer. |
WiredHome | 19:3f82c1161fd2 | 1191 | /// |
WiredHome | 61:8f3153bf0baa | 1192 | /// The behavior is to clear the whole screen for the specified |
WiredHome | 61:8f3153bf0baa | 1193 | /// layer. When not specified, the active drawing layer is cleared. |
WiredHome | 61:8f3153bf0baa | 1194 | /// This command can also be used to specifically clear either, |
WiredHome | 61:8f3153bf0baa | 1195 | /// or both layers. @see clsw(). |
WiredHome | 19:3f82c1161fd2 | 1196 | /// |
WiredHome | 56:7a85d226ad0d | 1197 | /// @code |
WiredHome | 56:7a85d226ad0d | 1198 | /// lcd.cls(); |
WiredHome | 56:7a85d226ad0d | 1199 | /// @endcode |
WiredHome | 56:7a85d226ad0d | 1200 | /// |
WiredHome | 72:ecffe56af969 | 1201 | /// @param[in] layers is optional. If not provided, the active layer |
WiredHome | 61:8f3153bf0baa | 1202 | /// is cleared. If bit 0 is set, layer 0 is cleared, if bit |
WiredHome | 61:8f3153bf0baa | 1203 | /// 1 is set, layer 1 is cleared. If both are set, both layers |
WiredHome | 61:8f3153bf0baa | 1204 | /// are cleared. Any other value does not cause an action. |
WiredHome | 61:8f3153bf0baa | 1205 | /// |
WiredHome | 19:3f82c1161fd2 | 1206 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1207 | /// |
WiredHome | 61:8f3153bf0baa | 1208 | virtual RetCode_t cls(uint16_t layers = 0); |
WiredHome | 19:3f82c1161fd2 | 1209 | |
WiredHome | 19:3f82c1161fd2 | 1210 | /// Clear the screen, or clear only the active window. |
WiredHome | 19:3f82c1161fd2 | 1211 | /// |
WiredHome | 19:3f82c1161fd2 | 1212 | /// The default behavior is to clear the whole screen. With the optional |
WiredHome | 19:3f82c1161fd2 | 1213 | /// parameter, the action can be restricted to the active window, which |
WiredHome | 32:0e4f2ae512e2 | 1214 | /// can be set with the @see window method. |
WiredHome | 19:3f82c1161fd2 | 1215 | /// |
WiredHome | 56:7a85d226ad0d | 1216 | /// @code |
WiredHome | 56:7a85d226ad0d | 1217 | /// lcd.window(20,20, 40,10); |
WiredHome | 56:7a85d226ad0d | 1218 | /// lcd.clsw(); |
WiredHome | 56:7a85d226ad0d | 1219 | /// @endcode |
WiredHome | 56:7a85d226ad0d | 1220 | /// |
WiredHome | 72:ecffe56af969 | 1221 | /// @param[in] region is an optional parameter that defaults to FULLWINDOW |
WiredHome | 19:3f82c1161fd2 | 1222 | /// or may be set to ACTIVEWINDOW. |
WiredHome | 19:3f82c1161fd2 | 1223 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1224 | /// |
WiredHome | 19:3f82c1161fd2 | 1225 | RetCode_t clsw(RA8875::Region_t region = FULLWINDOW); |
WiredHome | 19:3f82c1161fd2 | 1226 | |
WiredHome | 19:3f82c1161fd2 | 1227 | /// Set the background color. |
WiredHome | 19:3f82c1161fd2 | 1228 | /// |
WiredHome | 72:ecffe56af969 | 1229 | /// @param[in] color is expressed in 16-bit format. |
WiredHome | 19:3f82c1161fd2 | 1230 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1231 | /// |
WiredHome | 19:3f82c1161fd2 | 1232 | virtual RetCode_t background(color_t color); |
WiredHome | 19:3f82c1161fd2 | 1233 | |
WiredHome | 19:3f82c1161fd2 | 1234 | /// Set the background color. |
WiredHome | 19:3f82c1161fd2 | 1235 | /// |
WiredHome | 72:ecffe56af969 | 1236 | /// @param[in] r is the red element of the color. |
WiredHome | 72:ecffe56af969 | 1237 | /// @param[in] g is the green element of the color. |
WiredHome | 72:ecffe56af969 | 1238 | /// @param[in] b is the blue element of the color. |
WiredHome | 19:3f82c1161fd2 | 1239 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1240 | /// |
WiredHome | 19:3f82c1161fd2 | 1241 | virtual RetCode_t background(unsigned char r, unsigned char g, unsigned char b); |
WiredHome | 19:3f82c1161fd2 | 1242 | |
WiredHome | 19:3f82c1161fd2 | 1243 | /// Set the foreground color. |
WiredHome | 19:3f82c1161fd2 | 1244 | /// |
WiredHome | 72:ecffe56af969 | 1245 | /// @param[in] color is expressed in 16-bit format. |
WiredHome | 19:3f82c1161fd2 | 1246 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1247 | /// |
WiredHome | 19:3f82c1161fd2 | 1248 | virtual RetCode_t foreground(color_t color); |
WiredHome | 19:3f82c1161fd2 | 1249 | |
WiredHome | 19:3f82c1161fd2 | 1250 | /// Set the foreground color. |
WiredHome | 19:3f82c1161fd2 | 1251 | /// |
WiredHome | 72:ecffe56af969 | 1252 | /// @param[in] r is the red element of the color. |
WiredHome | 72:ecffe56af969 | 1253 | /// @param[in] g is the green element of the color. |
WiredHome | 72:ecffe56af969 | 1254 | /// @param[in] b is the blue element of the color. |
WiredHome | 19:3f82c1161fd2 | 1255 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1256 | /// |
WiredHome | 37:f19b7e7449dc | 1257 | virtual RetCode_t foreground(unsigned char r, unsigned char g, unsigned char b); |
WiredHome | 19:3f82c1161fd2 | 1258 | |
WiredHome | 19:3f82c1161fd2 | 1259 | /// Get the current foreground color value. |
WiredHome | 19:3f82c1161fd2 | 1260 | /// |
WiredHome | 19:3f82c1161fd2 | 1261 | /// @returns the current foreground color. |
WiredHome | 19:3f82c1161fd2 | 1262 | /// |
WiredHome | 37:f19b7e7449dc | 1263 | color_t GetForeColor(void); |
WiredHome | 87:ee2240581aa7 | 1264 | |
WiredHome | 87:ee2240581aa7 | 1265 | /// Draw a pixel in the specified color. |
WiredHome | 87:ee2240581aa7 | 1266 | /// |
WiredHome | 87:ee2240581aa7 | 1267 | /// @note Unlike many other operations, this does not |
WiredHome | 87:ee2240581aa7 | 1268 | /// set the forecolor! |
WiredHome | 87:ee2240581aa7 | 1269 | /// |
WiredHome | 87:ee2240581aa7 | 1270 | /// @param[in] p is the point_t defining the location. |
WiredHome | 87:ee2240581aa7 | 1271 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 87:ee2240581aa7 | 1272 | /// |
WiredHome | 87:ee2240581aa7 | 1273 | virtual RetCode_t pixel(point_t p, color_t color); |
WiredHome | 87:ee2240581aa7 | 1274 | |
WiredHome | 87:ee2240581aa7 | 1275 | /// Draw a pixel in the current foreground color. |
WiredHome | 87:ee2240581aa7 | 1276 | /// |
WiredHome | 87:ee2240581aa7 | 1277 | /// @param[in] p is the point_t defining the location. |
WiredHome | 87:ee2240581aa7 | 1278 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 87:ee2240581aa7 | 1279 | /// |
WiredHome | 87:ee2240581aa7 | 1280 | virtual RetCode_t pixel(point_t p); |
WiredHome | 19:3f82c1161fd2 | 1281 | |
WiredHome | 19:3f82c1161fd2 | 1282 | /// Draw a pixel in the specified color. |
WiredHome | 19:3f82c1161fd2 | 1283 | /// |
WiredHome | 41:2956a0a221e5 | 1284 | /// @note Unlike many other operations, this does not |
WiredHome | 41:2956a0a221e5 | 1285 | /// set the forecolor! |
WiredHome | 19:3f82c1161fd2 | 1286 | /// |
WiredHome | 72:ecffe56af969 | 1287 | /// @param[in] x is the horizontal offset to this pixel. |
WiredHome | 72:ecffe56af969 | 1288 | /// @param[in] y is the vertical offset to this pixel. |
WiredHome | 72:ecffe56af969 | 1289 | /// @param[in] color defines the color for the pixel. |
WiredHome | 19:3f82c1161fd2 | 1290 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1291 | /// |
WiredHome | 37:f19b7e7449dc | 1292 | virtual RetCode_t pixel(loc_t x, loc_t y, color_t color); |
WiredHome | 19:3f82c1161fd2 | 1293 | |
WiredHome | 19:3f82c1161fd2 | 1294 | /// Draw a pixel in the current foreground color. |
WiredHome | 19:3f82c1161fd2 | 1295 | /// |
WiredHome | 72:ecffe56af969 | 1296 | /// @param[in] x is the horizontal offset to this pixel. |
WiredHome | 72:ecffe56af969 | 1297 | /// @param[in] y is the veritical offset to this pixel. |
WiredHome | 19:3f82c1161fd2 | 1298 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1299 | /// |
WiredHome | 37:f19b7e7449dc | 1300 | virtual RetCode_t pixel(loc_t x, loc_t y); |
WiredHome | 19:3f82c1161fd2 | 1301 | |
WiredHome | 41:2956a0a221e5 | 1302 | /// Get a pixel from the display. |
WiredHome | 41:2956a0a221e5 | 1303 | /// |
WiredHome | 72:ecffe56af969 | 1304 | /// @param[in] x is the horizontal offset to this pixel. |
WiredHome | 72:ecffe56af969 | 1305 | /// @param[in] y is the vertical offset to this pixel. |
WiredHome | 41:2956a0a221e5 | 1306 | /// @returns the pixel. see @color_t |
WiredHome | 41:2956a0a221e5 | 1307 | /// |
WiredHome | 41:2956a0a221e5 | 1308 | virtual color_t getPixel(loc_t x, loc_t y); |
WiredHome | 41:2956a0a221e5 | 1309 | |
WiredHome | 41:2956a0a221e5 | 1310 | /// Write a stream of pixels to the display. |
WiredHome | 41:2956a0a221e5 | 1311 | /// |
WiredHome | 72:ecffe56af969 | 1312 | /// @param[in] p is a pointer to a color_t array to write. |
WiredHome | 72:ecffe56af969 | 1313 | /// @param[in] count is the number of pixels to write. |
WiredHome | 72:ecffe56af969 | 1314 | /// @param[in] x is the horizontal position on the display. |
WiredHome | 72:ecffe56af969 | 1315 | /// @param[in] y is the vertical position on the display. |
WiredHome | 41:2956a0a221e5 | 1316 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 41:2956a0a221e5 | 1317 | /// |
WiredHome | 41:2956a0a221e5 | 1318 | virtual RetCode_t pixelStream(color_t * p, uint32_t count, loc_t x, loc_t y); |
WiredHome | 41:2956a0a221e5 | 1319 | |
WiredHome | 41:2956a0a221e5 | 1320 | /// Get a stream of pixels from the display. |
WiredHome | 41:2956a0a221e5 | 1321 | /// |
WiredHome | 72:ecffe56af969 | 1322 | /// @param[in] p is a pointer to a color_t array to accept the stream. |
WiredHome | 72:ecffe56af969 | 1323 | /// @param[in] count is the number of pixels to read. |
WiredHome | 72:ecffe56af969 | 1324 | /// @param[in] x is the horizontal offset to this pixel. |
WiredHome | 72:ecffe56af969 | 1325 | /// @param[in] y is the vertical offset to this pixel. |
WiredHome | 41:2956a0a221e5 | 1326 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 41:2956a0a221e5 | 1327 | /// |
WiredHome | 41:2956a0a221e5 | 1328 | virtual RetCode_t getPixelStream(color_t * p, uint32_t count, loc_t x, loc_t y); |
WiredHome | 41:2956a0a221e5 | 1329 | |
WiredHome | 19:3f82c1161fd2 | 1330 | /// Draw a line in the specified color |
WiredHome | 19:3f82c1161fd2 | 1331 | /// |
WiredHome | 19:3f82c1161fd2 | 1332 | /// @note As a side effect, this changes the current |
WiredHome | 19:3f82c1161fd2 | 1333 | /// foreground color for subsequent operations. |
WiredHome | 19:3f82c1161fd2 | 1334 | /// |
WiredHome | 83:7bad0068cca0 | 1335 | /// @param[in] p1 is the point to start the line. |
WiredHome | 83:7bad0068cca0 | 1336 | /// @param[in] p2 is the point to end the line. |
WiredHome | 83:7bad0068cca0 | 1337 | /// @param[in] color defines the foreground color. |
WiredHome | 83:7bad0068cca0 | 1338 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 83:7bad0068cca0 | 1339 | /// |
WiredHome | 83:7bad0068cca0 | 1340 | RetCode_t line(point_t p1, point_t p2, color_t color); |
WiredHome | 83:7bad0068cca0 | 1341 | |
WiredHome | 83:7bad0068cca0 | 1342 | /// Draw a line |
WiredHome | 83:7bad0068cca0 | 1343 | /// |
WiredHome | 83:7bad0068cca0 | 1344 | /// Draws a line using the foreground color setting. |
WiredHome | 83:7bad0068cca0 | 1345 | /// |
WiredHome | 83:7bad0068cca0 | 1346 | /// @param[in] p1 is the point to start the line. |
WiredHome | 83:7bad0068cca0 | 1347 | /// @param[in] p2 is the point to end the line. |
WiredHome | 83:7bad0068cca0 | 1348 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 83:7bad0068cca0 | 1349 | /// |
WiredHome | 83:7bad0068cca0 | 1350 | RetCode_t line(point_t p1, point_t p2); |
WiredHome | 83:7bad0068cca0 | 1351 | |
WiredHome | 83:7bad0068cca0 | 1352 | /// Draw a line in the specified color |
WiredHome | 83:7bad0068cca0 | 1353 | /// |
WiredHome | 83:7bad0068cca0 | 1354 | /// @note As a side effect, this changes the current |
WiredHome | 83:7bad0068cca0 | 1355 | /// foreground color for subsequent operations. |
WiredHome | 83:7bad0068cca0 | 1356 | /// |
WiredHome | 72:ecffe56af969 | 1357 | /// @param[in] x1 is the horizontal start of the line. |
WiredHome | 72:ecffe56af969 | 1358 | /// @param[in] y1 is the vertical start of the line. |
WiredHome | 72:ecffe56af969 | 1359 | /// @param[in] x2 is the horizontal end of the line. |
WiredHome | 72:ecffe56af969 | 1360 | /// @param[in] y2 is the vertical end of the line. |
WiredHome | 72:ecffe56af969 | 1361 | /// @param[in] color defines the foreground color. |
WiredHome | 19:3f82c1161fd2 | 1362 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1363 | /// |
WiredHome | 56:7a85d226ad0d | 1364 | RetCode_t line(loc_t x1, loc_t y1, loc_t x2, loc_t y2, color_t color); |
WiredHome | 19:3f82c1161fd2 | 1365 | |
WiredHome | 19:3f82c1161fd2 | 1366 | /// Draw a line |
WiredHome | 19:3f82c1161fd2 | 1367 | /// |
WiredHome | 19:3f82c1161fd2 | 1368 | /// Draws a line using the foreground color setting. |
WiredHome | 19:3f82c1161fd2 | 1369 | /// |
WiredHome | 72:ecffe56af969 | 1370 | /// @param[in] x1 is the horizontal start of the line. |
WiredHome | 72:ecffe56af969 | 1371 | /// @param[in] y1 is the vertical start of the line. |
WiredHome | 72:ecffe56af969 | 1372 | /// @param[in] x2 is the horizontal end of the line. |
WiredHome | 72:ecffe56af969 | 1373 | /// @param[in] y2 is the vertical end of the line. |
WiredHome | 19:3f82c1161fd2 | 1374 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1375 | /// |
WiredHome | 37:f19b7e7449dc | 1376 | RetCode_t line(loc_t x1, loc_t y1, loc_t x2, loc_t y2); |
WiredHome | 19:3f82c1161fd2 | 1377 | |
WiredHome | 19:3f82c1161fd2 | 1378 | /// Draw a rectangle in the specified color |
WiredHome | 19:3f82c1161fd2 | 1379 | /// |
WiredHome | 19:3f82c1161fd2 | 1380 | /// @note As a side effect, this changes the current |
WiredHome | 19:3f82c1161fd2 | 1381 | /// foreground color for subsequent operations. |
WiredHome | 19:3f82c1161fd2 | 1382 | /// |
WiredHome | 81:01da2e34283d | 1383 | /// @param[in] rect defines the rectangle. |
WiredHome | 81:01da2e34283d | 1384 | /// @param[in] color defines the foreground color. |
WiredHome | 81:01da2e34283d | 1385 | /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL. |
WiredHome | 81:01da2e34283d | 1386 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 81:01da2e34283d | 1387 | /// |
WiredHome | 82:f7d300f26540 | 1388 | RetCode_t rect(rect_t rect, color_t color, fill_t fillit = NOFILL); |
WiredHome | 81:01da2e34283d | 1389 | |
WiredHome | 81:01da2e34283d | 1390 | /// Draw a filled rectangle in the specified color |
WiredHome | 81:01da2e34283d | 1391 | /// |
WiredHome | 81:01da2e34283d | 1392 | /// @note As a side effect, this changes the current |
WiredHome | 81:01da2e34283d | 1393 | /// foreground color for subsequent operations. |
WiredHome | 81:01da2e34283d | 1394 | /// |
WiredHome | 81:01da2e34283d | 1395 | /// @param[in] rect defines the rectangle. |
WiredHome | 81:01da2e34283d | 1396 | /// @param[in] color defines the foreground color. |
WiredHome | 81:01da2e34283d | 1397 | /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL. |
WiredHome | 81:01da2e34283d | 1398 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 81:01da2e34283d | 1399 | /// |
WiredHome | 81:01da2e34283d | 1400 | RetCode_t fillrect(rect_t rect, color_t color, fill_t fillit = FILL); |
WiredHome | 81:01da2e34283d | 1401 | |
WiredHome | 81:01da2e34283d | 1402 | /// Draw a rectangle in the specified color |
WiredHome | 81:01da2e34283d | 1403 | /// |
WiredHome | 81:01da2e34283d | 1404 | /// @note As a side effect, this changes the current |
WiredHome | 81:01da2e34283d | 1405 | /// foreground color for subsequent operations. |
WiredHome | 81:01da2e34283d | 1406 | /// |
WiredHome | 72:ecffe56af969 | 1407 | /// @param[in] x1 is the horizontal start of the line. |
WiredHome | 72:ecffe56af969 | 1408 | /// @param[in] y1 is the vertical start of the line. |
WiredHome | 72:ecffe56af969 | 1409 | /// @param[in] x2 is the horizontal end of the line. |
WiredHome | 72:ecffe56af969 | 1410 | /// @param[in] y2 is the vertical end of the line. |
WiredHome | 72:ecffe56af969 | 1411 | /// @param[in] color defines the foreground color. |
WiredHome | 81:01da2e34283d | 1412 | /// @param[in] fillit is optional to FILL the rectangle. default is FILL. |
WiredHome | 19:3f82c1161fd2 | 1413 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1414 | /// |
WiredHome | 37:f19b7e7449dc | 1415 | RetCode_t rect(loc_t x1, loc_t y1, loc_t x2, loc_t y2, |
WiredHome | 19:3f82c1161fd2 | 1416 | color_t color, fill_t fillit = NOFILL); |
WiredHome | 19:3f82c1161fd2 | 1417 | |
WiredHome | 19:3f82c1161fd2 | 1418 | /// Draw a filled rectangle in the specified color |
WiredHome | 19:3f82c1161fd2 | 1419 | /// |
WiredHome | 19:3f82c1161fd2 | 1420 | /// @note As a side effect, this changes the current |
WiredHome | 19:3f82c1161fd2 | 1421 | /// foreground color for subsequent operations. |
WiredHome | 19:3f82c1161fd2 | 1422 | /// |
WiredHome | 72:ecffe56af969 | 1423 | /// @param[in] x1 is the horizontal start of the line. |
WiredHome | 72:ecffe56af969 | 1424 | /// @param[in] y1 is the vertical start of the line. |
WiredHome | 72:ecffe56af969 | 1425 | /// @param[in] x2 is the horizontal end of the line. |
WiredHome | 72:ecffe56af969 | 1426 | /// @param[in] y2 is the vertical end of the line. |
WiredHome | 72:ecffe56af969 | 1427 | /// @param[in] color defines the foreground color. |
WiredHome | 72:ecffe56af969 | 1428 | /// @param[in] fillit is optional to NOFILL the rectangle. default is FILL. |
WiredHome | 19:3f82c1161fd2 | 1429 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1430 | /// |
WiredHome | 37:f19b7e7449dc | 1431 | virtual RetCode_t fillrect(loc_t x1, loc_t y1, loc_t x2, loc_t y2, |
WiredHome | 19:3f82c1161fd2 | 1432 | color_t color, fill_t fillit = FILL); |
WiredHome | 19:3f82c1161fd2 | 1433 | |
WiredHome | 19:3f82c1161fd2 | 1434 | /// Draw a rectangle |
WiredHome | 19:3f82c1161fd2 | 1435 | /// |
WiredHome | 19:3f82c1161fd2 | 1436 | /// Draws a rectangle using the foreground color setting. |
WiredHome | 19:3f82c1161fd2 | 1437 | /// |
WiredHome | 72:ecffe56af969 | 1438 | /// @param[in] x1 is the horizontal start of the line. |
WiredHome | 72:ecffe56af969 | 1439 | /// @param[in] y1 is the vertical start of the line. |
WiredHome | 72:ecffe56af969 | 1440 | /// @param[in] x2 is the horizontal end of the line. |
WiredHome | 72:ecffe56af969 | 1441 | /// @param[in] y2 is the vertical end of the line. |
WiredHome | 72:ecffe56af969 | 1442 | /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL. |
WiredHome | 19:3f82c1161fd2 | 1443 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1444 | /// |
WiredHome | 37:f19b7e7449dc | 1445 | RetCode_t rect(loc_t x1, loc_t y1, loc_t x2, loc_t y2, |
WiredHome | 19:3f82c1161fd2 | 1446 | fill_t fillit = NOFILL); |
WiredHome | 19:3f82c1161fd2 | 1447 | |
WiredHome | 19:3f82c1161fd2 | 1448 | /// Draw a filled rectangle with rounded corners using the specified color. |
WiredHome | 19:3f82c1161fd2 | 1449 | /// |
WiredHome | 21:3c1efb192927 | 1450 | /// This draws a rounded rectangle. A numbers of checks are made on the values, |
WiredHome | 21:3c1efb192927 | 1451 | /// and it could reduce this to drawing a line (if either x1 == x2, or y1 == y2), |
WiredHome | 21:3c1efb192927 | 1452 | /// or a single point (x1 == x2 && y1 == y2). If the radius parameters are |
WiredHome | 21:3c1efb192927 | 1453 | /// > 1/2 the length of that side (width or height), an error value is returned. |
WiredHome | 21:3c1efb192927 | 1454 | /// |
WiredHome | 19:3f82c1161fd2 | 1455 | /// @note As a side effect, this changes the current |
WiredHome | 19:3f82c1161fd2 | 1456 | /// foreground color for subsequent operations. |
WiredHome | 19:3f82c1161fd2 | 1457 | /// |
WiredHome | 72:ecffe56af969 | 1458 | /// @param[in] x1 is the horizontal start of the line and must be <= x2. |
WiredHome | 72:ecffe56af969 | 1459 | /// @param[in] y1 is the vertical start of the line and must be <= y2. |
WiredHome | 72:ecffe56af969 | 1460 | /// @param[in] x2 is the horizontal end of the line and must be >= x1. |
WiredHome | 72:ecffe56af969 | 1461 | /// @param[in] y2 is the vertical end of the line and must be >= y1. |
WiredHome | 72:ecffe56af969 | 1462 | /// @param[in] radius1 defines the horizontal radius of the curved corner. Take care |
WiredHome | 21:3c1efb192927 | 1463 | /// that this value < 1/2 the width of the rectangle, or bad_parameter |
WiredHome | 21:3c1efb192927 | 1464 | /// is returned. |
WiredHome | 72:ecffe56af969 | 1465 | /// @param[in] radius2 defines the vertical radius of the curved corner. Take care |
WiredHome | 21:3c1efb192927 | 1466 | /// that this value < 1/2 the height of the rectangle, or bad_parameter |
WiredHome | 21:3c1efb192927 | 1467 | /// is returned. |
WiredHome | 72:ecffe56af969 | 1468 | /// @param[in] color defines the foreground color. |
WiredHome | 72:ecffe56af969 | 1469 | /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL. |
WiredHome | 19:3f82c1161fd2 | 1470 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1471 | /// |
WiredHome | 37:f19b7e7449dc | 1472 | RetCode_t fillroundrect(loc_t x1, loc_t y1, loc_t x2, loc_t y2, |
WiredHome | 37:f19b7e7449dc | 1473 | dim_t radius1, dim_t radius2, color_t color, fill_t fillit = FILL); |
WiredHome | 19:3f82c1161fd2 | 1474 | |
WiredHome | 19:3f82c1161fd2 | 1475 | /// Draw a rectangle with rounded corners using the specified color. |
WiredHome | 19:3f82c1161fd2 | 1476 | /// |
WiredHome | 21:3c1efb192927 | 1477 | /// This draws a rounded rectangle. A numbers of checks are made on the values, |
WiredHome | 21:3c1efb192927 | 1478 | /// and it could reduce this to drawing a line (if either x1 == x2, or y1 == y2), |
WiredHome | 21:3c1efb192927 | 1479 | /// or a single point (x1 == x2 && y1 == y2). If the radius parameters are |
WiredHome | 21:3c1efb192927 | 1480 | /// > 1/2 the length of that side (width or height), an error value is returned. |
WiredHome | 21:3c1efb192927 | 1481 | /// |
WiredHome | 19:3f82c1161fd2 | 1482 | /// @note As a side effect, this changes the current |
WiredHome | 19:3f82c1161fd2 | 1483 | /// foreground color for subsequent operations. |
WiredHome | 19:3f82c1161fd2 | 1484 | /// |
WiredHome | 72:ecffe56af969 | 1485 | /// @param[in] x1 is the horizontal start of the line and must be <= x2. |
WiredHome | 72:ecffe56af969 | 1486 | /// @param[in] y1 is the vertical start of the line and must be <= y2. |
WiredHome | 72:ecffe56af969 | 1487 | /// @param[in] x2 is the horizontal end of the line and must be >= x1. |
WiredHome | 72:ecffe56af969 | 1488 | /// @param[in] y2 is the vertical end of the line and must be >= y1. |
WiredHome | 72:ecffe56af969 | 1489 | /// @param[in] radius1 defines the horizontal radius of the curved corner. Take care |
WiredHome | 21:3c1efb192927 | 1490 | /// that this value < 1/2 the width of the rectangle, or bad_parameter |
WiredHome | 21:3c1efb192927 | 1491 | /// is returned. |
WiredHome | 72:ecffe56af969 | 1492 | /// @param[in] radius2 defines the vertical radius of the curved corner. Take care |
WiredHome | 21:3c1efb192927 | 1493 | /// that this value < 1/2 the height of the rectangle, or bad_parameter |
WiredHome | 21:3c1efb192927 | 1494 | /// is returned. |
WiredHome | 72:ecffe56af969 | 1495 | /// @param[in] color defines the foreground color. |
WiredHome | 72:ecffe56af969 | 1496 | /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL. |
WiredHome | 19:3f82c1161fd2 | 1497 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1498 | /// |
WiredHome | 37:f19b7e7449dc | 1499 | RetCode_t roundrect(loc_t x1, loc_t y1, loc_t x2, loc_t y2, |
WiredHome | 37:f19b7e7449dc | 1500 | dim_t radius1, dim_t radius2, color_t color, fill_t fillit = NOFILL); |
WiredHome | 19:3f82c1161fd2 | 1501 | |
WiredHome | 19:3f82c1161fd2 | 1502 | /// Draw a rectangle with rounded corners. |
WiredHome | 19:3f82c1161fd2 | 1503 | /// |
WiredHome | 21:3c1efb192927 | 1504 | /// This draws a rounded rectangle. A numbers of checks are made on the values, |
WiredHome | 21:3c1efb192927 | 1505 | /// and it could reduce this to drawing a line (if either x1 == x2, or y1 == y2), |
WiredHome | 21:3c1efb192927 | 1506 | /// or a single point (x1 == x2 && y1 == y2). If the radius parameters are |
WiredHome | 21:3c1efb192927 | 1507 | /// > 1/2 the length of that side (width or height), an error value is returned. |
WiredHome | 19:3f82c1161fd2 | 1508 | /// |
WiredHome | 72:ecffe56af969 | 1509 | /// @param[in] x1 is the horizontal start of the line and must be <= x2. |
WiredHome | 72:ecffe56af969 | 1510 | /// @param[in] y1 is the vertical start of the line and must be <= y2. |
WiredHome | 72:ecffe56af969 | 1511 | /// @param[in] x2 is the horizontal end of the line and must be >= x1. |
WiredHome | 72:ecffe56af969 | 1512 | /// @param[in] y2 is the vertical end of the line and must be >= y1. |
WiredHome | 72:ecffe56af969 | 1513 | /// @param[in] radius1 defines the horizontal radius of the curved corner. Take care |
WiredHome | 21:3c1efb192927 | 1514 | /// that this value < 1/2 the width of the rectangle, or bad_parameter |
WiredHome | 21:3c1efb192927 | 1515 | /// is returned. |
WiredHome | 72:ecffe56af969 | 1516 | /// @param[in] radius2 defines the vertical radius of the curved corner. Take care |
WiredHome | 21:3c1efb192927 | 1517 | /// that this value < 1/2 the height of the rectangle, or bad_parameter |
WiredHome | 21:3c1efb192927 | 1518 | /// is returned. |
WiredHome | 72:ecffe56af969 | 1519 | /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL. |
WiredHome | 19:3f82c1161fd2 | 1520 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1521 | /// |
WiredHome | 37:f19b7e7449dc | 1522 | RetCode_t roundrect(loc_t x1, loc_t y1, loc_t x2, loc_t y2, |
WiredHome | 37:f19b7e7449dc | 1523 | dim_t radius1, dim_t radius2, fill_t fillit = NOFILL); |
WiredHome | 19:3f82c1161fd2 | 1524 | |
WiredHome | 19:3f82c1161fd2 | 1525 | /// Draw a triangle in the specified color. |
WiredHome | 19:3f82c1161fd2 | 1526 | /// |
WiredHome | 19:3f82c1161fd2 | 1527 | /// @note As a side effect, this changes the current |
WiredHome | 19:3f82c1161fd2 | 1528 | /// foreground color for subsequent operations. |
WiredHome | 19:3f82c1161fd2 | 1529 | /// |
WiredHome | 72:ecffe56af969 | 1530 | /// @param[in] x1 is the horizontal for point 1. |
WiredHome | 72:ecffe56af969 | 1531 | /// @param[in] y1 is the vertical for point 1. |
WiredHome | 72:ecffe56af969 | 1532 | /// @param[in] x2 is the horizontal for point 2. |
WiredHome | 72:ecffe56af969 | 1533 | /// @param[in] y2 is the vertical for point 2. |
WiredHome | 72:ecffe56af969 | 1534 | /// @param[in] x3 is the horizontal for point 3. |
WiredHome | 72:ecffe56af969 | 1535 | /// @param[in] y3 is the vertical for point 3. |
WiredHome | 72:ecffe56af969 | 1536 | /// @param[in] color defines the foreground color. |
WiredHome | 72:ecffe56af969 | 1537 | /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL. |
WiredHome | 19:3f82c1161fd2 | 1538 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1539 | /// |
WiredHome | 37:f19b7e7449dc | 1540 | RetCode_t triangle(loc_t x1, loc_t y1, loc_t x2, loc_t y2, |
WiredHome | 37:f19b7e7449dc | 1541 | loc_t x3, loc_t y3, color_t color, fill_t fillit = NOFILL); |
WiredHome | 19:3f82c1161fd2 | 1542 | |
WiredHome | 19:3f82c1161fd2 | 1543 | /// Draw a filled triangle in the specified color. |
WiredHome | 19:3f82c1161fd2 | 1544 | /// |
WiredHome | 19:3f82c1161fd2 | 1545 | /// @note As a side effect, this changes the current |
WiredHome | 19:3f82c1161fd2 | 1546 | /// foreground color for subsequent operations. |
WiredHome | 19:3f82c1161fd2 | 1547 | /// |
WiredHome | 72:ecffe56af969 | 1548 | /// @param[in] x1 is the horizontal for point 1. |
WiredHome | 72:ecffe56af969 | 1549 | /// @param[in] y1 is the vertical for point 1. |
WiredHome | 72:ecffe56af969 | 1550 | /// @param[in] x2 is the horizontal for point 2. |
WiredHome | 72:ecffe56af969 | 1551 | /// @param[in] y2 is the vertical for point 2. |
WiredHome | 72:ecffe56af969 | 1552 | /// @param[in] x3 is the horizontal for point 3. |
WiredHome | 72:ecffe56af969 | 1553 | /// @param[in] y3 is the vertical for point 3. |
WiredHome | 72:ecffe56af969 | 1554 | /// @param[in] color defines the foreground color. |
WiredHome | 72:ecffe56af969 | 1555 | /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL. |
WiredHome | 19:3f82c1161fd2 | 1556 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1557 | /// |
WiredHome | 37:f19b7e7449dc | 1558 | RetCode_t filltriangle(loc_t x1, loc_t y1, loc_t x2, loc_t y2, |
WiredHome | 37:f19b7e7449dc | 1559 | loc_t x3, loc_t y3, color_t color, fill_t fillit = FILL); |
WiredHome | 19:3f82c1161fd2 | 1560 | |
WiredHome | 19:3f82c1161fd2 | 1561 | /// Draw a triangle |
WiredHome | 19:3f82c1161fd2 | 1562 | /// |
WiredHome | 19:3f82c1161fd2 | 1563 | /// Draws a triangle using the foreground color setting. |
WiredHome | 19:3f82c1161fd2 | 1564 | /// |
WiredHome | 72:ecffe56af969 | 1565 | /// @param[in] x1 is the horizontal for point 1. |
WiredHome | 72:ecffe56af969 | 1566 | /// @param[in] y1 is the vertical for point 1. |
WiredHome | 72:ecffe56af969 | 1567 | /// @param[in] x2 is the horizontal for point 2. |
WiredHome | 72:ecffe56af969 | 1568 | /// @param[in] y2 is the vertical for point 2. |
WiredHome | 72:ecffe56af969 | 1569 | /// @param[in] x3 is the horizontal for point 3. |
WiredHome | 72:ecffe56af969 | 1570 | /// @param[in] y3 is the vertical for point 3. |
WiredHome | 72:ecffe56af969 | 1571 | /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL. |
WiredHome | 19:3f82c1161fd2 | 1572 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1573 | /// |
WiredHome | 37:f19b7e7449dc | 1574 | RetCode_t triangle(loc_t x1, loc_t y1, loc_t x2, loc_t y2, |
WiredHome | 37:f19b7e7449dc | 1575 | loc_t x3, loc_t y3, fill_t fillit = NOFILL); |
WiredHome | 19:3f82c1161fd2 | 1576 | |
WiredHome | 83:7bad0068cca0 | 1577 | |
WiredHome | 83:7bad0068cca0 | 1578 | /// Draw a circle using the specified color. |
WiredHome | 83:7bad0068cca0 | 1579 | /// |
WiredHome | 83:7bad0068cca0 | 1580 | /// @note As a side effect, this changes the current |
WiredHome | 83:7bad0068cca0 | 1581 | /// foreground color for subsequent operations. |
WiredHome | 83:7bad0068cca0 | 1582 | /// |
WiredHome | 83:7bad0068cca0 | 1583 | /// @param[in] p defines the center of the circle. |
WiredHome | 83:7bad0068cca0 | 1584 | /// @param[in] radius defines the size of the circle. |
WiredHome | 83:7bad0068cca0 | 1585 | /// @param[in] color defines the foreground color. |
WiredHome | 83:7bad0068cca0 | 1586 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 83:7bad0068cca0 | 1587 | /// |
WiredHome | 83:7bad0068cca0 | 1588 | RetCode_t circle(point_t p, dim_t radius, color_t color, fill_t fillit = NOFILL); |
WiredHome | 83:7bad0068cca0 | 1589 | |
WiredHome | 83:7bad0068cca0 | 1590 | /// Draw a filled circle using the specified color. |
WiredHome | 83:7bad0068cca0 | 1591 | /// |
WiredHome | 83:7bad0068cca0 | 1592 | /// @note As a side effect, this changes the current |
WiredHome | 83:7bad0068cca0 | 1593 | /// foreground color for subsequent operations. |
WiredHome | 83:7bad0068cca0 | 1594 | /// |
WiredHome | 83:7bad0068cca0 | 1595 | /// @param[in] p defines the center of the circle. |
WiredHome | 83:7bad0068cca0 | 1596 | /// @param[in] radius defines the size of the circle. |
WiredHome | 83:7bad0068cca0 | 1597 | /// @param[in] color defines the foreground color. |
WiredHome | 83:7bad0068cca0 | 1598 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 83:7bad0068cca0 | 1599 | /// |
WiredHome | 83:7bad0068cca0 | 1600 | RetCode_t fillcircle(point_t p, dim_t radius, color_t color, fill_t fillit = FILL); |
WiredHome | 83:7bad0068cca0 | 1601 | |
WiredHome | 83:7bad0068cca0 | 1602 | /// Draw a circle. |
WiredHome | 83:7bad0068cca0 | 1603 | /// |
WiredHome | 83:7bad0068cca0 | 1604 | /// Draws a circle using the foreground color setting. |
WiredHome | 83:7bad0068cca0 | 1605 | /// |
WiredHome | 83:7bad0068cca0 | 1606 | /// @param[in] p defines the center of the circle. |
WiredHome | 83:7bad0068cca0 | 1607 | /// @param[in] radius defines the size of the circle. |
WiredHome | 83:7bad0068cca0 | 1608 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 83:7bad0068cca0 | 1609 | /// |
WiredHome | 83:7bad0068cca0 | 1610 | RetCode_t circle(point_t p, dim_t radius, fill_t fillit = NOFILL); |
WiredHome | 83:7bad0068cca0 | 1611 | |
WiredHome | 19:3f82c1161fd2 | 1612 | /// Draw a circle using the specified color. |
WiredHome | 19:3f82c1161fd2 | 1613 | /// |
WiredHome | 19:3f82c1161fd2 | 1614 | /// @note As a side effect, this changes the current |
WiredHome | 19:3f82c1161fd2 | 1615 | /// foreground color for subsequent operations. |
WiredHome | 19:3f82c1161fd2 | 1616 | /// |
WiredHome | 72:ecffe56af969 | 1617 | /// @param[in] x is the horizontal center of the circle. |
WiredHome | 72:ecffe56af969 | 1618 | /// @param[in] y is the vertical center of the circle. |
WiredHome | 72:ecffe56af969 | 1619 | /// @param[in] radius defines the size of the circle. |
WiredHome | 72:ecffe56af969 | 1620 | /// @param[in] color defines the foreground color. |
WiredHome | 19:3f82c1161fd2 | 1621 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1622 | /// |
WiredHome | 37:f19b7e7449dc | 1623 | RetCode_t circle(loc_t x, loc_t y, dim_t radius, color_t color, fill_t fillit = NOFILL); |
WiredHome | 19:3f82c1161fd2 | 1624 | |
WiredHome | 19:3f82c1161fd2 | 1625 | /// Draw a filled circle using the specified color. |
WiredHome | 19:3f82c1161fd2 | 1626 | /// |
WiredHome | 19:3f82c1161fd2 | 1627 | /// @note As a side effect, this changes the current |
WiredHome | 19:3f82c1161fd2 | 1628 | /// foreground color for subsequent operations. |
WiredHome | 19:3f82c1161fd2 | 1629 | /// |
WiredHome | 72:ecffe56af969 | 1630 | /// @param[in] x is the horizontal center of the circle. |
WiredHome | 72:ecffe56af969 | 1631 | /// @param[in] y is the vertical center of the circle. |
WiredHome | 72:ecffe56af969 | 1632 | /// @param[in] radius defines the size of the circle. |
WiredHome | 72:ecffe56af969 | 1633 | /// @param[in] color defines the foreground color. |
WiredHome | 19:3f82c1161fd2 | 1634 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1635 | /// |
WiredHome | 37:f19b7e7449dc | 1636 | RetCode_t fillcircle(loc_t x, loc_t y, dim_t radius, color_t color, fill_t fillit = FILL); |
WiredHome | 19:3f82c1161fd2 | 1637 | |
WiredHome | 19:3f82c1161fd2 | 1638 | /// Draw a circle. |
WiredHome | 19:3f82c1161fd2 | 1639 | /// |
WiredHome | 19:3f82c1161fd2 | 1640 | /// Draws a circle using the foreground color setting. |
WiredHome | 19:3f82c1161fd2 | 1641 | /// |
WiredHome | 72:ecffe56af969 | 1642 | /// @param[in] x is the horizontal center of the circle. |
WiredHome | 72:ecffe56af969 | 1643 | /// @param[in] y is the vertical center of the circle. |
WiredHome | 72:ecffe56af969 | 1644 | /// @param[in] radius defines the size of the circle. |
WiredHome | 19:3f82c1161fd2 | 1645 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1646 | /// |
WiredHome | 37:f19b7e7449dc | 1647 | RetCode_t circle(loc_t x, loc_t y, dim_t radius, fill_t fillit = NOFILL); |
WiredHome | 19:3f82c1161fd2 | 1648 | |
WiredHome | 19:3f82c1161fd2 | 1649 | /// Draw an Ellipse using the specified color |
WiredHome | 19:3f82c1161fd2 | 1650 | /// |
WiredHome | 19:3f82c1161fd2 | 1651 | /// @note As a side effect, this changes the current |
WiredHome | 19:3f82c1161fd2 | 1652 | /// foreground color for subsequent operations. |
WiredHome | 19:3f82c1161fd2 | 1653 | /// |
WiredHome | 72:ecffe56af969 | 1654 | /// @param[in] x is the horizontal center of the ellipse. |
WiredHome | 72:ecffe56af969 | 1655 | /// @param[in] y is the vertical center of the ellipse. |
WiredHome | 72:ecffe56af969 | 1656 | /// @param[in] radius1 defines the horizontal radius of the ellipse. |
WiredHome | 72:ecffe56af969 | 1657 | /// @param[in] radius2 defines the vertical radius of the ellipse. |
WiredHome | 72:ecffe56af969 | 1658 | /// @param[in] color defines the foreground color. |
WiredHome | 72:ecffe56af969 | 1659 | /// @param[in] fillit defines whether the circle is filled or not. |
WiredHome | 19:3f82c1161fd2 | 1660 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1661 | /// |
WiredHome | 37:f19b7e7449dc | 1662 | RetCode_t ellipse(loc_t x, loc_t y, dim_t radius1, dim_t radius2, |
WiredHome | 19:3f82c1161fd2 | 1663 | color_t color, fill_t fillit = NOFILL); |
WiredHome | 19:3f82c1161fd2 | 1664 | |
WiredHome | 25:9556a3a9b7cc | 1665 | /// Draw a filled Ellipse using the specified color |
WiredHome | 25:9556a3a9b7cc | 1666 | /// |
WiredHome | 25:9556a3a9b7cc | 1667 | /// @note As a side effect, this changes the current |
WiredHome | 25:9556a3a9b7cc | 1668 | /// foreground color for subsequent operations. |
WiredHome | 25:9556a3a9b7cc | 1669 | /// |
WiredHome | 72:ecffe56af969 | 1670 | /// @param[in] x is the horizontal center of the ellipse. |
WiredHome | 72:ecffe56af969 | 1671 | /// @param[in] y is the vertical center of the ellipse. |
WiredHome | 72:ecffe56af969 | 1672 | /// @param[in] radius1 defines the horizontal radius of the ellipse. |
WiredHome | 72:ecffe56af969 | 1673 | /// @param[in] radius2 defines the vertical radius of the ellipse. |
WiredHome | 72:ecffe56af969 | 1674 | /// @param[in] color defines the foreground color. |
WiredHome | 72:ecffe56af969 | 1675 | /// @param[in] fillit defines whether the circle is filled or not. |
WiredHome | 25:9556a3a9b7cc | 1676 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 25:9556a3a9b7cc | 1677 | /// |
WiredHome | 37:f19b7e7449dc | 1678 | RetCode_t fillellipse(loc_t x, loc_t y, dim_t radius1, dim_t radius2, |
WiredHome | 25:9556a3a9b7cc | 1679 | color_t color, fill_t fillit = FILL); |
WiredHome | 25:9556a3a9b7cc | 1680 | |
WiredHome | 19:3f82c1161fd2 | 1681 | /// Draw an Ellipse |
WiredHome | 19:3f82c1161fd2 | 1682 | /// |
WiredHome | 19:3f82c1161fd2 | 1683 | /// Draws it using the foreground color setting. |
WiredHome | 19:3f82c1161fd2 | 1684 | /// |
WiredHome | 72:ecffe56af969 | 1685 | /// @param[in] x is the horizontal center of the ellipse. |
WiredHome | 72:ecffe56af969 | 1686 | /// @param[in] y is the vertical center of the ellipse. |
WiredHome | 72:ecffe56af969 | 1687 | /// @param[in] radius1 defines the horizontal radius of the ellipse. |
WiredHome | 72:ecffe56af969 | 1688 | /// @param[in] radius2 defines the vertical radius of the ellipse. |
WiredHome | 72:ecffe56af969 | 1689 | /// @param[in] fillit defines whether the circle is filled or not. |
WiredHome | 19:3f82c1161fd2 | 1690 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1691 | /// |
WiredHome | 37:f19b7e7449dc | 1692 | RetCode_t ellipse(loc_t x, loc_t y, dim_t radius1, dim_t radius2, fill_t fillit = NOFILL); |
WiredHome | 19:3f82c1161fd2 | 1693 | |
WiredHome | 19:3f82c1161fd2 | 1694 | /// Control display power |
WiredHome | 19:3f82c1161fd2 | 1695 | /// |
WiredHome | 72:ecffe56af969 | 1696 | /// @param[in] on when set to true will turn on the display, when false it is turned off. |
WiredHome | 19:3f82c1161fd2 | 1697 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1698 | /// |
WiredHome | 19:3f82c1161fd2 | 1699 | RetCode_t Power(bool on); |
WiredHome | 19:3f82c1161fd2 | 1700 | |
WiredHome | 19:3f82c1161fd2 | 1701 | /// Reset the display controller via the Software Reset interface. |
WiredHome | 19:3f82c1161fd2 | 1702 | /// |
WiredHome | 19:3f82c1161fd2 | 1703 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1704 | /// |
WiredHome | 19:3f82c1161fd2 | 1705 | RetCode_t Reset(void); |
WiredHome | 19:3f82c1161fd2 | 1706 | |
WiredHome | 19:3f82c1161fd2 | 1707 | /// Set backlight brightness. |
WiredHome | 19:3f82c1161fd2 | 1708 | /// |
WiredHome | 19:3f82c1161fd2 | 1709 | /// When the built-in PWM is used to control the backlight, this |
WiredHome | 19:3f82c1161fd2 | 1710 | /// API can be used to set the brightness. |
WiredHome | 19:3f82c1161fd2 | 1711 | /// |
WiredHome | 72:ecffe56af969 | 1712 | /// @param[in] brightness ranges from 0 (off) to 255 (full on) |
WiredHome | 19:3f82c1161fd2 | 1713 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1714 | /// |
WiredHome | 19:3f82c1161fd2 | 1715 | RetCode_t Backlight_u8(unsigned char brightness); |
WiredHome | 19:3f82c1161fd2 | 1716 | |
WiredHome | 86:e86b355940f4 | 1717 | /// Get backlight brightness. |
WiredHome | 86:e86b355940f4 | 1718 | /// |
WiredHome | 86:e86b355940f4 | 1719 | /// @returns backlight setting from 0 (off) to 255 (full on). |
WiredHome | 86:e86b355940f4 | 1720 | /// |
WiredHome | 86:e86b355940f4 | 1721 | uint8_t GetBacklight_u8(void); |
WiredHome | 86:e86b355940f4 | 1722 | |
WiredHome | 19:3f82c1161fd2 | 1723 | /// Set backlight brightness. |
WiredHome | 19:3f82c1161fd2 | 1724 | /// |
WiredHome | 19:3f82c1161fd2 | 1725 | /// When the built-in PWM is used to control the backlight, this |
WiredHome | 19:3f82c1161fd2 | 1726 | /// API can be used to set the brightness. |
WiredHome | 19:3f82c1161fd2 | 1727 | /// |
WiredHome | 72:ecffe56af969 | 1728 | /// @param[in] brightness ranges from 0.0 (off) to 1.0 (full on) |
WiredHome | 19:3f82c1161fd2 | 1729 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 1730 | /// |
WiredHome | 19:3f82c1161fd2 | 1731 | RetCode_t Backlight(float brightness); |
WiredHome | 19:3f82c1161fd2 | 1732 | |
WiredHome | 86:e86b355940f4 | 1733 | /// Get backlight brightness. |
WiredHome | 86:e86b355940f4 | 1734 | /// |
WiredHome | 86:e86b355940f4 | 1735 | /// @returns backlight setting from 0 (off) to 1.0 (full on). |
WiredHome | 86:e86b355940f4 | 1736 | /// |
WiredHome | 86:e86b355940f4 | 1737 | float GetBacklight(void); |
WiredHome | 86:e86b355940f4 | 1738 | |
WiredHome | 32:0e4f2ae512e2 | 1739 | /// Select a bitmap font (provided by the user) for all subsequent text. |
WiredHome | 19:3f82c1161fd2 | 1740 | /// |
WiredHome | 19:3f82c1161fd2 | 1741 | /// @note Tool to create the fonts is accessible from its creator |
WiredHome | 19:3f82c1161fd2 | 1742 | /// available at http://www.mikroe.com. |
WiredHome | 19:3f82c1161fd2 | 1743 | /// Change the data to an array of type char[]. |
WiredHome | 19:3f82c1161fd2 | 1744 | /// |
WiredHome | 72:ecffe56af969 | 1745 | /// @param[in] font is a pointer to a specially formed font array. |
WiredHome | 19:3f82c1161fd2 | 1746 | /// This special font array has a 4-byte header, followed by |
WiredHome | 19:3f82c1161fd2 | 1747 | /// the data: |
WiredHome | 19:3f82c1161fd2 | 1748 | /// - the number of bytes per char |
WiredHome | 19:3f82c1161fd2 | 1749 | /// - the vertical size in pixels for each character |
WiredHome | 19:3f82c1161fd2 | 1750 | /// - the horizontal size in pixels for each character |
WiredHome | 19:3f82c1161fd2 | 1751 | /// - the number of bytes per vertical line (width of the array) |
WiredHome | 19:3f82c1161fd2 | 1752 | /// @returns error code. |
WiredHome | 19:3f82c1161fd2 | 1753 | /// |
WiredHome | 30:e0f2da88bdf6 | 1754 | virtual RetCode_t set_font(const unsigned char * font = NULL); |
WiredHome | 19:3f82c1161fd2 | 1755 | |
WiredHome | 19:3f82c1161fd2 | 1756 | /// Get the RGB value for a DOS color. |
WiredHome | 19:3f82c1161fd2 | 1757 | /// |
WiredHome | 72:ecffe56af969 | 1758 | /// @param[in] i is the color, in the range 0 to 15; |
WiredHome | 19:3f82c1161fd2 | 1759 | /// @returns the RGB color of the selected index, or 0 |
WiredHome | 19:3f82c1161fd2 | 1760 | /// if the index is out of bounds. |
WiredHome | 19:3f82c1161fd2 | 1761 | /// |
WiredHome | 19:3f82c1161fd2 | 1762 | color_t DOSColor(int i); |
WiredHome | 19:3f82c1161fd2 | 1763 | |
WiredHome | 19:3f82c1161fd2 | 1764 | /// Get the color name (string) for a DOS color. |
WiredHome | 19:3f82c1161fd2 | 1765 | /// |
WiredHome | 72:ecffe56af969 | 1766 | /// @param[in] i is the color, in the range 0 to 15; |
WiredHome | 19:3f82c1161fd2 | 1767 | /// @returns a pointer to a string with the color name, |
WiredHome | 19:3f82c1161fd2 | 1768 | /// or NULL if the index is out of bounds. |
WiredHome | 19:3f82c1161fd2 | 1769 | /// |
WiredHome | 19:3f82c1161fd2 | 1770 | const char * DOSColorNames(int i); |
WiredHome | 19:3f82c1161fd2 | 1771 | |
WiredHome | 55:dfbabef7003e | 1772 | /// Advanced method indicating the start of a graphics stream. |
WiredHome | 55:dfbabef7003e | 1773 | /// |
WiredHome | 55:dfbabef7003e | 1774 | /// This is called prior to a stream of pixel data being sent. |
WiredHome | 55:dfbabef7003e | 1775 | /// This may cause register configuration changes in the derived |
WiredHome | 55:dfbabef7003e | 1776 | /// class in order to prepare the hardware to accept the streaming |
WiredHome | 55:dfbabef7003e | 1777 | /// data. |
WiredHome | 55:dfbabef7003e | 1778 | /// |
WiredHome | 55:dfbabef7003e | 1779 | /// Following this command, a series of @see _putp() commands can |
WiredHome | 55:dfbabef7003e | 1780 | /// be used to send individual pixels to the screen. |
WiredHome | 55:dfbabef7003e | 1781 | /// |
WiredHome | 55:dfbabef7003e | 1782 | /// To conclude the graphics stream, @see _EndGraphicsStream should |
WiredHome | 55:dfbabef7003e | 1783 | /// be callled. |
WiredHome | 55:dfbabef7003e | 1784 | /// |
WiredHome | 55:dfbabef7003e | 1785 | /// @returns error code. |
WiredHome | 55:dfbabef7003e | 1786 | /// |
WiredHome | 55:dfbabef7003e | 1787 | virtual RetCode_t _StartGraphicsStream(void); |
WiredHome | 55:dfbabef7003e | 1788 | |
WiredHome | 55:dfbabef7003e | 1789 | /// Advanced method to put a single color pixel to the screen. |
WiredHome | 55:dfbabef7003e | 1790 | /// |
WiredHome | 55:dfbabef7003e | 1791 | /// This method may be called as many times as necessary after |
WiredHome | 55:dfbabef7003e | 1792 | /// @see _StartGraphicsStream() is called, and it should be followed |
WiredHome | 55:dfbabef7003e | 1793 | /// by _EndGraphicsStream. |
WiredHome | 55:dfbabef7003e | 1794 | /// |
WiredHome | 72:ecffe56af969 | 1795 | /// @param[in] pixel is a color value to be put on the screen. |
WiredHome | 55:dfbabef7003e | 1796 | /// @returns error code. |
WiredHome | 55:dfbabef7003e | 1797 | /// |
WiredHome | 55:dfbabef7003e | 1798 | virtual RetCode_t _putp(color_t pixel); |
WiredHome | 55:dfbabef7003e | 1799 | |
WiredHome | 55:dfbabef7003e | 1800 | /// Advanced method indicating the end of a graphics stream. |
WiredHome | 55:dfbabef7003e | 1801 | /// |
WiredHome | 55:dfbabef7003e | 1802 | /// This is called to conclude a stream of pixel data that was sent. |
WiredHome | 55:dfbabef7003e | 1803 | /// This may cause register configuration changes in the derived |
WiredHome | 55:dfbabef7003e | 1804 | /// class in order to stop the hardware from accept the streaming |
WiredHome | 55:dfbabef7003e | 1805 | /// data. |
WiredHome | 55:dfbabef7003e | 1806 | /// |
WiredHome | 55:dfbabef7003e | 1807 | /// @returns error code. |
WiredHome | 55:dfbabef7003e | 1808 | /// |
WiredHome | 55:dfbabef7003e | 1809 | virtual RetCode_t _EndGraphicsStream(void); |
WiredHome | 19:3f82c1161fd2 | 1810 | |
WiredHome | 57:bd53a9e165a1 | 1811 | /// Set the SPI port frequency (in Hz). |
WiredHome | 57:bd53a9e165a1 | 1812 | /// |
WiredHome | 66:468a11f05580 | 1813 | /// This uses the mbed SPI driver, and is therefore dependent on |
WiredHome | 66:468a11f05580 | 1814 | /// its capabilities. The RA8875 can accept writes via SPI faster |
WiredHome | 66:468a11f05580 | 1815 | /// than a read can be performed. The frequency set by this API |
WiredHome | 66:468a11f05580 | 1816 | /// is for the SPI writes. It will automatically reduce the SPI |
WiredHome | 66:468a11f05580 | 1817 | /// clock rate when a read is performed, and restore it for the |
WiredHome | 68:ab08efabfc88 | 1818 | /// next write. Alternately, the 2nd parameters permits setting |
WiredHome | 68:ab08efabfc88 | 1819 | /// the read speed rather than letting it compute it automatically. |
WiredHome | 57:bd53a9e165a1 | 1820 | /// |
WiredHome | 66:468a11f05580 | 1821 | /// @note The primary effect of this is to recover more CPU cycles |
WiredHome | 66:468a11f05580 | 1822 | /// for your application code. Keep in mind that when more than |
WiredHome | 66:468a11f05580 | 1823 | /// one command is sent to the display controller, that it |
WiredHome | 66:468a11f05580 | 1824 | /// will wait for the controller to finish the prior command. |
WiredHome | 66:468a11f05580 | 1825 | /// In this case, the performance is limited by the RA8875. |
WiredHome | 57:bd53a9e165a1 | 1826 | /// |
WiredHome | 72:ecffe56af969 | 1827 | /// @param[in] Hz is the frequency in Hz, tested range includes the |
WiredHome | 66:468a11f05580 | 1828 | /// range from 1,000,000 (1MHz) to 10,000,000 (10 MHz). Values |
WiredHome | 66:468a11f05580 | 1829 | /// outside this range will be accepted, but operation may |
WiredHome | 76:c981284eb513 | 1830 | /// be unreliable. This depends partially on your hardware design |
WiredHome | 76:c981284eb513 | 1831 | /// and the wires connecting the display module. |
WiredHome | 76:c981284eb513 | 1832 | /// The default value is 5,000,000, which should work for most |
WiredHome | 76:c981284eb513 | 1833 | /// applications as a starting point. |
WiredHome | 72:ecffe56af969 | 1834 | /// @param[in] Hz2 is an optional parameter and will set the read |
WiredHome | 68:ab08efabfc88 | 1835 | /// speed independently of the write speed. |
WiredHome | 57:bd53a9e165a1 | 1836 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 57:bd53a9e165a1 | 1837 | /// |
WiredHome | 68:ab08efabfc88 | 1838 | RetCode_t frequency(unsigned long Hz = RA8875_DEFAULT_SPI_FREQ, unsigned long Hz2 = 0); |
WiredHome | 57:bd53a9e165a1 | 1839 | |
WiredHome | 72:ecffe56af969 | 1840 | /// This method captures the specified area as a 24-bit bitmap file. |
WiredHome | 72:ecffe56af969 | 1841 | /// |
WiredHome | 72:ecffe56af969 | 1842 | /// Even though this is a 16-bit display, the stored image is in |
WiredHome | 72:ecffe56af969 | 1843 | /// 24-bit format. |
WiredHome | 72:ecffe56af969 | 1844 | /// |
WiredHome | 73:f22a18707b5e | 1845 | /// This method will interrogate the current display setting and |
WiredHome | 73:f22a18707b5e | 1846 | /// create a bitmap based on those settings. For instance, if |
WiredHome | 73:f22a18707b5e | 1847 | /// only layer 1 is visible, then the bitmap is only layer 1. However, |
WiredHome | 73:f22a18707b5e | 1848 | /// if there is some other operation in effect (transparent mode). |
WiredHome | 73:f22a18707b5e | 1849 | /// |
WiredHome | 72:ecffe56af969 | 1850 | /// @param[in] x is the left edge of the region to capture |
WiredHome | 72:ecffe56af969 | 1851 | /// @param[in] y is the top edge of the region to capture |
WiredHome | 72:ecffe56af969 | 1852 | /// @param[in] w is the width of the region to capture |
WiredHome | 72:ecffe56af969 | 1853 | /// @param[in] h is the height of the region to capture. |
WiredHome | 72:ecffe56af969 | 1854 | /// @param[out] Name_BMP is the filename to write the image to. |
WiredHome | 72:ecffe56af969 | 1855 | /// @return success or error code. |
WiredHome | 72:ecffe56af969 | 1856 | /// |
WiredHome | 72:ecffe56af969 | 1857 | RetCode_t PrintScreen(loc_t x, loc_t y, dim_t w, dim_t h, const char *Name_BMP); |
WiredHome | 72:ecffe56af969 | 1858 | |
WiredHome | 96:40b74dd3695b | 1859 | /// This method captures the specified area as a 24-bit bitmap file |
WiredHome | 96:40b74dd3695b | 1860 | /// and delivers it to the previously attached callback. |
WiredHome | 96:40b74dd3695b | 1861 | /// |
WiredHome | 96:40b74dd3695b | 1862 | /// Even though this is a 16-bit display, the stored image is in |
WiredHome | 96:40b74dd3695b | 1863 | /// 24-bit format. |
WiredHome | 96:40b74dd3695b | 1864 | /// |
WiredHome | 96:40b74dd3695b | 1865 | /// This method will interrogate the current display setting and |
WiredHome | 96:40b74dd3695b | 1866 | /// create a bitmap based on those settings. For instance, if |
WiredHome | 96:40b74dd3695b | 1867 | /// only layer 1 is visible, then the bitmap is only layer 1. However, |
WiredHome | 96:40b74dd3695b | 1868 | /// if there is some other operation in effect (transparent mode), it |
WiredHome | 96:40b74dd3695b | 1869 | /// will return the blended image. |
WiredHome | 96:40b74dd3695b | 1870 | /// |
WiredHome | 96:40b74dd3695b | 1871 | /// @param[in] x is the left edge of the region to capture |
WiredHome | 96:40b74dd3695b | 1872 | /// @param[in] y is the top edge of the region to capture |
WiredHome | 96:40b74dd3695b | 1873 | /// @param[in] w is the width of the region to capture |
WiredHome | 96:40b74dd3695b | 1874 | /// @param[in] h is the height of the region to capture. |
WiredHome | 96:40b74dd3695b | 1875 | /// @return success or error code. |
WiredHome | 96:40b74dd3695b | 1876 | /// |
WiredHome | 96:40b74dd3695b | 1877 | RetCode_t PrintScreen(loc_t x, loc_t y, dim_t w, dim_t h); |
WiredHome | 96:40b74dd3695b | 1878 | |
WiredHome | 96:40b74dd3695b | 1879 | /// PrintScreen callback registration. |
WiredHome | 96:40b74dd3695b | 1880 | /// |
WiredHome | 96:40b74dd3695b | 1881 | /// This method attaches a simple c-compatible callback of type PrintCallback_T. |
WiredHome | 96:40b74dd3695b | 1882 | /// Then, the PrintScreen(x,y,w,h) method is called. Each chunk of data in the |
WiredHome | 96:40b74dd3695b | 1883 | /// BMP file to be created is passed to this callback. |
WiredHome | 96:40b74dd3695b | 1884 | /// |
WiredHome | 96:40b74dd3695b | 1885 | /// @param callback is the callback function. |
WiredHome | 96:40b74dd3695b | 1886 | /// |
WiredHome | 96:40b74dd3695b | 1887 | void AttachPrintHandler(PrintCallback_T callback) { c_callback = callback; } |
WiredHome | 96:40b74dd3695b | 1888 | |
WiredHome | 96:40b74dd3695b | 1889 | /// PrintScreen callback registration. |
WiredHome | 96:40b74dd3695b | 1890 | /// |
WiredHome | 96:40b74dd3695b | 1891 | /// This method attaches a c++ class method as a callback of type PrintCallback_T. |
WiredHome | 96:40b74dd3695b | 1892 | /// Then, the PrintScreen(x,y,w,h) method is called. Each chunk of data in the |
WiredHome | 96:40b74dd3695b | 1893 | /// BMP file to be created is passed to this callback. |
WiredHome | 96:40b74dd3695b | 1894 | /// |
WiredHome | 96:40b74dd3695b | 1895 | /// @param object is the class hosting the callback function. |
WiredHome | 96:40b74dd3695b | 1896 | /// @param callback is the callback function. |
WiredHome | 96:40b74dd3695b | 1897 | /// |
WiredHome | 96:40b74dd3695b | 1898 | template <class T> |
WiredHome | 96:40b74dd3695b | 1899 | void AttachPrintHandler(T *object, RetCode_t (T::*member)(void)) { |
WiredHome | 96:40b74dd3695b | 1900 | obj_callback = (FPointerDummy *)item; |
WiredHome | 96:40b74dd3695b | 1901 | method_callback = (uint32_t (FPointerDummy::*)(uint32_t))method; |
WiredHome | 96:40b74dd3695b | 1902 | } |
WiredHome | 96:40b74dd3695b | 1903 | |
WiredHome | 72:ecffe56af969 | 1904 | /// This method captures the specified area as a 24-bit bitmap file, |
WiredHome | 72:ecffe56af969 | 1905 | /// including the option of layer selection. |
WiredHome | 72:ecffe56af969 | 1906 | /// |
WiredHome | 74:686faa218914 | 1907 | /// @caution This method is deprecated as the alternate PrintScreen API |
WiredHome | 74:686faa218914 | 1908 | /// automatically examines the display layer configuration. |
WiredHome | 74:686faa218914 | 1909 | /// Therefore, calls to this API will ignore the layer parameter |
WiredHome | 74:686faa218914 | 1910 | /// and automatically execute the other method. |
WiredHome | 74:686faa218914 | 1911 | /// |
WiredHome | 72:ecffe56af969 | 1912 | /// Even though this is a 16-bit display, the stored image is in |
WiredHome | 72:ecffe56af969 | 1913 | /// 24-bit format. |
WiredHome | 72:ecffe56af969 | 1914 | /// |
WiredHome | 72:ecffe56af969 | 1915 | /// @param[in] layer is 0 or 1 to select the layer to extract. |
WiredHome | 72:ecffe56af969 | 1916 | /// @param[in] x is the left edge of the region to capture |
WiredHome | 72:ecffe56af969 | 1917 | /// @param[in] y is the top edge of the region to capture |
WiredHome | 72:ecffe56af969 | 1918 | /// @param[in] w is the width of the region to capture |
WiredHome | 72:ecffe56af969 | 1919 | /// @param[in] h is the height of the region to capture. |
WiredHome | 72:ecffe56af969 | 1920 | /// @param[out] Name_BMP is the filename to write the image to. |
WiredHome | 72:ecffe56af969 | 1921 | /// @return success or error code. |
WiredHome | 72:ecffe56af969 | 1922 | /// |
WiredHome | 72:ecffe56af969 | 1923 | RetCode_t PrintScreen(uint16_t layer, loc_t x, loc_t y, dim_t w, dim_t h, const char *Name_BMP); |
WiredHome | 72:ecffe56af969 | 1924 | |
WiredHome | 57:bd53a9e165a1 | 1925 | |
WiredHome | 19:3f82c1161fd2 | 1926 | #ifdef PERF_METRICS |
WiredHome | 19:3f82c1161fd2 | 1927 | /// Clear the performance metrics to zero. |
WiredHome | 19:3f82c1161fd2 | 1928 | void ClearPerformance(); |
WiredHome | 19:3f82c1161fd2 | 1929 | |
WiredHome | 66:468a11f05580 | 1930 | /// Count idle time. |
WiredHome | 66:468a11f05580 | 1931 | /// |
WiredHome | 72:ecffe56af969 | 1932 | /// @param[in] t is the amount of idle time to accumulate. |
WiredHome | 66:468a11f05580 | 1933 | /// |
WiredHome | 66:468a11f05580 | 1934 | void CountIdleTime(uint32_t t); |
WiredHome | 66:468a11f05580 | 1935 | |
WiredHome | 19:3f82c1161fd2 | 1936 | /// Report the performance metrics for drawing functions using |
WiredHome | 41:2956a0a221e5 | 1937 | /// the available serial channel. |
WiredHome | 41:2956a0a221e5 | 1938 | /// |
WiredHome | 72:ecffe56af969 | 1939 | /// @param[in,out] pc is the serial channel to write to. |
WiredHome | 41:2956a0a221e5 | 1940 | /// |
WiredHome | 41:2956a0a221e5 | 1941 | void ReportPerformance(Serial & pc); |
WiredHome | 19:3f82c1161fd2 | 1942 | #endif |
WiredHome | 19:3f82c1161fd2 | 1943 | |
hexley | 54:e117ad10fba6 | 1944 | |
WiredHome | 19:3f82c1161fd2 | 1945 | private: |
hexley | 54:e117ad10fba6 | 1946 | /// Touch Panel register name definitions |
WiredHome | 77:9206c13aa527 | 1947 | #define TPCR0 0x70 |
WiredHome | 77:9206c13aa527 | 1948 | #define TPCR1 0x71 |
WiredHome | 77:9206c13aa527 | 1949 | #define TPXH 0x72 |
WiredHome | 77:9206c13aa527 | 1950 | #define TPYH 0x73 |
WiredHome | 77:9206c13aa527 | 1951 | #define TPXYL 0x74 |
WiredHome | 77:9206c13aa527 | 1952 | #define INTC1 0xF0 |
WiredHome | 77:9206c13aa527 | 1953 | #define INTC2 0xF1 |
hexley | 54:e117ad10fba6 | 1954 | |
hexley | 54:e117ad10fba6 | 1955 | /// Specify the default settings for the Touch Panel, where different from the chip defaults |
WiredHome | 77:9206c13aa527 | 1956 | #define TP_MODE_DEFAULT TP_MODE_AUTO |
WiredHome | 77:9206c13aa527 | 1957 | #define TP_DEBOUNCE_DEFAULT TP_DEBOUNCE_ON |
WiredHome | 77:9206c13aa527 | 1958 | #define TP_ADC_CLKDIV_DEFAULT TP_ADC_CLKDIV_8 |
hexley | 54:e117ad10fba6 | 1959 | |
WiredHome | 77:9206c13aa527 | 1960 | #define TP_ADC_SAMPLE_DEFAULT_CLKS TP_ADC_SAMPLE_8192_CLKS |
hexley | 54:e117ad10fba6 | 1961 | |
hexley | 54:e117ad10fba6 | 1962 | /// Other Touch Panel params |
WiredHome | 77:9206c13aa527 | 1963 | #define TPBUFSIZE 16 // Depth of the averaging buffers for x and y data |
hexley | 54:e117ad10fba6 | 1964 | |
WiredHome | 83:7bad0068cca0 | 1965 | // Needs both a ticker and a timer. (could have created a timer from the ticker, but this is easier). |
WiredHome | 83:7bad0068cca0 | 1966 | // on a touch, the timer is reset. |
WiredHome | 83:7bad0068cca0 | 1967 | // the ticker monitors the timer to see if it has been a long time since |
WiredHome | 83:7bad0068cca0 | 1968 | // a touch, and if so, it then clears the sample counter so it doesn't get partial old |
WiredHome | 83:7bad0068cca0 | 1969 | // and partial new. |
WiredHome | 83:7bad0068cca0 | 1970 | |
WiredHome | 83:7bad0068cca0 | 1971 | /// Touch State used by TouchPanelReadable. @see TouchCode_t. |
WiredHome | 83:7bad0068cca0 | 1972 | TouchCode_t touchState; |
WiredHome | 83:7bad0068cca0 | 1973 | |
WiredHome | 83:7bad0068cca0 | 1974 | /// Touch Panel ticker |
WiredHome | 83:7bad0068cca0 | 1975 | Ticker touchTicker; |
WiredHome | 83:7bad0068cca0 | 1976 | |
WiredHome | 83:7bad0068cca0 | 1977 | /// Touch Panel timer |
WiredHome | 83:7bad0068cca0 | 1978 | Timer touchTimer; |
WiredHome | 83:7bad0068cca0 | 1979 | |
WiredHome | 83:7bad0068cca0 | 1980 | /// keeps track of which sample we're collecting to filter out the noise. |
WiredHome | 83:7bad0068cca0 | 1981 | int touchSample; |
WiredHome | 83:7bad0068cca0 | 1982 | |
WiredHome | 83:7bad0068cca0 | 1983 | /// Private function for touch ticker callback. |
WiredHome | 83:7bad0068cca0 | 1984 | void _TouchTicker(void); |
WiredHome | 83:7bad0068cca0 | 1985 | |
WiredHome | 77:9206c13aa527 | 1986 | /// Touch Panel calibration matrix. |
WiredHome | 77:9206c13aa527 | 1987 | tpMatrix_t tpMatrix; |
hexley | 54:e117ad10fba6 | 1988 | |
WiredHome | 29:422616aa04bd | 1989 | /// Internal function to put a character using the built-in (internal) font engine |
WiredHome | 29:422616aa04bd | 1990 | /// |
WiredHome | 72:ecffe56af969 | 1991 | /// @param[in] is the character to put to the screen. |
WiredHome | 29:422616aa04bd | 1992 | /// @returns the character put. |
WiredHome | 29:422616aa04bd | 1993 | /// |
WiredHome | 29:422616aa04bd | 1994 | int _internal_putc(int c); |
WiredHome | 29:422616aa04bd | 1995 | |
WiredHome | 29:422616aa04bd | 1996 | /// Internal function to put a character using the external font engine |
WiredHome | 29:422616aa04bd | 1997 | /// |
WiredHome | 72:ecffe56af969 | 1998 | /// @param[in] is the character to put to the screen. |
WiredHome | 29:422616aa04bd | 1999 | /// @returns the character put. |
WiredHome | 29:422616aa04bd | 2000 | /// |
WiredHome | 29:422616aa04bd | 2001 | int _external_putc(int c); |
WiredHome | 29:422616aa04bd | 2002 | |
WiredHome | 19:3f82c1161fd2 | 2003 | /// Select the peripheral to use it. |
WiredHome | 19:3f82c1161fd2 | 2004 | /// |
WiredHome | 72:ecffe56af969 | 2005 | /// @param[in] chipsel when true will select the peripheral, and when false |
WiredHome | 19:3f82c1161fd2 | 2006 | /// will deselect the chip. This is the logical selection, and |
WiredHome | 19:3f82c1161fd2 | 2007 | /// the pin selection is the invert of this. |
WiredHome | 19:3f82c1161fd2 | 2008 | /// @returns success/failure code. @see RetCode_t. |
WiredHome | 19:3f82c1161fd2 | 2009 | /// |
WiredHome | 79:544eb4964795 | 2010 | RetCode_t _select(bool chipsel); |
WiredHome | 19:3f82c1161fd2 | 2011 | |
WiredHome | 66:468a11f05580 | 2012 | /// Wait while the status register indicates the controller is busy. |
WiredHome | 66:468a11f05580 | 2013 | /// |
WiredHome | 72:ecffe56af969 | 2014 | /// @param[in] mask is the mask of bits to monitor. |
WiredHome | 66:468a11f05580 | 2015 | /// @returns true if a normal exit. |
WiredHome | 66:468a11f05580 | 2016 | /// @returns false if a timeout exit. |
WiredHome | 66:468a11f05580 | 2017 | /// |
WiredHome | 66:468a11f05580 | 2018 | bool _WaitWhileBusy(uint8_t mask); |
WiredHome | 66:468a11f05580 | 2019 | |
WiredHome | 66:468a11f05580 | 2020 | /// Wait while the the register anded with the mask is true. |
WiredHome | 66:468a11f05580 | 2021 | /// |
WiredHome | 72:ecffe56af969 | 2022 | /// @param[in] reg is the register to monitor |
WiredHome | 72:ecffe56af969 | 2023 | /// @param[in] mask is the bit mask to monitor |
WiredHome | 66:468a11f05580 | 2024 | /// @returns true if it was a normal exit |
WiredHome | 66:468a11f05580 | 2025 | /// @returns false if it was a timeout that caused the exit. |
WiredHome | 66:468a11f05580 | 2026 | /// |
WiredHome | 66:468a11f05580 | 2027 | bool _WaitWhileReg(uint8_t reg, uint8_t mask); |
WiredHome | 66:468a11f05580 | 2028 | |
WiredHome | 68:ab08efabfc88 | 2029 | /// set the spi port to either the write or the read speed. |
WiredHome | 68:ab08efabfc88 | 2030 | /// |
WiredHome | 68:ab08efabfc88 | 2031 | /// This is a private API used to toggle between the write |
WiredHome | 68:ab08efabfc88 | 2032 | /// and the read speed for the SPI port to the RA8875, since |
WiredHome | 68:ab08efabfc88 | 2033 | /// it can accept writes faster than reads. |
WiredHome | 68:ab08efabfc88 | 2034 | /// |
WiredHome | 72:ecffe56af969 | 2035 | /// @param[in] writeSpeed when true selects the write frequency, |
WiredHome | 68:ab08efabfc88 | 2036 | /// and when false it selects the read frequency. |
WiredHome | 68:ab08efabfc88 | 2037 | /// |
WiredHome | 68:ab08efabfc88 | 2038 | void _setWriteSpeed(bool writeSpeed); |
WiredHome | 68:ab08efabfc88 | 2039 | |
WiredHome | 19:3f82c1161fd2 | 2040 | /// The most primitive - to write a data value to the SPI interface. |
WiredHome | 19:3f82c1161fd2 | 2041 | /// |
WiredHome | 72:ecffe56af969 | 2042 | /// @param[in] data is the value to write. |
WiredHome | 19:3f82c1161fd2 | 2043 | /// @returns a value read from the port, since SPI is often shift |
WiredHome | 19:3f82c1161fd2 | 2044 | /// in while shifting out. |
WiredHome | 19:3f82c1161fd2 | 2045 | /// |
WiredHome | 79:544eb4964795 | 2046 | unsigned char _spiwrite(unsigned char data); |
WiredHome | 19:3f82c1161fd2 | 2047 | |
WiredHome | 19:3f82c1161fd2 | 2048 | /// The most primitive - to read a data value to the SPI interface. |
WiredHome | 19:3f82c1161fd2 | 2049 | /// |
WiredHome | 19:3f82c1161fd2 | 2050 | /// This is really just a specialcase of the write command, where |
WiredHome | 19:3f82c1161fd2 | 2051 | /// the value zero is written in order to read. |
WiredHome | 19:3f82c1161fd2 | 2052 | /// |
WiredHome | 19:3f82c1161fd2 | 2053 | /// @returns a value read from the port, since SPI is often shift |
WiredHome | 19:3f82c1161fd2 | 2054 | /// in while shifting out. |
WiredHome | 19:3f82c1161fd2 | 2055 | /// |
WiredHome | 79:544eb4964795 | 2056 | unsigned char _spiread(); |
WiredHome | 19:3f82c1161fd2 | 2057 | |
WiredHome | 75:ca78388cfd77 | 2058 | const uint8_t * pKeyMap; |
WiredHome | 75:ca78388cfd77 | 2059 | |
WiredHome | 19:3f82c1161fd2 | 2060 | SPI spi; ///< spi port |
WiredHome | 68:ab08efabfc88 | 2061 | bool spiWriteSpeed; ///< indicates if the current mode is write or read |
WiredHome | 68:ab08efabfc88 | 2062 | unsigned long spiwritefreq; ///< saved write freq |
WiredHome | 66:468a11f05580 | 2063 | unsigned long spireadfreq; ///< saved read freq |
WiredHome | 19:3f82c1161fd2 | 2064 | DigitalOut cs; ///< chip select pin, assumed active low |
WiredHome | 19:3f82c1161fd2 | 2065 | DigitalOut res; ///< reset pin, assumed active low |
WiredHome | 90:d113d71ae4f0 | 2066 | |
WiredHome | 90:d113d71ae4f0 | 2067 | dim_t screenwidth; ///< configured screen width |
WiredHome | 90:d113d71ae4f0 | 2068 | dim_t screenheight; ///< configured screen height |
WiredHome | 90:d113d71ae4f0 | 2069 | bool portraitmode; ///< set true when in portrait mode (w,h are reversed) |
WiredHome | 90:d113d71ae4f0 | 2070 | |
WiredHome | 19:3f82c1161fd2 | 2071 | const unsigned char * font; ///< reference to an external font somewhere in memory |
WiredHome | 90:d113d71ae4f0 | 2072 | loc_t cursor_x, cursor_y; ///< used for external fonts only |
WiredHome | 19:3f82c1161fd2 | 2073 | |
WiredHome | 19:3f82c1161fd2 | 2074 | #ifdef PERF_METRICS |
WiredHome | 19:3f82c1161fd2 | 2075 | typedef enum |
WiredHome | 19:3f82c1161fd2 | 2076 | { |
WiredHome | 19:3f82c1161fd2 | 2077 | PRF_CLS, |
WiredHome | 41:2956a0a221e5 | 2078 | PRF_DRAWPIXEL, |
WiredHome | 41:2956a0a221e5 | 2079 | PRF_PIXELSTREAM, |
WiredHome | 41:2956a0a221e5 | 2080 | PRF_READPIXEL, |
WiredHome | 41:2956a0a221e5 | 2081 | PRF_READPIXELSTREAM, |
WiredHome | 19:3f82c1161fd2 | 2082 | PRF_DRAWLINE, |
WiredHome | 19:3f82c1161fd2 | 2083 | PRF_DRAWRECTANGLE, |
WiredHome | 19:3f82c1161fd2 | 2084 | PRF_DRAWROUNDEDRECTANGLE, |
WiredHome | 19:3f82c1161fd2 | 2085 | PRF_DRAWTRIANGLE, |
WiredHome | 19:3f82c1161fd2 | 2086 | PRF_DRAWCIRCLE, |
WiredHome | 19:3f82c1161fd2 | 2087 | PRF_DRAWELLIPSE, |
WiredHome | 19:3f82c1161fd2 | 2088 | METRICCOUNT |
WiredHome | 19:3f82c1161fd2 | 2089 | } method_e; |
WiredHome | 19:3f82c1161fd2 | 2090 | unsigned long metrics[METRICCOUNT]; |
WiredHome | 75:ca78388cfd77 | 2091 | unsigned long idletime_usec; |
WiredHome | 19:3f82c1161fd2 | 2092 | void RegisterPerformance(method_e method); |
WiredHome | 19:3f82c1161fd2 | 2093 | Timer performance; |
WiredHome | 19:3f82c1161fd2 | 2094 | #endif |
WiredHome | 96:40b74dd3695b | 2095 | |
WiredHome | 96:40b74dd3695b | 2096 | RetCode_t _printCallback(RA8875::filecmd_t cmd, uint8_t * buffer, uint16_t size); |
WiredHome | 96:40b74dd3695b | 2097 | |
WiredHome | 96:40b74dd3695b | 2098 | FILE * _printFH; ///< PrintScreen file handle |
WiredHome | 96:40b74dd3695b | 2099 | |
WiredHome | 96:40b74dd3695b | 2100 | RetCode_t privateCallback(filecmd_t cmd, uint8_t * buffer, uint16_t size) { |
WiredHome | 96:40b74dd3695b | 2101 | if (c_callback != NULL) { |
WiredHome | 96:40b74dd3695b | 2102 | return (*c_callback)(cmd, buffer, size); |
WiredHome | 96:40b74dd3695b | 2103 | } |
WiredHome | 96:40b74dd3695b | 2104 | else { |
WiredHome | 96:40b74dd3695b | 2105 | if (obj_callback != NULL && method_callback != NULL) { |
WiredHome | 96:40b74dd3695b | 2106 | return (obj_callback->*method_callback)(cmd, buffer, size); |
WiredHome | 96:40b74dd3695b | 2107 | } |
WiredHome | 96:40b74dd3695b | 2108 | } |
WiredHome | 96:40b74dd3695b | 2109 | return noerror; |
WiredHome | 96:40b74dd3695b | 2110 | } |
WiredHome | 96:40b74dd3695b | 2111 | |
WiredHome | 96:40b74dd3695b | 2112 | RetCode_t (* c_callback)(filecmd_t cmd, uint8_t * buffer, uint16_t size); |
WiredHome | 96:40b74dd3695b | 2113 | FPointerDummy *obj_callback; |
WiredHome | 96:40b74dd3695b | 2114 | RetCode_t (FPointerDummy::*method_callback)(filecmd_t cmd, uint8_t * buffer, uint16_t size); |
WiredHome | 19:3f82c1161fd2 | 2115 | }; |
WiredHome | 19:3f82c1161fd2 | 2116 | |
WiredHome | 96:40b74dd3695b | 2117 | |
WiredHome | 19:3f82c1161fd2 | 2118 | //} // namespace |
WiredHome | 19:3f82c1161fd2 | 2119 | |
WiredHome | 19:3f82c1161fd2 | 2120 | //using namespace SW_graphics; |
WiredHome | 19:3f82c1161fd2 | 2121 | |
WiredHome | 23:a50ded45dbaf | 2122 | |
WiredHome | 23:a50ded45dbaf | 2123 | #ifdef TESTENABLE |
WiredHome | 23:a50ded45dbaf | 2124 | // ______________ ______________ ______________ _______________ |
WiredHome | 23:a50ded45dbaf | 2125 | // /_____ _____/ / ___________/ / ___________/ /_____ ______/ |
WiredHome | 23:a50ded45dbaf | 2126 | // / / / / / / / / |
WiredHome | 23:a50ded45dbaf | 2127 | // / / / /___ / /__________ / / |
WiredHome | 23:a50ded45dbaf | 2128 | // / / / ____/ /__________ / / / |
WiredHome | 23:a50ded45dbaf | 2129 | // / / / / / / / / |
WiredHome | 23:a50ded45dbaf | 2130 | // / / / /__________ ___________/ / / / |
WiredHome | 23:a50ded45dbaf | 2131 | // /__/ /_____________/ /_____________/ /__/ |
WiredHome | 23:a50ded45dbaf | 2132 | |
WiredHome | 23:a50ded45dbaf | 2133 | #include "WebColors.h" |
WiredHome | 23:a50ded45dbaf | 2134 | #include <algorithm> |
WiredHome | 23:a50ded45dbaf | 2135 | |
WiredHome | 23:a50ded45dbaf | 2136 | extern "C" void mbed_reset(); |
WiredHome | 23:a50ded45dbaf | 2137 | |
WiredHome | 23:a50ded45dbaf | 2138 | /// This activates a small set of tests for the graphics library. |
WiredHome | 23:a50ded45dbaf | 2139 | /// |
WiredHome | 23:a50ded45dbaf | 2140 | /// Call this API and pass it the reference to the display class. |
WiredHome | 23:a50ded45dbaf | 2141 | /// It will then run a series of tests. It accepts interaction via |
WiredHome | 23:a50ded45dbaf | 2142 | /// stdin to switch from automatic test mode to manual, run a specific |
WiredHome | 23:a50ded45dbaf | 2143 | /// test, or to exit the test mode. |
WiredHome | 23:a50ded45dbaf | 2144 | /// |
WiredHome | 72:ecffe56af969 | 2145 | /// @param[in] lcd is a reference to the display class. |
WiredHome | 72:ecffe56af969 | 2146 | /// @param[in] pc is a reference to a serial interface, typically the USB to PC. |
WiredHome | 23:a50ded45dbaf | 2147 | /// |
WiredHome | 23:a50ded45dbaf | 2148 | void RunTestSet(RA8875 & lcd, Serial & pc); |
WiredHome | 23:a50ded45dbaf | 2149 | |
WiredHome | 23:a50ded45dbaf | 2150 | |
WiredHome | 23:a50ded45dbaf | 2151 | // To enable the test code, uncomment this section, or copy the |
WiredHome | 23:a50ded45dbaf | 2152 | // necessary pieces to your "main()". |
WiredHome | 23:a50ded45dbaf | 2153 | // |
WiredHome | 23:a50ded45dbaf | 2154 | // #include "mbed.h" |
WiredHome | 23:a50ded45dbaf | 2155 | // #include "RA8875.h" |
WiredHome | 23:a50ded45dbaf | 2156 | // RA8875 lcd(p5, p6, p7, p12, NC, "tft"); // MOSI, MISO, SCK, /ChipSelect, /reset, name |
WiredHome | 23:a50ded45dbaf | 2157 | // Serial pc(USBTX, USBRX); |
WiredHome | 23:a50ded45dbaf | 2158 | // extern "C" void mbed_reset(); |
WiredHome | 23:a50ded45dbaf | 2159 | // int main() |
WiredHome | 23:a50ded45dbaf | 2160 | // { |
WiredHome | 23:a50ded45dbaf | 2161 | // pc.baud(460800); // I like a snappy terminal, so crank it up! |
WiredHome | 23:a50ded45dbaf | 2162 | // pc.printf("\r\nRA8875 Test - Build " __DATE__ " " __TIME__ "\r\n"); |
WiredHome | 23:a50ded45dbaf | 2163 | // |
WiredHome | 23:a50ded45dbaf | 2164 | // pc.printf("Turning on display\r\n"); |
WiredHome | 23:a50ded45dbaf | 2165 | // lcd.Reset(); |
WiredHome | 23:a50ded45dbaf | 2166 | // lcd.Power(true); // display power is on, but the backlight is independent |
WiredHome | 23:a50ded45dbaf | 2167 | // lcd.Backlight(0.5); |
WiredHome | 23:a50ded45dbaf | 2168 | // RunTestSet(lcd, pc); |
WiredHome | 23:a50ded45dbaf | 2169 | // } |
WiredHome | 23:a50ded45dbaf | 2170 | |
WiredHome | 23:a50ded45dbaf | 2171 | #endif // TESTENABLE |
WiredHome | 23:a50ded45dbaf | 2172 | |
WiredHome | 56:7a85d226ad0d | 2173 | #endif |