KSM edits to RA8875

Dependents:   Liz_Test_Code

Committer:
WiredHome
Date:
Sun Jul 31 20:59:01 2016 +0000
Revision:
124:1690a7ae871c
Parent:
123:2f45e80fec5f
Child:
125:7a0b70f56550
Incorporated the Capacitive touch panel APIs in to the base RA8875 driver in a manner that integrated smoothly with the Resistive touch driver.

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