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