KSM edits to RA8875

Dependents:   Liz_Test_Code

Committer:
WiredHome
Date:
Sun Jul 29 00:32:51 2018 +0000
Revision:
153:8a85efb3eb71
Parent:
152:a013ac0133e4
Child:
154:ad2450fc3dc3
Soft Fonts and very preliminary GIF support.

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