KSM edits to RA8875

Dependents:   Liz_Test_Code

Committer:
WiredHome
Date:
Mon Jun 12 22:15:08 2017 +0000
Revision:
147:3494792458d9
Parent:
144:ba002c4b21b3
Child:
149:c62c4b2d6a15
Improved the Intersect(rect_t, rect_t) to look for any intersection, and added an Intersect(rect_t *, rect_t *) which will identify and make available a new rect_t which is the intersection (if any).

Who changed what in which revision?

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