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

Dependents:   FRDM_RA8875_mPaint RA8875_Demo RA8875_KeyPadDemo SignalGenerator ... more

Fork of SPI_TFT by Peter Drescher

See Components - RA8875 Based Display

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

Offline Help Manual (Windows chm)

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

Committer:
WiredHome
Date:
Sat Oct 04 17:45:50 2014 +0000
Revision:
71:dcac8efd842d
Parent:
68:ab08efabfc88
Child:
72:ecffe56af969
Initial support for the key pad interface where the RA8875 scans the matrix.

Who changed what in which revision?

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