Library to control a Graphics TFT connected to 4-wire SPI - revised for the Raio RA8875 Display Controller.

Dependents:   FRDM_RA8875_mPaint RA8875_Demo RA8875_KeyPadDemo SignalGenerator ... more

Fork of SPI_TFT by Peter Drescher

See Components - RA8875 Based Display

Enhanced touch-screen support - where it previous supported both the Resistive Touch and Capacitive Touch based on the FT5206 Touch Controller, now it also has support for the GSL1680 Touch Controller.

Offline Help Manual (Windows chm)

/media/uploads/WiredHome/ra8875.zip.bin (download, rename to .zip and unzip)

Committer:
WiredHome
Date:
Mon Jul 25 10:55:58 2016 +0000
Revision:
123:2f45e80fec5f
Parent:
114:dbfb996bfbf3
Child:
124:1690a7ae871c
Added idle callback - when the RA8875 driver is stuck waiting on the HW, or on a long timeout, it can call an optional callback. This could be used for maintaining the Watchdog, or other activities.

Who changed what in which revision?

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