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