Increased SPI frequency from 5Mhz to 10MHz

Fork of RA8875 by David Smart

Committer:
WiredHome
Date:
Mon Mar 31 11:24:51 2014 +0000
Revision:
64:5479dc0c8738
Parent:
55:dfbabef7003e
Child:
65:607bc289c976
Documentation changes only to show all parameters to touch functions.

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