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:
Sun Nov 09 20:38:49 2014 +0000
Revision:
74:686faa218914
Parent:
73:f22a18707b5e
Child:
75:ca78388cfd77
Deprecated one of the PrintScreen methods based on improvements in the other method.

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