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:
Fri Nov 28 22:37:53 2014 +0000
Revision:
75:ca78388cfd77
Parent:
74:686faa218914
Child:
76:c981284eb513
Finalized the KeyPad support using the RA8875 built-in keyscan support.

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