Forked para SNOCC

Dependencies:   GPS

Dependents:   SNOCC_V1 SNOCC_V2

Fork of RA8875 by SNOCC

Committer:
WiredHome
Date:
Sun Dec 28 19:55:16 2014 +0000
Revision:
79:544eb4964795
Parent:
78:faf49c381591
Child:
81:01da2e34283d
cleaned up touch screen support, which included renaming the APIs to better reflect their purpose.; remove dead code, added documentation for methods that were missing it.; major refactor to the constructor, to move needed code to init().

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