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

Dependents:   FRDM_RA8875_mPaint RA8875_Demo RA8875_KeyPadDemo SignalGenerator ... more

Fork of SPI_TFT by Peter Drescher

See Components - RA8875 Based Display

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

Offline Help Manual (Windows chm)

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

Committer:
WiredHome
Date:
Sun Jan 19 04:42:25 2014 +0000
Revision:
30:e0f2da88bdf6
Parent:
29:422616aa04bd
Child:
31:c72e12cd5c67
Warning reduction.

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 25:9556a3a9b7cc 7 #define RA8875_DEFAULT_SPI_FREQ 2000000
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 19:3f82c1161fd2 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 29:422616aa04bd 15 #define TESTENABLE
WiredHome 19:3f82c1161fd2 16
WiredHome 19:3f82c1161fd2 17 #define RGB(r,g,b) ( ((r<<8)&0xF800) | ((g<<3)&0x07E0) | (b>>3) )
WiredHome 19:3f82c1161fd2 18
WiredHome 19:3f82c1161fd2 19 /// DOS colors - slightly color enhanced
WiredHome 20:6e2e4a8372eb 20 #define Black (color_t)(RGB(0,0,0))
WiredHome 20:6e2e4a8372eb 21 #define Blue (color_t)(RGB(0,0,187))
WiredHome 20:6e2e4a8372eb 22 #define Green (color_t)(RGB(0,187,0))
WiredHome 20:6e2e4a8372eb 23 #define Cyan (color_t)(RGB(0,187,187))
WiredHome 20:6e2e4a8372eb 24 #define Red (color_t)(RGB(187,0,0))
WiredHome 20:6e2e4a8372eb 25 #define Magenta (color_t)(RGB(187,0,187))
WiredHome 20:6e2e4a8372eb 26 #define Brown (color_t)(RGB(187,187,0))
WiredHome 20:6e2e4a8372eb 27 #define Gray (color_t)(RGB(187,187,187))
WiredHome 20:6e2e4a8372eb 28 #define Charcoal (color_t)(RGB(85,85,85))
WiredHome 20:6e2e4a8372eb 29 #define BrightBlue (color_t)(RGB(85,85,255))
WiredHome 20:6e2e4a8372eb 30 #define BrightGreen (color_t)(RGB(85,255,85))
WiredHome 20:6e2e4a8372eb 31 #define BrightCyan (color_t)(RGB(85,255,255))
WiredHome 20:6e2e4a8372eb 32 #define Orange (color_t)(RGB(255,85,85))
WiredHome 20:6e2e4a8372eb 33 #define Pink (color_t)(RGB(255,85,255))
WiredHome 20:6e2e4a8372eb 34 #define Yellow (color_t)(RGB(255,255,85))
WiredHome 20:6e2e4a8372eb 35 #define White (color_t)(RGB(255,255,255))
WiredHome 20:6e2e4a8372eb 36
WiredHome 20:6e2e4a8372eb 37 #define BrightRed (color_t)(RGB(255,0,0))
WiredHome 19:3f82c1161fd2 38
WiredHome 19:3f82c1161fd2 39 //namespace SW_graphics
WiredHome 19:3f82c1161fd2 40 //{
WiredHome 19:3f82c1161fd2 41
WiredHome 19:3f82c1161fd2 42 /// color type definition to let the compiler help keep us honest.
WiredHome 19:3f82c1161fd2 43 ///
WiredHome 19:3f82c1161fd2 44 /// colors can be defined with the RGB(r,g,b) macro, and there
WiredHome 19:3f82c1161fd2 45 /// are a number of predefined colors:
WiredHome 19:3f82c1161fd2 46 /// - Black, Blue, Green, Cyan,
WiredHome 19:3f82c1161fd2 47 /// - Red, Magenta, Brown, Gray,
WiredHome 19:3f82c1161fd2 48 /// - Charcoal, BrightBlue, BrightGreen, BrightCyan,
WiredHome 19:3f82c1161fd2 49 /// - Orange, Pink, Yellow, White
WiredHome 19:3f82c1161fd2 50 ///
WiredHome 19:3f82c1161fd2 51 typedef uint16_t color_t;
WiredHome 19:3f82c1161fd2 52
WiredHome 19:3f82c1161fd2 53 /// background fill info for drawing Text, Rectangles, RoundedRectanges, Circles, Ellipses and Triangles.
WiredHome 19:3f82c1161fd2 54 typedef enum
WiredHome 19:3f82c1161fd2 55 {
WiredHome 19:3f82c1161fd2 56 NOFILL, ///< do not fill the object with the background color
WiredHome 19:3f82c1161fd2 57 FILL ///< fill the object space with the background color
WiredHome 19:3f82c1161fd2 58 } fill_t;
WiredHome 19:3f82c1161fd2 59
WiredHome 24:8ca861acf12d 60 /// cursor type to be shown as the text cursor.
WiredHome 24:8ca861acf12d 61 typedef enum
WiredHome 24:8ca861acf12d 62 {
WiredHome 24:8ca861acf12d 63 NOCURSOR, ///< cursor is hidden
WiredHome 24:8ca861acf12d 64 IBEAM, ///< | cursor
WiredHome 24:8ca861acf12d 65 UNDER, ///< _ cursor
WiredHome 24:8ca861acf12d 66 BLOCK ///< Block cursor
WiredHome 24:8ca861acf12d 67 } cursor_t;
WiredHome 24:8ca861acf12d 68
WiredHome 29:422616aa04bd 69 // return values from functions moved into TextDisplay.h
WiredHome 19:3f82c1161fd2 70 //typedef enum
WiredHome 19:3f82c1161fd2 71 //{
WiredHome 19:3f82c1161fd2 72 // noerror,
WiredHome 19:3f82c1161fd2 73 // bad_parameter
WiredHome 19:3f82c1161fd2 74 //} RetCode_t;
WiredHome 19:3f82c1161fd2 75
WiredHome 29:422616aa04bd 76
WiredHome 21:3c1efb192927 77 /// This is a graphics library for the Raio RA8875 Display Controller chip
WiredHome 21:3c1efb192927 78 /// attached to a 4-wire SPI interface.
WiredHome 21:3c1efb192927 79 ///
WiredHome 29:422616aa04bd 80 /// It offers both primitive and high level APIs.\\
WiredHome 21:3c1efb192927 81 /// Central to this API is a coordinate system, where the origin (0,0) is in
WiredHome 21:3c1efb192927 82 /// the top-left corner of the display, and the width extends positive to the
WiredHome 21:3c1efb192927 83 /// right and the height extends positive toward the bottom.
WiredHome 21:3c1efb192927 84 ///
WiredHome 21:3c1efb192927 85 /// As there are both graphics and text commands, one must take care to use
WiredHome 21:3c1efb192927 86 /// the proper coordinate system for each. Some of the text APIs are in units
WiredHome 29:422616aa04bd 87 /// of column and row, which is measured in character positions (and dependent
WiredHome 29:422616aa04bd 88 /// on the font size), and other text APIs permit pixel level positioning.
WiredHome 29:422616aa04bd 89 ///
WiredHome 29:422616aa04bd 90 /// @todo Add 2-Layer support.
WiredHome 29:422616aa04bd 91 /// @todo Find out why it can't shift frequency after constructor runs.
WiredHome 29:422616aa04bd 92 /// @todo Bitmap support.
WiredHome 29:422616aa04bd 93 /// @todo Add Hardware reset signal.
WiredHome 29:422616aa04bd 94 /// @todo Add Touch Screen support.
WiredHome 29:422616aa04bd 95 /// @todo Add Keypad Support.
WiredHome 29:422616aa04bd 96 /// @todo Add high level objects - x-y graph, meter, others...
WiredHome 21:3c1efb192927 97 ///
WiredHome 19:3f82c1161fd2 98 class RA8875 : public GraphicsDisplay
WiredHome 19:3f82c1161fd2 99 {
WiredHome 19:3f82c1161fd2 100 public:
WiredHome 19:3f82c1161fd2 101 /// font type selection.
WiredHome 19:3f82c1161fd2 102 typedef enum
WiredHome 19:3f82c1161fd2 103 {
WiredHome 19:3f82c1161fd2 104 ISO8859_1,
WiredHome 19:3f82c1161fd2 105 ISO8859_2,
WiredHome 19:3f82c1161fd2 106 ISO8859_3,
WiredHome 19:3f82c1161fd2 107 ISO8859_4
WiredHome 19:3f82c1161fd2 108 } font_t;
WiredHome 19:3f82c1161fd2 109
WiredHome 19:3f82c1161fd2 110 /// font rotation selection
WiredHome 19:3f82c1161fd2 111 typedef enum
WiredHome 19:3f82c1161fd2 112 {
WiredHome 19:3f82c1161fd2 113 normal,
WiredHome 19:3f82c1161fd2 114 rotated
WiredHome 19:3f82c1161fd2 115 } font_angle_t;
WiredHome 19:3f82c1161fd2 116
WiredHome 19:3f82c1161fd2 117 /// alignment
WiredHome 19:3f82c1161fd2 118 typedef enum
WiredHome 19:3f82c1161fd2 119 {
WiredHome 19:3f82c1161fd2 120 align_none,
WiredHome 19:3f82c1161fd2 121 align_full
WiredHome 19:3f82c1161fd2 122 } alignment_t;
WiredHome 19:3f82c1161fd2 123
WiredHome 19:3f82c1161fd2 124 /// Scale factor - 1, 2, 3 4
WiredHome 19:3f82c1161fd2 125 typedef unsigned int HorizontalScale;
WiredHome 19:3f82c1161fd2 126
WiredHome 19:3f82c1161fd2 127 /// Scale factor - 1, 2, 3, 4
WiredHome 19:3f82c1161fd2 128 typedef unsigned int VerticalScale;
WiredHome 19:3f82c1161fd2 129
WiredHome 19:3f82c1161fd2 130 /// Clear screen region
WiredHome 19:3f82c1161fd2 131 typedef enum
WiredHome 19:3f82c1161fd2 132 {
WiredHome 19:3f82c1161fd2 133 FULLWINDOW,
WiredHome 19:3f82c1161fd2 134 ACTIVEWINDOW
WiredHome 19:3f82c1161fd2 135 } Region_t;
WiredHome 19:3f82c1161fd2 136
WiredHome 19:3f82c1161fd2 137 /// Constructor for a display based on the RAiO RA8875
WiredHome 19:3f82c1161fd2 138 /// display controller.
WiredHome 19:3f82c1161fd2 139 ///
WiredHome 19:3f82c1161fd2 140 /// @param mosi is the SPI master out slave in pin on the mbed.
WiredHome 19:3f82c1161fd2 141 /// @param miso is the SPI master in slave out pin on the mbed.
WiredHome 19:3f82c1161fd2 142 /// @param sclk is the SPI shift clock pin on the mbed.
WiredHome 19:3f82c1161fd2 143 /// @param csel is the DigitalOut pin on the mbed to use as the
WiredHome 19:3f82c1161fd2 144 /// active low chip select for the display controller.
WiredHome 19:3f82c1161fd2 145 /// @param reset is the DigitalOut pin on the mbed to use as the
WiredHome 19:3f82c1161fd2 146 /// active low reset input on the display controller -
WiredHome 19:3f82c1161fd2 147 /// but this is not currently used.
WiredHome 19:3f82c1161fd2 148 /// @param name is a text name for this object, which will permit
WiredHome 19:3f82c1161fd2 149 /// capturing stdout and printf() directly to it.
WiredHome 19:3f82c1161fd2 150 ///
WiredHome 19:3f82c1161fd2 151 RA8875(PinName mosi, PinName miso, PinName sclk, PinName csel, PinName reset, const char * name = "lcd");
WiredHome 19:3f82c1161fd2 152
WiredHome 23:a50ded45dbaf 153 /// Destructor doesn't have much to do as this would typically be created
WiredHome 23:a50ded45dbaf 154 /// at startup, and not at runtime.
WiredHome 19:3f82c1161fd2 155 //~RA8875();
WiredHome 19:3f82c1161fd2 156
WiredHome 19:3f82c1161fd2 157 /// Write a command to the display
WiredHome 19:3f82c1161fd2 158 ///
WiredHome 19:3f82c1161fd2 159 /// This is a high level command, and may invoke several primitives.
WiredHome 19:3f82c1161fd2 160 ///
WiredHome 19:3f82c1161fd2 161 /// @param command is the command to write.
WiredHome 19:3f82c1161fd2 162 /// @data is optional data to be written to the command register
WiredHome 19:3f82c1161fd2 163 /// and only occurs if the data is in the range [0 - 0xFF].
WiredHome 19:3f82c1161fd2 164 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 165 ///
WiredHome 19:3f82c1161fd2 166 RetCode_t WriteCommand(unsigned char command, unsigned int data = 0xFFFF);
WiredHome 19:3f82c1161fd2 167
WiredHome 19:3f82c1161fd2 168 /// Write a data byte to the display
WiredHome 19:3f82c1161fd2 169 ///
WiredHome 19:3f82c1161fd2 170 /// This is a high level command, and may invoke several primitives.
WiredHome 19:3f82c1161fd2 171 ///
WiredHome 19:3f82c1161fd2 172 /// @param data is the data to write.
WiredHome 19:3f82c1161fd2 173 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 174 ///
WiredHome 19:3f82c1161fd2 175 RetCode_t WriteData(unsigned char data);
WiredHome 19:3f82c1161fd2 176
WiredHome 19:3f82c1161fd2 177 /// Read a command register
WiredHome 19:3f82c1161fd2 178 ///
WiredHome 19:3f82c1161fd2 179 /// @param command is the command register to read.
WiredHome 19:3f82c1161fd2 180 /// @returns the value read from the register.
WiredHome 19:3f82c1161fd2 181 ///
WiredHome 19:3f82c1161fd2 182 unsigned char ReadCommand(unsigned char command);
WiredHome 19:3f82c1161fd2 183
WiredHome 19:3f82c1161fd2 184 /// Read a data byte to the display
WiredHome 19:3f82c1161fd2 185 ///
WiredHome 19:3f82c1161fd2 186 /// This is a high level command, and may invoke several primitives.
WiredHome 19:3f82c1161fd2 187 ///
WiredHome 19:3f82c1161fd2 188 /// @returns data that was read.
WiredHome 19:3f82c1161fd2 189 ///
WiredHome 19:3f82c1161fd2 190 unsigned char ReadData(void);
WiredHome 19:3f82c1161fd2 191
WiredHome 19:3f82c1161fd2 192 /// Read the display status
WiredHome 19:3f82c1161fd2 193 ///
WiredHome 19:3f82c1161fd2 194 /// This is a high level command, and may invoke several primitives.
WiredHome 19:3f82c1161fd2 195 ///
WiredHome 19:3f82c1161fd2 196 /// @returns data that was read.
WiredHome 19:3f82c1161fd2 197 ///
WiredHome 19:3f82c1161fd2 198 unsigned char ReadStatus(void);
WiredHome 19:3f82c1161fd2 199
WiredHome 19:3f82c1161fd2 200 /// get the width in pixels of the currently active font
WiredHome 19:3f82c1161fd2 201 ///
WiredHome 19:3f82c1161fd2 202 /// @returns font width in pixels.
WiredHome 19:3f82c1161fd2 203 ///
WiredHome 19:3f82c1161fd2 204 unsigned int fontwidth(void);
WiredHome 19:3f82c1161fd2 205
WiredHome 19:3f82c1161fd2 206 /// get the height in pixels of the currently active font
WiredHome 19:3f82c1161fd2 207 ///
WiredHome 19:3f82c1161fd2 208 /// @returns font height in pixels.
WiredHome 19:3f82c1161fd2 209 ///
WiredHome 19:3f82c1161fd2 210 unsigned int fontheight(void);
WiredHome 19:3f82c1161fd2 211
WiredHome 19:3f82c1161fd2 212 /// get the number of colums based on the currently active font
WiredHome 19:3f82c1161fd2 213 ///
WiredHome 19:3f82c1161fd2 214 /// @returns number of columns.
WiredHome 19:3f82c1161fd2 215 ///
WiredHome 19:3f82c1161fd2 216 virtual int columns(void);
WiredHome 19:3f82c1161fd2 217
WiredHome 19:3f82c1161fd2 218 /// get the number of rows based on the currently active font
WiredHome 19:3f82c1161fd2 219 ///
WiredHome 19:3f82c1161fd2 220 /// @returns number of rows.
WiredHome 19:3f82c1161fd2 221 ///
WiredHome 19:3f82c1161fd2 222 virtual int rows(void);
WiredHome 19:3f82c1161fd2 223
WiredHome 19:3f82c1161fd2 224 /// get the screen width in pixels
WiredHome 19:3f82c1161fd2 225 ///
WiredHome 19:3f82c1161fd2 226 /// @returns screen width in pixels.
WiredHome 19:3f82c1161fd2 227 ///
WiredHome 19:3f82c1161fd2 228 virtual int width(void);
WiredHome 19:3f82c1161fd2 229
WiredHome 19:3f82c1161fd2 230 /// get the screen height in pixels
WiredHome 19:3f82c1161fd2 231 ///
WiredHome 19:3f82c1161fd2 232 /// @returns screen height in pixels.
WiredHome 19:3f82c1161fd2 233 ///
WiredHome 19:3f82c1161fd2 234 virtual int height(void);
WiredHome 19:3f82c1161fd2 235
WiredHome 19:3f82c1161fd2 236 /// Set cursor position based on the current font size.
WiredHome 19:3f82c1161fd2 237 ///
WiredHome 19:3f82c1161fd2 238 /// @param x is the horizontal position in character positions
WiredHome 19:3f82c1161fd2 239 /// @param y is the vertical position in character positions
WiredHome 19:3f82c1161fd2 240 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 241 ///
WiredHome 19:3f82c1161fd2 242 virtual RetCode_t locate(unsigned int x, unsigned int y);
WiredHome 19:3f82c1161fd2 243
WiredHome 19:3f82c1161fd2 244 /// Prepare the controller to write text to the screen by positioning
WiredHome 19:3f82c1161fd2 245 /// the cursor.
WiredHome 19:3f82c1161fd2 246 ///
WiredHome 19:3f82c1161fd2 247 /// @param x is the horizontal position in pixels (from the left edge)
WiredHome 19:3f82c1161fd2 248 /// @param y is the vertical position in pixels (from the top edge)
WiredHome 19:3f82c1161fd2 249 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 250 ///
WiredHome 19:3f82c1161fd2 251 RetCode_t SetTextCursor(unsigned int x, unsigned int y);
WiredHome 29:422616aa04bd 252
WiredHome 29:422616aa04bd 253 /// Get the current cursor horizontal position in pixels.
WiredHome 29:422616aa04bd 254 ///
WiredHome 29:422616aa04bd 255 /// @returns cursor position horizontal offset.
WiredHome 29:422616aa04bd 256 ///
WiredHome 29:422616aa04bd 257 unsigned int GetTextCursor_X(void);
WiredHome 29:422616aa04bd 258
WiredHome 29:422616aa04bd 259 /// Get the current cursor vertical position in pixels.
WiredHome 29:422616aa04bd 260 ///
WiredHome 29:422616aa04bd 261 /// @returns cursor position vertical offset.
WiredHome 29:422616aa04bd 262 ///
WiredHome 29:422616aa04bd 263 unsigned int GetTextCursor_Y(void);
WiredHome 29:422616aa04bd 264
WiredHome 23:a50ded45dbaf 265 /// Configure additional Cursor Control settings.
WiredHome 23:a50ded45dbaf 266 ///
WiredHome 23:a50ded45dbaf 267 /// This API lets you modify other cursor control settings;
WiredHome 23:a50ded45dbaf 268 /// Cursor visible/hidden, Cursor blink/normal,
WiredHome 23:a50ded45dbaf 269 /// Cursor I-Beam/underscore/box.
WiredHome 23:a50ded45dbaf 270 ///
WiredHome 24:8ca861acf12d 271 /// @param cursor can be set to NOCURSOR (default), IBEAM,
WiredHome 24:8ca861acf12d 272 /// UNDER, or BLOCK.
WiredHome 23:a50ded45dbaf 273 /// @param blink can be set to true or false (default false)
WiredHome 23:a50ded45dbaf 274 /// @returns success/failure code. @see RetCode_t
WiredHome 23:a50ded45dbaf 275 ///
WiredHome 24:8ca861acf12d 276 RetCode_t SetTextCursorControl(cursor_t cursor = NOCURSOR, bool blink = false);
WiredHome 23:a50ded45dbaf 277
WiredHome 19:3f82c1161fd2 278 /// Select the ISO 8859-X font to use next.
WiredHome 19:3f82c1161fd2 279 ///
WiredHome 19:3f82c1161fd2 280 /// Supported fonts: ISO 8859-1, -2, -3, -4
WiredHome 19:3f82c1161fd2 281 ///
WiredHome 19:3f82c1161fd2 282 /// @param font selects the font for the subsequent text rendering.
WiredHome 19:3f82c1161fd2 283 ///
WiredHome 19:3f82c1161fd2 284 /// @note if either hScale or vScale is outside of its permitted range,
WiredHome 19:3f82c1161fd2 285 /// the command is not executed.
WiredHome 19:3f82c1161fd2 286 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 287 ///
WiredHome 19:3f82c1161fd2 288 RetCode_t SetTextFont(font_t font = ISO8859_1);
WiredHome 19:3f82c1161fd2 289
WiredHome 19:3f82c1161fd2 290 /// Control the font behavior.
WiredHome 19:3f82c1161fd2 291 ///
WiredHome 19:3f82c1161fd2 292 /// This command lets you make several modifications to any text that
WiredHome 19:3f82c1161fd2 293 /// is written.
WiredHome 19:3f82c1161fd2 294 ///
WiredHome 19:3f82c1161fd2 295 /// Options can be combined:
WiredHome 19:3f82c1161fd2 296 /// Default:
WiredHome 19:3f82c1161fd2 297 /// @li Full alignment disabled,
WiredHome 19:3f82c1161fd2 298 /// @li Font with Background color,
WiredHome 19:3f82c1161fd2 299 /// @li Font in normal orientiation,
WiredHome 19:3f82c1161fd2 300 /// @li Horizontal scale x 1
WiredHome 19:3f82c1161fd2 301 /// @li Vertical scale x 1
WiredHome 19:3f82c1161fd2 302 /// @li alignment
WiredHome 19:3f82c1161fd2 303 ///
WiredHome 19:3f82c1161fd2 304 /// @param fillit defaults to FILL, but can be NOFILL
WiredHome 19:3f82c1161fd2 305 /// @param angle defaults to normal, but can be rotated
WiredHome 19:3f82c1161fd2 306 /// @param hScale defaults to 1, but can be 1, 2, 3, or 4,
WiredHome 19:3f82c1161fd2 307 /// and scales the font size by this amount.
WiredHome 19:3f82c1161fd2 308 /// @param vScale defaults to 1, but can be 1, 2, 3, or 4,
WiredHome 19:3f82c1161fd2 309 /// and scales the font size by this amount.
WiredHome 19:3f82c1161fd2 310 /// @param alignment defaults to align_none, but can be
WiredHome 19:3f82c1161fd2 311 /// align_full.
WiredHome 19:3f82c1161fd2 312 ///
WiredHome 19:3f82c1161fd2 313 /// @note if either hScale or vScale is outside of its permitted range,
WiredHome 19:3f82c1161fd2 314 /// the command is not executed.
WiredHome 19:3f82c1161fd2 315 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 316 ///
WiredHome 19:3f82c1161fd2 317 RetCode_t SetTextFontControl(fill_t fillit = FILL,
WiredHome 19:3f82c1161fd2 318 font_angle_t angle = normal,
WiredHome 19:3f82c1161fd2 319 HorizontalScale hScale = 1,
WiredHome 19:3f82c1161fd2 320 VerticalScale vScale = 1,
WiredHome 19:3f82c1161fd2 321 alignment_t alignment = align_none);
WiredHome 19:3f82c1161fd2 322
WiredHome 19:3f82c1161fd2 323 /// Control the font size
WiredHome 19:3f82c1161fd2 324 ///
WiredHome 19:3f82c1161fd2 325 /// This command lets you set the font enlargement for both horizontal
WiredHome 19:3f82c1161fd2 326 /// and vertical, independent of the rotation, background, and
WiredHome 19:3f82c1161fd2 327 /// alignment. @see SetTextFontControl.
WiredHome 19:3f82c1161fd2 328 ///
WiredHome 19:3f82c1161fd2 329 /// @param hScale defaults to 1, but can be 1, 2, 3, or 4,
WiredHome 19:3f82c1161fd2 330 /// and scales the font size by this amount.
WiredHome 19:3f82c1161fd2 331 /// @param vScale defaults to 1, but can be 1, 2, 3, or 4,
WiredHome 19:3f82c1161fd2 332 /// and scales the font size by this amount.
WiredHome 19:3f82c1161fd2 333 ///
WiredHome 19:3f82c1161fd2 334 /// @note if either hScale or vScale is outside of its permitted range,
WiredHome 19:3f82c1161fd2 335 /// the command is not executed.
WiredHome 19:3f82c1161fd2 336 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 337 ///
WiredHome 19:3f82c1161fd2 338 RetCode_t SetTextFontSize(HorizontalScale hScale = 1, VerticalScale vScale = 1);
WiredHome 19:3f82c1161fd2 339
WiredHome 19:3f82c1161fd2 340 /// put a character on the screen.
WiredHome 19:3f82c1161fd2 341 ///
WiredHome 19:3f82c1161fd2 342 /// @param c is the character.
WiredHome 19:3f82c1161fd2 343 /// @returns the character, or EOF if there is an error.
WiredHome 19:3f82c1161fd2 344 ///
WiredHome 19:3f82c1161fd2 345 virtual int _putc(int c);
WiredHome 19:3f82c1161fd2 346
WiredHome 19:3f82c1161fd2 347 /// Write string of text to the display
WiredHome 19:3f82c1161fd2 348 ///
WiredHome 19:3f82c1161fd2 349 /// @param string is the null terminated string to send to the display.
WiredHome 19:3f82c1161fd2 350 ///
WiredHome 19:3f82c1161fd2 351 void puts(const char * string);
WiredHome 19:3f82c1161fd2 352
WiredHome 19:3f82c1161fd2 353 /// Write string of text to the display at the specified location.
WiredHome 19:3f82c1161fd2 354 ///
WiredHome 19:3f82c1161fd2 355 /// @param x is the horizontal position in pixels (from the left edge)
WiredHome 19:3f82c1161fd2 356 /// @param y is the vertical position in pixels (from the top edge)
WiredHome 19:3f82c1161fd2 357 /// @param string is the null terminated string to send to the display.
WiredHome 19:3f82c1161fd2 358 ///
WiredHome 19:3f82c1161fd2 359 void puts(unsigned int x, unsigned int y, const char * string);
WiredHome 19:3f82c1161fd2 360
WiredHome 19:3f82c1161fd2 361 /// Prepare the controller to write binary data to the screen by positioning
WiredHome 19:3f82c1161fd2 362 /// the memory cursor.
WiredHome 19:3f82c1161fd2 363 ///
WiredHome 19:3f82c1161fd2 364 /// @param x is the horizontal position in pixels (from the left edge)
WiredHome 19:3f82c1161fd2 365 /// @param y is the vertical position in pixels (from the top edge)
WiredHome 19:3f82c1161fd2 366 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 367 ///
WiredHome 19:3f82c1161fd2 368 RetCode_t SetMemoryCursor(unsigned int x, unsigned int y);
WiredHome 19:3f82c1161fd2 369
WiredHome 19:3f82c1161fd2 370 /// Set the window, which controls where items are written to the screen.
WiredHome 19:3f82c1161fd2 371 ///
WiredHome 19:3f82c1161fd2 372 /// When something hits the window width, it wraps back to the left side
WiredHome 19:3f82c1161fd2 373 /// and down a row. If the initial write is outside the window, it will
WiredHome 19:3f82c1161fd2 374 /// be captured into the window when it crosses a boundary.
WiredHome 19:3f82c1161fd2 375 ///
WiredHome 19:3f82c1161fd2 376 /// @param x is the left edge in pixels.
WiredHome 19:3f82c1161fd2 377 /// @param y is the top edge in pixels.
WiredHome 19:3f82c1161fd2 378 /// @param width is the window width in pixels.
WiredHome 19:3f82c1161fd2 379 /// @param height is the window height in pixels.
WiredHome 19:3f82c1161fd2 380 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 381 ///
WiredHome 19:3f82c1161fd2 382 RetCode_t SetWindow(unsigned int x, unsigned int y, unsigned int width, unsigned int height);
WiredHome 19:3f82c1161fd2 383
WiredHome 19:3f82c1161fd2 384 /// Clear the screen.
WiredHome 19:3f82c1161fd2 385 ///
WiredHome 19:3f82c1161fd2 386 /// The behavior is to clear the whole screen. @see clsw().
WiredHome 19:3f82c1161fd2 387 ///
WiredHome 19:3f82c1161fd2 388 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 389 ///
WiredHome 19:3f82c1161fd2 390 virtual RetCode_t cls(void);
WiredHome 19:3f82c1161fd2 391
WiredHome 19:3f82c1161fd2 392 /// Clear the screen, or clear only the active window.
WiredHome 19:3f82c1161fd2 393 ///
WiredHome 19:3f82c1161fd2 394 /// The default behavior is to clear the whole screen. With the optional
WiredHome 19:3f82c1161fd2 395 /// parameter, the action can be restricted to the active window, which
WiredHome 19:3f82c1161fd2 396 /// can be set with the @see SetWindow method.
WiredHome 19:3f82c1161fd2 397 ///
WiredHome 19:3f82c1161fd2 398 /// @param region is an optional parameter that defaults to FULLWINDOW
WiredHome 19:3f82c1161fd2 399 /// or may be set to ACTIVEWINDOW.
WiredHome 19:3f82c1161fd2 400 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 401 ///
WiredHome 19:3f82c1161fd2 402 RetCode_t clsw(RA8875::Region_t region = FULLWINDOW);
WiredHome 19:3f82c1161fd2 403
WiredHome 19:3f82c1161fd2 404 /// Set the background color.
WiredHome 19:3f82c1161fd2 405 ///
WiredHome 19:3f82c1161fd2 406 /// @param color is expressed in 16-bit format.
WiredHome 19:3f82c1161fd2 407 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 408 ///
WiredHome 19:3f82c1161fd2 409 virtual RetCode_t background(color_t color);
WiredHome 19:3f82c1161fd2 410
WiredHome 19:3f82c1161fd2 411 /// Set the background color.
WiredHome 19:3f82c1161fd2 412 ///
WiredHome 19:3f82c1161fd2 413 /// @param r is the red element of the color.
WiredHome 19:3f82c1161fd2 414 /// @param g is the green element of the color.
WiredHome 19:3f82c1161fd2 415 /// @param b is the blue element of the color.
WiredHome 19:3f82c1161fd2 416 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 417 ///
WiredHome 19:3f82c1161fd2 418 virtual RetCode_t background(unsigned char r, unsigned char g, unsigned char b);
WiredHome 19:3f82c1161fd2 419
WiredHome 19:3f82c1161fd2 420 /// Set the foreground color.
WiredHome 19:3f82c1161fd2 421 ///
WiredHome 19:3f82c1161fd2 422 /// @param color is expressed in 16-bit format.
WiredHome 19:3f82c1161fd2 423 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 424 ///
WiredHome 19:3f82c1161fd2 425 virtual RetCode_t foreground(color_t color);
WiredHome 19:3f82c1161fd2 426
WiredHome 19:3f82c1161fd2 427 /// Set the foreground color.
WiredHome 19:3f82c1161fd2 428 ///
WiredHome 19:3f82c1161fd2 429 /// @param R is the red element of the color.
WiredHome 19:3f82c1161fd2 430 /// @param G is the green element of the color.
WiredHome 19:3f82c1161fd2 431 /// @param B is the blue element of the color.
WiredHome 19:3f82c1161fd2 432 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 433 ///
WiredHome 19:3f82c1161fd2 434 virtual RetCode_t foreground(unsigned char R, unsigned char G, unsigned char B);
WiredHome 19:3f82c1161fd2 435
WiredHome 19:3f82c1161fd2 436 /// Get the current foreground color value.
WiredHome 19:3f82c1161fd2 437 ///
WiredHome 19:3f82c1161fd2 438 /// @returns the current foreground color.
WiredHome 19:3f82c1161fd2 439 ///
WiredHome 19:3f82c1161fd2 440 unsigned int GetForeColor(void);
WiredHome 19:3f82c1161fd2 441
WiredHome 19:3f82c1161fd2 442 /// Draw a pixel in the specified color.
WiredHome 19:3f82c1161fd2 443 ///
WiredHome 19:3f82c1161fd2 444 /// @note As a side effect, this also sets the foreground color
WiredHome 19:3f82c1161fd2 445 /// affecting all subsequent operations.
WiredHome 19:3f82c1161fd2 446 ///
WiredHome 19:3f82c1161fd2 447 /// @param x is the horizontal offset to this pixel.
WiredHome 19:3f82c1161fd2 448 /// @param y is the vertical offset to this pixel.
WiredHome 19:3f82c1161fd2 449 /// @param color defines the color for the pixel.
WiredHome 19:3f82c1161fd2 450 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 451 ///
WiredHome 19:3f82c1161fd2 452 virtual RetCode_t pixel(unsigned int x, unsigned int y, color_t color);
WiredHome 19:3f82c1161fd2 453
WiredHome 19:3f82c1161fd2 454 /// Draw a pixel in the current foreground color.
WiredHome 19:3f82c1161fd2 455 ///
WiredHome 19:3f82c1161fd2 456 /// @param x is the horizontal offset to this pixel.
WiredHome 19:3f82c1161fd2 457 /// @param y is the veritical offset to this pixel.
WiredHome 19:3f82c1161fd2 458 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 459 ///
WiredHome 19:3f82c1161fd2 460 virtual RetCode_t pixel(unsigned int x, unsigned int y);
WiredHome 19:3f82c1161fd2 461
WiredHome 19:3f82c1161fd2 462 /// Draw a line in the specified color
WiredHome 19:3f82c1161fd2 463 ///
WiredHome 19:3f82c1161fd2 464 /// @note As a side effect, this changes the current
WiredHome 19:3f82c1161fd2 465 /// foreground color for subsequent operations.
WiredHome 19:3f82c1161fd2 466 ///
WiredHome 19:3f82c1161fd2 467 /// @param x1 is the horizontal start of the line.
WiredHome 19:3f82c1161fd2 468 /// @param y1 is the vertical start of the line.
WiredHome 19:3f82c1161fd2 469 /// @param x2 is the horizontal end of the line.
WiredHome 19:3f82c1161fd2 470 /// @param y2 is the vertical end of the line.
WiredHome 19:3f82c1161fd2 471 /// @param color defines the foreground color.
WiredHome 19:3f82c1161fd2 472 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 473 ///
WiredHome 19:3f82c1161fd2 474 RetCode_t line(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2,
WiredHome 19:3f82c1161fd2 475 color_t color);
WiredHome 19:3f82c1161fd2 476
WiredHome 19:3f82c1161fd2 477 /// Draw a line
WiredHome 19:3f82c1161fd2 478 ///
WiredHome 19:3f82c1161fd2 479 /// Draws a line using the foreground color setting.
WiredHome 19:3f82c1161fd2 480 ///
WiredHome 19:3f82c1161fd2 481 /// @param x1 is the horizontal start of the line.
WiredHome 19:3f82c1161fd2 482 /// @param y1 is the vertical start of the line.
WiredHome 19:3f82c1161fd2 483 /// @param x2 is the horizontal end of the line.
WiredHome 19:3f82c1161fd2 484 /// @param y2 is the vertical end of the line.
WiredHome 19:3f82c1161fd2 485 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 486 ///
WiredHome 19:3f82c1161fd2 487 RetCode_t line(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2);
WiredHome 19:3f82c1161fd2 488
WiredHome 19:3f82c1161fd2 489 /// Draw a rectangle in the specified color
WiredHome 19:3f82c1161fd2 490 ///
WiredHome 19:3f82c1161fd2 491 /// @note As a side effect, this changes the current
WiredHome 19:3f82c1161fd2 492 /// foreground color for subsequent operations.
WiredHome 19:3f82c1161fd2 493 ///
WiredHome 19:3f82c1161fd2 494 /// @param x1 is the horizontal start of the line.
WiredHome 19:3f82c1161fd2 495 /// @param y1 is the vertical start of the line.
WiredHome 19:3f82c1161fd2 496 /// @param x2 is the horizontal end of the line.
WiredHome 19:3f82c1161fd2 497 /// @param y2 is the vertical end of the line.
WiredHome 19:3f82c1161fd2 498 /// @param color defines the foreground color.
WiredHome 19:3f82c1161fd2 499 /// @param fillit is optional to FILL the rectangle. default is NOFILL.
WiredHome 19:3f82c1161fd2 500 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 501 ///
WiredHome 19:3f82c1161fd2 502 RetCode_t rect(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2,
WiredHome 19:3f82c1161fd2 503 color_t color, fill_t fillit = NOFILL);
WiredHome 19:3f82c1161fd2 504
WiredHome 19:3f82c1161fd2 505 /// Draw a filled rectangle in the specified color
WiredHome 19:3f82c1161fd2 506 ///
WiredHome 19:3f82c1161fd2 507 /// @note As a side effect, this changes the current
WiredHome 19:3f82c1161fd2 508 /// foreground color for subsequent operations.
WiredHome 19:3f82c1161fd2 509 ///
WiredHome 19:3f82c1161fd2 510 /// @param x1 is the horizontal start of the line.
WiredHome 19:3f82c1161fd2 511 /// @param y1 is the vertical start of the line.
WiredHome 19:3f82c1161fd2 512 /// @param x2 is the horizontal end of the line.
WiredHome 19:3f82c1161fd2 513 /// @param y2 is the vertical end of the line.
WiredHome 19:3f82c1161fd2 514 /// @param color defines the foreground color.
WiredHome 19:3f82c1161fd2 515 /// @param fillit is optional to NOFILL the rectangle. default is FILL.
WiredHome 19:3f82c1161fd2 516 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 517 ///
WiredHome 19:3f82c1161fd2 518 RetCode_t fillrect(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2,
WiredHome 19:3f82c1161fd2 519 color_t color, fill_t fillit = FILL);
WiredHome 19:3f82c1161fd2 520
WiredHome 19:3f82c1161fd2 521 /// Draw a rectangle
WiredHome 19:3f82c1161fd2 522 ///
WiredHome 19:3f82c1161fd2 523 /// Draws a rectangle using the foreground color setting.
WiredHome 19:3f82c1161fd2 524 ///
WiredHome 19:3f82c1161fd2 525 /// @param x1 is the horizontal start of the line.
WiredHome 19:3f82c1161fd2 526 /// @param y1 is the vertical start of the line.
WiredHome 19:3f82c1161fd2 527 /// @param x2 is the horizontal end of the line.
WiredHome 19:3f82c1161fd2 528 /// @param y2 is the vertical end of the line.
WiredHome 19:3f82c1161fd2 529 /// @param fillit is optional to FILL the rectangle. default is NOFILL.
WiredHome 19:3f82c1161fd2 530 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 531 ///
WiredHome 19:3f82c1161fd2 532 RetCode_t rect(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2,
WiredHome 19:3f82c1161fd2 533 fill_t fillit = NOFILL);
WiredHome 19:3f82c1161fd2 534
WiredHome 19:3f82c1161fd2 535 /// Draw a filled rectangle with rounded corners using the specified color.
WiredHome 19:3f82c1161fd2 536 ///
WiredHome 21:3c1efb192927 537 /// This draws a rounded rectangle. A numbers of checks are made on the values,
WiredHome 21:3c1efb192927 538 /// and it could reduce this to drawing a line (if either x1 == x2, or y1 == y2),
WiredHome 21:3c1efb192927 539 /// or a single point (x1 == x2 && y1 == y2). If the radius parameters are
WiredHome 21:3c1efb192927 540 /// > 1/2 the length of that side (width or height), an error value is returned.
WiredHome 21:3c1efb192927 541 ///
WiredHome 19:3f82c1161fd2 542 /// @note As a side effect, this changes the current
WiredHome 19:3f82c1161fd2 543 /// foreground color for subsequent operations.
WiredHome 19:3f82c1161fd2 544 ///
WiredHome 21:3c1efb192927 545 /// @param x1 is the horizontal start of the line and must be <= x2.
WiredHome 21:3c1efb192927 546 /// @param y1 is the vertical start of the line and must be <= y2.
WiredHome 21:3c1efb192927 547 /// @param x2 is the horizontal end of the line and must be >= x1.
WiredHome 21:3c1efb192927 548 /// @param y2 is the vertical end of the line and must be >= y1.
WiredHome 22:f6ea795eb541 549 /// @param radius1 defines the horizontal radius of the curved corner. Take care
WiredHome 21:3c1efb192927 550 /// that this value < 1/2 the width of the rectangle, or bad_parameter
WiredHome 21:3c1efb192927 551 /// is returned.
WiredHome 22:f6ea795eb541 552 /// @param radius2 defines the vertical radius of the curved corner. Take care
WiredHome 21:3c1efb192927 553 /// that this value < 1/2 the height of the rectangle, or bad_parameter
WiredHome 21:3c1efb192927 554 /// is returned.
WiredHome 19:3f82c1161fd2 555 /// @param color defines the foreground color.
WiredHome 19:3f82c1161fd2 556 /// @param fillit is optional to FILL the rectangle. default is NOFILL.
WiredHome 19:3f82c1161fd2 557 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 558 ///
WiredHome 19:3f82c1161fd2 559 RetCode_t fillroundrect(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2,
WiredHome 19:3f82c1161fd2 560 unsigned int radius1, unsigned int radius2, color_t color, fill_t fillit = FILL);
WiredHome 19:3f82c1161fd2 561
WiredHome 19:3f82c1161fd2 562 /// Draw a rectangle with rounded corners using the specified color.
WiredHome 19:3f82c1161fd2 563 ///
WiredHome 21:3c1efb192927 564 /// This draws a rounded rectangle. A numbers of checks are made on the values,
WiredHome 21:3c1efb192927 565 /// and it could reduce this to drawing a line (if either x1 == x2, or y1 == y2),
WiredHome 21:3c1efb192927 566 /// or a single point (x1 == x2 && y1 == y2). If the radius parameters are
WiredHome 21:3c1efb192927 567 /// > 1/2 the length of that side (width or height), an error value is returned.
WiredHome 21:3c1efb192927 568 ///
WiredHome 19:3f82c1161fd2 569 /// @note As a side effect, this changes the current
WiredHome 19:3f82c1161fd2 570 /// foreground color for subsequent operations.
WiredHome 19:3f82c1161fd2 571 ///
WiredHome 21:3c1efb192927 572 /// @param x1 is the horizontal start of the line and must be <= x2.
WiredHome 21:3c1efb192927 573 /// @param y1 is the vertical start of the line and must be <= y2.
WiredHome 21:3c1efb192927 574 /// @param x2 is the horizontal end of the line and must be >= x1.
WiredHome 21:3c1efb192927 575 /// @param y2 is the vertical end of the line and must be >= y1.
WiredHome 22:f6ea795eb541 576 /// @param radius1 defines the horizontal radius of the curved corner. Take care
WiredHome 21:3c1efb192927 577 /// that this value < 1/2 the width of the rectangle, or bad_parameter
WiredHome 21:3c1efb192927 578 /// is returned.
WiredHome 22:f6ea795eb541 579 /// @param radius2 defines the vertical radius of the curved corner. Take care
WiredHome 21:3c1efb192927 580 /// that this value < 1/2 the height of the rectangle, or bad_parameter
WiredHome 21:3c1efb192927 581 /// is returned.
WiredHome 19:3f82c1161fd2 582 /// @param color defines the foreground color.
WiredHome 19:3f82c1161fd2 583 /// @param fillit is optional to FILL the rectangle. default is NOFILL.
WiredHome 19:3f82c1161fd2 584 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 585 ///
WiredHome 19:3f82c1161fd2 586 RetCode_t roundrect(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2,
WiredHome 19:3f82c1161fd2 587 unsigned int radius1, unsigned int radius2, color_t color, fill_t fillit = NOFILL);
WiredHome 19:3f82c1161fd2 588
WiredHome 19:3f82c1161fd2 589 /// Draw a rectangle with rounded corners.
WiredHome 19:3f82c1161fd2 590 ///
WiredHome 21:3c1efb192927 591 /// This draws a rounded rectangle. A numbers of checks are made on the values,
WiredHome 21:3c1efb192927 592 /// and it could reduce this to drawing a line (if either x1 == x2, or y1 == y2),
WiredHome 21:3c1efb192927 593 /// or a single point (x1 == x2 && y1 == y2). If the radius parameters are
WiredHome 21:3c1efb192927 594 /// > 1/2 the length of that side (width or height), an error value is returned.
WiredHome 19:3f82c1161fd2 595 ///
WiredHome 21:3c1efb192927 596 /// @param x1 is the horizontal start of the line and must be <= x2.
WiredHome 21:3c1efb192927 597 /// @param y1 is the vertical start of the line and must be <= y2.
WiredHome 21:3c1efb192927 598 /// @param x2 is the horizontal end of the line and must be >= x1.
WiredHome 21:3c1efb192927 599 /// @param y2 is the vertical end of the line and must be >= y1.
WiredHome 22:f6ea795eb541 600 /// @param radius1 defines the horizontal radius of the curved corner. Take care
WiredHome 21:3c1efb192927 601 /// that this value < 1/2 the width of the rectangle, or bad_parameter
WiredHome 21:3c1efb192927 602 /// is returned.
WiredHome 22:f6ea795eb541 603 /// @param radius2 defines the vertical radius of the curved corner. Take care
WiredHome 21:3c1efb192927 604 /// that this value < 1/2 the height of the rectangle, or bad_parameter
WiredHome 21:3c1efb192927 605 /// is returned.
WiredHome 19:3f82c1161fd2 606 /// @param fillit is optional to FILL the rectangle. default is NOFILL.
WiredHome 19:3f82c1161fd2 607 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 608 ///
WiredHome 19:3f82c1161fd2 609 RetCode_t roundrect(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2,
WiredHome 19:3f82c1161fd2 610 unsigned int radius1, unsigned int radius2, fill_t fillit = NOFILL);
WiredHome 19:3f82c1161fd2 611
WiredHome 19:3f82c1161fd2 612 /// Draw a triangle in the specified color.
WiredHome 19:3f82c1161fd2 613 ///
WiredHome 19:3f82c1161fd2 614 /// @note As a side effect, this changes the current
WiredHome 19:3f82c1161fd2 615 /// foreground color for subsequent operations.
WiredHome 19:3f82c1161fd2 616 ///
WiredHome 19:3f82c1161fd2 617 /// @param x1 is the horizontal for point 1.
WiredHome 21:3c1efb192927 618 /// @param y1 is the vertical for point 1.
WiredHome 19:3f82c1161fd2 619 /// @param x2 is the horizontal for point 2.
WiredHome 19:3f82c1161fd2 620 /// @param y2 is the vertical for point 2.
WiredHome 19:3f82c1161fd2 621 /// @param x3 is the horizontal for point 3.
WiredHome 19:3f82c1161fd2 622 /// @param y3 is the vertical for point 3.
WiredHome 19:3f82c1161fd2 623 /// @param color defines the foreground color.
WiredHome 19:3f82c1161fd2 624 /// @param fillit is optional to FILL the rectangle. default is NOFILL.
WiredHome 19:3f82c1161fd2 625 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 626 ///
WiredHome 19:3f82c1161fd2 627 RetCode_t triangle(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2,
WiredHome 19:3f82c1161fd2 628 unsigned int x3, unsigned int y3, color_t color, fill_t fillit = NOFILL);
WiredHome 19:3f82c1161fd2 629
WiredHome 19:3f82c1161fd2 630 /// Draw a filled triangle in the specified color.
WiredHome 19:3f82c1161fd2 631 ///
WiredHome 19:3f82c1161fd2 632 /// @note As a side effect, this changes the current
WiredHome 19:3f82c1161fd2 633 /// foreground color for subsequent operations.
WiredHome 19:3f82c1161fd2 634 ///
WiredHome 19:3f82c1161fd2 635 /// @param x1 is the horizontal for point 1.
WiredHome 19:3f82c1161fd2 636 /// @param y1 is the vertical for point 1.
WiredHome 19:3f82c1161fd2 637 /// @param x2 is the horizontal for point 2.
WiredHome 19:3f82c1161fd2 638 /// @param y2 is the vertical for point 2.
WiredHome 19:3f82c1161fd2 639 /// @param x3 is the horizontal for point 3.
WiredHome 19:3f82c1161fd2 640 /// @param y3 is the vertical for point 3.
WiredHome 19:3f82c1161fd2 641 /// @param color defines the foreground color.
WiredHome 19:3f82c1161fd2 642 /// @param fillit is optional to FILL the rectangle. default is NOFILL.
WiredHome 19:3f82c1161fd2 643 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 644 ///
WiredHome 19:3f82c1161fd2 645 RetCode_t filltriangle(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2,
WiredHome 19:3f82c1161fd2 646 unsigned int x3, unsigned int y3, color_t color, fill_t fillit = FILL);
WiredHome 19:3f82c1161fd2 647
WiredHome 19:3f82c1161fd2 648 /// Draw a triangle
WiredHome 19:3f82c1161fd2 649 ///
WiredHome 19:3f82c1161fd2 650 /// Draws a triangle using the foreground color setting.
WiredHome 19:3f82c1161fd2 651 ///
WiredHome 19:3f82c1161fd2 652 /// @param x1 is the horizontal for point 1.
WiredHome 19:3f82c1161fd2 653 /// @param y1 is the vertical for point 1.
WiredHome 19:3f82c1161fd2 654 /// @param x2 is the horizontal for point 2.
WiredHome 19:3f82c1161fd2 655 /// @param y2 is the vertical for point 2.
WiredHome 19:3f82c1161fd2 656 /// @param x3 is the horizontal for point 3.
WiredHome 19:3f82c1161fd2 657 /// @param y3 is the vertical for point 3.
WiredHome 19:3f82c1161fd2 658 /// @param fillit is optional to FILL the rectangle. default is NOFILL.
WiredHome 19:3f82c1161fd2 659 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 660 ///
WiredHome 19:3f82c1161fd2 661 RetCode_t triangle(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2,
WiredHome 19:3f82c1161fd2 662 unsigned int x3, unsigned int y3, fill_t fillit = NOFILL);
WiredHome 19:3f82c1161fd2 663
WiredHome 19:3f82c1161fd2 664 /// Draw a circle using the specified color.
WiredHome 19:3f82c1161fd2 665 ///
WiredHome 19:3f82c1161fd2 666 /// @note As a side effect, this changes the current
WiredHome 19:3f82c1161fd2 667 /// foreground color for subsequent operations.
WiredHome 19:3f82c1161fd2 668 ///
WiredHome 19:3f82c1161fd2 669 /// @param x is the horizontal center of the circle.
WiredHome 19:3f82c1161fd2 670 /// @param y is the vertical center of the circle.
WiredHome 19:3f82c1161fd2 671 /// @param radius defines the size of the circle.
WiredHome 19:3f82c1161fd2 672 /// @param color defines the foreground color.
WiredHome 19:3f82c1161fd2 673 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 674 ///
WiredHome 19:3f82c1161fd2 675 RetCode_t circle(unsigned int x, unsigned int y, unsigned int radius, color_t color, fill_t fillit = NOFILL);
WiredHome 19:3f82c1161fd2 676
WiredHome 19:3f82c1161fd2 677 /// Draw a filled circle using the specified color.
WiredHome 19:3f82c1161fd2 678 ///
WiredHome 19:3f82c1161fd2 679 /// @note As a side effect, this changes the current
WiredHome 19:3f82c1161fd2 680 /// foreground color for subsequent operations.
WiredHome 19:3f82c1161fd2 681 ///
WiredHome 19:3f82c1161fd2 682 /// @param x is the horizontal center of the circle.
WiredHome 19:3f82c1161fd2 683 /// @param y is the vertical center of the circle.
WiredHome 19:3f82c1161fd2 684 /// @param radius defines the size of the circle.
WiredHome 19:3f82c1161fd2 685 /// @param color defines the foreground color.
WiredHome 19:3f82c1161fd2 686 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 687 ///
WiredHome 19:3f82c1161fd2 688 RetCode_t fillcircle(unsigned int x, unsigned int y, unsigned int radius, color_t color, fill_t fillit = FILL);
WiredHome 19:3f82c1161fd2 689
WiredHome 19:3f82c1161fd2 690 /// Draw a circle.
WiredHome 19:3f82c1161fd2 691 ///
WiredHome 19:3f82c1161fd2 692 /// Draws a circle using the foreground color setting.
WiredHome 19:3f82c1161fd2 693 ///
WiredHome 19:3f82c1161fd2 694 /// @param x is the horizontal center of the circle.
WiredHome 19:3f82c1161fd2 695 /// @param y is the vertical center of the circle.
WiredHome 19:3f82c1161fd2 696 /// @param radius defines the size of the circle.
WiredHome 19:3f82c1161fd2 697 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 698 ///
WiredHome 19:3f82c1161fd2 699 RetCode_t circle(unsigned int x, unsigned int y, unsigned int radius, fill_t fillit = NOFILL);
WiredHome 19:3f82c1161fd2 700
WiredHome 19:3f82c1161fd2 701 /// Draw an Ellipse using the specified color
WiredHome 19:3f82c1161fd2 702 ///
WiredHome 19:3f82c1161fd2 703 /// @note As a side effect, this changes the current
WiredHome 19:3f82c1161fd2 704 /// foreground color for subsequent operations.
WiredHome 19:3f82c1161fd2 705 ///
WiredHome 19:3f82c1161fd2 706 /// @param x is the horizontal center of the ellipse.
WiredHome 19:3f82c1161fd2 707 /// @param y is the vertical center of the ellipse.
WiredHome 22:f6ea795eb541 708 /// @param radius1 defines the horizontal radius of the ellipse.
WiredHome 22:f6ea795eb541 709 /// @param radius2 defines the vertical radius of the ellipse.
WiredHome 19:3f82c1161fd2 710 /// @param color defines the foreground color.
WiredHome 19:3f82c1161fd2 711 /// @param fillit defines whether the circle is filled or not.
WiredHome 19:3f82c1161fd2 712 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 713 ///
WiredHome 19:3f82c1161fd2 714 RetCode_t ellipse(unsigned int x, unsigned int y, unsigned int radius1, unsigned int radius1,
WiredHome 19:3f82c1161fd2 715 color_t color, fill_t fillit = NOFILL);
WiredHome 19:3f82c1161fd2 716
WiredHome 25:9556a3a9b7cc 717 /// Draw a filled Ellipse using the specified color
WiredHome 25:9556a3a9b7cc 718 ///
WiredHome 25:9556a3a9b7cc 719 /// @note As a side effect, this changes the current
WiredHome 25:9556a3a9b7cc 720 /// foreground color for subsequent operations.
WiredHome 25:9556a3a9b7cc 721 ///
WiredHome 25:9556a3a9b7cc 722 /// @param x is the horizontal center of the ellipse.
WiredHome 25:9556a3a9b7cc 723 /// @param y is the vertical center of the ellipse.
WiredHome 25:9556a3a9b7cc 724 /// @param radius1 defines the horizontal radius of the ellipse.
WiredHome 25:9556a3a9b7cc 725 /// @param radius2 defines the vertical radius of the ellipse.
WiredHome 25:9556a3a9b7cc 726 /// @param color defines the foreground color.
WiredHome 25:9556a3a9b7cc 727 /// @param fillit defines whether the circle is filled or not.
WiredHome 25:9556a3a9b7cc 728 /// @returns success/failure code. @see RetCode_t.
WiredHome 25:9556a3a9b7cc 729 ///
WiredHome 25:9556a3a9b7cc 730 RetCode_t fillellipse(unsigned int x, unsigned int y, unsigned int radius1, unsigned int radius1,
WiredHome 25:9556a3a9b7cc 731 color_t color, fill_t fillit = FILL);
WiredHome 25:9556a3a9b7cc 732
WiredHome 19:3f82c1161fd2 733 /// Draw an Ellipse
WiredHome 19:3f82c1161fd2 734 ///
WiredHome 19:3f82c1161fd2 735 /// Draws it using the foreground color setting.
WiredHome 19:3f82c1161fd2 736 ///
WiredHome 19:3f82c1161fd2 737 /// @param x is the horizontal center of the ellipse.
WiredHome 19:3f82c1161fd2 738 /// @param y is the vertical center of the ellipse.
WiredHome 22:f6ea795eb541 739 /// @param radius1 defines the horizontal radius of the ellipse.
WiredHome 22:f6ea795eb541 740 /// @param radius2 defines the vertical radius of the ellipse.
WiredHome 19:3f82c1161fd2 741 /// @param fillit defines whether the circle is filled or not.
WiredHome 19:3f82c1161fd2 742 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 743 ///
WiredHome 19:3f82c1161fd2 744 RetCode_t ellipse(unsigned int x, unsigned int y, unsigned int radius1, unsigned int radius1, fill_t fillit = NOFILL);
WiredHome 19:3f82c1161fd2 745
WiredHome 19:3f82c1161fd2 746 /// Control display power
WiredHome 19:3f82c1161fd2 747 ///
WiredHome 19:3f82c1161fd2 748 /// @param on when set to true will turn on the display, when false it is turned off.
WiredHome 19:3f82c1161fd2 749 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 750 ///
WiredHome 19:3f82c1161fd2 751 RetCode_t Power(bool on);
WiredHome 19:3f82c1161fd2 752
WiredHome 19:3f82c1161fd2 753 /// Reset the display controller via the Software Reset interface.
WiredHome 19:3f82c1161fd2 754 ///
WiredHome 19:3f82c1161fd2 755 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 756 ///
WiredHome 19:3f82c1161fd2 757 RetCode_t Reset(void);
WiredHome 19:3f82c1161fd2 758
WiredHome 19:3f82c1161fd2 759 /// Set backlight brightness.
WiredHome 19:3f82c1161fd2 760 ///
WiredHome 19:3f82c1161fd2 761 /// When the built-in PWM is used to control the backlight, this
WiredHome 19:3f82c1161fd2 762 /// API can be used to set the brightness.
WiredHome 19:3f82c1161fd2 763 ///
WiredHome 19:3f82c1161fd2 764 /// @param brightness ranges from 0 (off) to 255 (full on)
WiredHome 19:3f82c1161fd2 765 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 766 ///
WiredHome 19:3f82c1161fd2 767 RetCode_t Backlight_u8(unsigned char brightness);
WiredHome 19:3f82c1161fd2 768
WiredHome 19:3f82c1161fd2 769 /// Set backlight brightness.
WiredHome 19:3f82c1161fd2 770 ///
WiredHome 19:3f82c1161fd2 771 /// When the built-in PWM is used to control the backlight, this
WiredHome 19:3f82c1161fd2 772 /// API can be used to set the brightness.
WiredHome 19:3f82c1161fd2 773 ///
WiredHome 19:3f82c1161fd2 774 /// @param brightness ranges from 0.0 (off) to 1.0 (full on)
WiredHome 19:3f82c1161fd2 775 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 776 ///
WiredHome 19:3f82c1161fd2 777 RetCode_t Backlight(float brightness);
WiredHome 19:3f82c1161fd2 778
WiredHome 19:3f82c1161fd2 779 /// Set a reference to a bitmap font, provided by the user.
WiredHome 19:3f82c1161fd2 780 ///
WiredHome 19:3f82c1161fd2 781 /// @note Tool to create the fonts is accessible from its creator
WiredHome 19:3f82c1161fd2 782 /// available at http://www.mikroe.com.
WiredHome 19:3f82c1161fd2 783 /// Change the data to an array of type char[].
WiredHome 19:3f82c1161fd2 784 ///
WiredHome 19:3f82c1161fd2 785 /// @param font is a pointer to a specially formed font array.
WiredHome 19:3f82c1161fd2 786 /// This special font array has a 4-byte header, followed by
WiredHome 19:3f82c1161fd2 787 /// the data:
WiredHome 19:3f82c1161fd2 788 /// - the number of bytes per char
WiredHome 19:3f82c1161fd2 789 /// - the vertical size in pixels for each character
WiredHome 19:3f82c1161fd2 790 /// - the horizontal size in pixels for each character
WiredHome 19:3f82c1161fd2 791 /// - the number of bytes per vertical line (width of the array)
WiredHome 19:3f82c1161fd2 792 /// @returns error code.
WiredHome 19:3f82c1161fd2 793 ///
WiredHome 30:e0f2da88bdf6 794 virtual RetCode_t set_font(const unsigned char * font = NULL);
WiredHome 19:3f82c1161fd2 795
WiredHome 19:3f82c1161fd2 796 /// Get the RGB value for a DOS color.
WiredHome 19:3f82c1161fd2 797 ///
WiredHome 19:3f82c1161fd2 798 /// @param i is the color, in the range 0 to 15;
WiredHome 19:3f82c1161fd2 799 /// @returns the RGB color of the selected index, or 0
WiredHome 19:3f82c1161fd2 800 /// if the index is out of bounds.
WiredHome 19:3f82c1161fd2 801 ///
WiredHome 19:3f82c1161fd2 802 color_t DOSColor(int i);
WiredHome 19:3f82c1161fd2 803
WiredHome 19:3f82c1161fd2 804 /// Get the color name (string) for a DOS color.
WiredHome 19:3f82c1161fd2 805 ///
WiredHome 19:3f82c1161fd2 806 /// @param i is the color, in the range 0 to 15;
WiredHome 19:3f82c1161fd2 807 /// @returns a pointer to a string with the color name,
WiredHome 19:3f82c1161fd2 808 /// or NULL if the index is out of bounds.
WiredHome 19:3f82c1161fd2 809 ///
WiredHome 19:3f82c1161fd2 810 const char * DOSColorNames(int i);
WiredHome 19:3f82c1161fd2 811
WiredHome 19:3f82c1161fd2 812
WiredHome 19:3f82c1161fd2 813 #ifdef PERF_METRICS
WiredHome 19:3f82c1161fd2 814 /// Clear the performance metrics to zero.
WiredHome 19:3f82c1161fd2 815 void ClearPerformance();
WiredHome 19:3f82c1161fd2 816
WiredHome 19:3f82c1161fd2 817 /// Report the performance metrics for drawing functions using
WiredHome 19:3f82c1161fd2 818 /// printf()
WiredHome 19:3f82c1161fd2 819 void ReportPerformance();
WiredHome 19:3f82c1161fd2 820 #endif
WiredHome 19:3f82c1161fd2 821
WiredHome 19:3f82c1161fd2 822 private:
WiredHome 19:3f82c1161fd2 823 /// Set the SPI port frequency (in Hz).
WiredHome 19:3f82c1161fd2 824 ///
WiredHome 19:3f82c1161fd2 825 /// @note attempts to call this API at runtime, with the display
WiredHome 19:3f82c1161fd2 826 /// already online, cause the system to lockup.
WiredHome 19:3f82c1161fd2 827 /// Not sure why, so moving this to private to run once.
WiredHome 19:3f82c1161fd2 828 ///
WiredHome 19:3f82c1161fd2 829 /// This uses the mbed SPI driver, and is therefore dependent on
WiredHome 19:3f82c1161fd2 830 /// its capabilities. Limited tests were performed for the display
WiredHome 19:3f82c1161fd2 831 /// in the range of 1,000,000 to 50,000,000 Hz. The display was
WiredHome 19:3f82c1161fd2 832 /// a bit erratic above 20,000,000 Hz, so this became the default,
WiredHome 19:3f82c1161fd2 833 /// even though it might have been the bench-level wiring that posed
WiredHome 19:3f82c1161fd2 834 /// the limit.
WiredHome 19:3f82c1161fd2 835 ///
WiredHome 19:3f82c1161fd2 836 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 837 ///
WiredHome 19:3f82c1161fd2 838 RetCode_t frequency(unsigned long Hz = RA8875_DEFAULT_SPI_FREQ);
WiredHome 19:3f82c1161fd2 839
WiredHome 19:3f82c1161fd2 840
WiredHome 19:3f82c1161fd2 841 /// Initialize the chip, which is normally done as part of the
WiredHome 19:3f82c1161fd2 842 /// constructor, so not called by the user.
WiredHome 19:3f82c1161fd2 843 ///
WiredHome 19:3f82c1161fd2 844 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 845 ///
WiredHome 19:3f82c1161fd2 846 RetCode_t init(void);
WiredHome 19:3f82c1161fd2 847
WiredHome 29:422616aa04bd 848 /// Internal function to put a character using the built-in (internal) font engine
WiredHome 29:422616aa04bd 849 ///
WiredHome 29:422616aa04bd 850 /// @param is the character to put to the screen.
WiredHome 29:422616aa04bd 851 /// @returns the character put.
WiredHome 29:422616aa04bd 852 ///
WiredHome 29:422616aa04bd 853 int _internal_putc(int c);
WiredHome 29:422616aa04bd 854
WiredHome 29:422616aa04bd 855 /// Internal function to put a character using the external font engine
WiredHome 29:422616aa04bd 856 ///
WiredHome 29:422616aa04bd 857 /// @param is the character to put to the screen.
WiredHome 29:422616aa04bd 858 /// @returns the character put.
WiredHome 29:422616aa04bd 859 ///
WiredHome 29:422616aa04bd 860 int _external_putc(int c);
WiredHome 29:422616aa04bd 861
WiredHome 19:3f82c1161fd2 862 /// Select the peripheral to use it.
WiredHome 19:3f82c1161fd2 863 ///
WiredHome 19:3f82c1161fd2 864 /// @param chipsel when true will select the peripheral, and when false
WiredHome 19:3f82c1161fd2 865 /// will deselect the chip. This is the logical selection, and
WiredHome 19:3f82c1161fd2 866 /// the pin selection is the invert of this.
WiredHome 19:3f82c1161fd2 867 /// @returns success/failure code. @see RetCode_t.
WiredHome 19:3f82c1161fd2 868 ///
WiredHome 19:3f82c1161fd2 869 RetCode_t select(bool chipsel);
WiredHome 19:3f82c1161fd2 870
WiredHome 19:3f82c1161fd2 871 /// The most primitive - to write a data value to the SPI interface.
WiredHome 19:3f82c1161fd2 872 ///
WiredHome 19:3f82c1161fd2 873 /// @param data is the value to write.
WiredHome 19:3f82c1161fd2 874 /// @returns a value read from the port, since SPI is often shift
WiredHome 19:3f82c1161fd2 875 /// in while shifting out.
WiredHome 19:3f82c1161fd2 876 ///
WiredHome 19:3f82c1161fd2 877 unsigned char spiwrite(unsigned char data);
WiredHome 19:3f82c1161fd2 878
WiredHome 19:3f82c1161fd2 879 /// The most primitive - to read a data value to the SPI interface.
WiredHome 19:3f82c1161fd2 880 ///
WiredHome 19:3f82c1161fd2 881 /// This is really just a specialcase of the write command, where
WiredHome 19:3f82c1161fd2 882 /// the value zero is written in order to read.
WiredHome 19:3f82c1161fd2 883 ///
WiredHome 19:3f82c1161fd2 884 /// @returns a value read from the port, since SPI is often shift
WiredHome 19:3f82c1161fd2 885 /// in while shifting out.
WiredHome 19:3f82c1161fd2 886 ///
WiredHome 19:3f82c1161fd2 887 unsigned char spiread();
WiredHome 19:3f82c1161fd2 888
WiredHome 19:3f82c1161fd2 889 SPI spi; ///< spi port
WiredHome 19:3f82c1161fd2 890 DigitalOut cs; ///< chip select pin, assumed active low
WiredHome 19:3f82c1161fd2 891 DigitalOut res; ///< reset pin, assumed active low
WiredHome 19:3f82c1161fd2 892 const unsigned char * font; ///< reference to an external font somewhere in memory
WiredHome 29:422616aa04bd 893 unsigned int cursor_x, cursor_y; ///< used for external fonts only
WiredHome 19:3f82c1161fd2 894
WiredHome 19:3f82c1161fd2 895 #ifdef PERF_METRICS
WiredHome 19:3f82c1161fd2 896 typedef enum
WiredHome 19:3f82c1161fd2 897 {
WiredHome 19:3f82c1161fd2 898 PRF_CLS,
WiredHome 19:3f82c1161fd2 899 PRF_DRAWPOINT,
WiredHome 19:3f82c1161fd2 900 PRF_DRAWLINE,
WiredHome 19:3f82c1161fd2 901 PRF_DRAWRECTANGLE,
WiredHome 19:3f82c1161fd2 902 PRF_DRAWROUNDEDRECTANGLE,
WiredHome 19:3f82c1161fd2 903 PRF_DRAWTRIANGLE,
WiredHome 19:3f82c1161fd2 904 PRF_DRAWCIRCLE,
WiredHome 19:3f82c1161fd2 905 PRF_DRAWELLIPSE,
WiredHome 19:3f82c1161fd2 906 METRICCOUNT
WiredHome 19:3f82c1161fd2 907 } method_e;
WiredHome 19:3f82c1161fd2 908 unsigned long metrics[METRICCOUNT];
WiredHome 19:3f82c1161fd2 909 void RegisterPerformance(method_e method);
WiredHome 19:3f82c1161fd2 910 Timer performance;
WiredHome 19:3f82c1161fd2 911 #endif
WiredHome 19:3f82c1161fd2 912 };
WiredHome 19:3f82c1161fd2 913
WiredHome 19:3f82c1161fd2 914 //} // namespace
WiredHome 19:3f82c1161fd2 915
WiredHome 19:3f82c1161fd2 916 //using namespace SW_graphics;
WiredHome 19:3f82c1161fd2 917
WiredHome 23:a50ded45dbaf 918
WiredHome 23:a50ded45dbaf 919 #ifdef TESTENABLE
WiredHome 23:a50ded45dbaf 920 // ______________ ______________ ______________ _______________
WiredHome 23:a50ded45dbaf 921 // /_____ _____/ / ___________/ / ___________/ /_____ ______/
WiredHome 23:a50ded45dbaf 922 // / / / / / / / /
WiredHome 23:a50ded45dbaf 923 // / / / /___ / /__________ / /
WiredHome 23:a50ded45dbaf 924 // / / / ____/ /__________ / / /
WiredHome 23:a50ded45dbaf 925 // / / / / / / / /
WiredHome 23:a50ded45dbaf 926 // / / / /__________ ___________/ / / /
WiredHome 23:a50ded45dbaf 927 // /__/ /_____________/ /_____________/ /__/
WiredHome 23:a50ded45dbaf 928
WiredHome 23:a50ded45dbaf 929 #include "WebColors.h"
WiredHome 23:a50ded45dbaf 930 #include "Arial12x12.h"
WiredHome 23:a50ded45dbaf 931 #include <algorithm>
WiredHome 23:a50ded45dbaf 932
WiredHome 23:a50ded45dbaf 933 extern "C" void mbed_reset();
WiredHome 23:a50ded45dbaf 934
WiredHome 23:a50ded45dbaf 935 /// This activates a small set of tests for the graphics library.
WiredHome 23:a50ded45dbaf 936 ///
WiredHome 23:a50ded45dbaf 937 /// Call this API and pass it the reference to the display class.
WiredHome 23:a50ded45dbaf 938 /// It will then run a series of tests. It accepts interaction via
WiredHome 23:a50ded45dbaf 939 /// stdin to switch from automatic test mode to manual, run a specific
WiredHome 23:a50ded45dbaf 940 /// test, or to exit the test mode.
WiredHome 23:a50ded45dbaf 941 ///
WiredHome 23:a50ded45dbaf 942 /// @param lcd is a reference to the display class.
WiredHome 23:a50ded45dbaf 943 /// @param pc is a reference to a serial interface, typically the USB to PC.
WiredHome 23:a50ded45dbaf 944 ///
WiredHome 23:a50ded45dbaf 945 void RunTestSet(RA8875 & lcd, Serial & pc);
WiredHome 23:a50ded45dbaf 946
WiredHome 23:a50ded45dbaf 947
WiredHome 23:a50ded45dbaf 948 // To enable the test code, uncomment this section, or copy the
WiredHome 23:a50ded45dbaf 949 // necessary pieces to your "main()".
WiredHome 23:a50ded45dbaf 950 //
WiredHome 23:a50ded45dbaf 951 // #include "mbed.h"
WiredHome 23:a50ded45dbaf 952 // #include "RA8875.h"
WiredHome 23:a50ded45dbaf 953 // RA8875 lcd(p5, p6, p7, p12, NC, "tft"); // MOSI, MISO, SCK, /ChipSelect, /reset, name
WiredHome 23:a50ded45dbaf 954 // Serial pc(USBTX, USBRX);
WiredHome 23:a50ded45dbaf 955 // extern "C" void mbed_reset();
WiredHome 23:a50ded45dbaf 956 // int main()
WiredHome 23:a50ded45dbaf 957 // {
WiredHome 23:a50ded45dbaf 958 // pc.baud(460800); // I like a snappy terminal, so crank it up!
WiredHome 23:a50ded45dbaf 959 // pc.printf("\r\nRA8875 Test - Build " __DATE__ " " __TIME__ "\r\n");
WiredHome 23:a50ded45dbaf 960 //
WiredHome 23:a50ded45dbaf 961 // pc.printf("Turning on display\r\n");
WiredHome 23:a50ded45dbaf 962 // lcd.Reset();
WiredHome 23:a50ded45dbaf 963 // lcd.Power(true); // display power is on, but the backlight is independent
WiredHome 23:a50ded45dbaf 964 // lcd.Backlight(0.5);
WiredHome 23:a50ded45dbaf 965 // RunTestSet(lcd, pc);
WiredHome 23:a50ded45dbaf 966 // }
WiredHome 23:a50ded45dbaf 967
WiredHome 23:a50ded45dbaf 968 #endif // TESTENABLE
WiredHome 23:a50ded45dbaf 969
WiredHome 19:3f82c1161fd2 970 #endif