![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
brw1
RA8875/RA8875.h@0:a115ff47d1c1, 2015-11-30 (annotated)
- Committer:
- reiniermarcel
- Date:
- Mon Nov 30 11:13:18 2015 +0000
- Revision:
- 0:a115ff47d1c1
ok
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
reiniermarcel | 0:a115ff47d1c1 | 1 | /// |
reiniermarcel | 0:a115ff47d1c1 | 2 | /// @mainpage RA8875 Display Controller Driver library |
reiniermarcel | 0:a115ff47d1c1 | 3 | /// |
reiniermarcel | 0:a115ff47d1c1 | 4 | /// The RA8875 Display controller is a powerful interface for low cost displays. It |
reiniermarcel | 0:a115ff47d1c1 | 5 | /// can support displays up to 800 x 600 pixels x 16-bit color. Another common |
reiniermarcel | 0:a115ff47d1c1 | 6 | /// implementation is 480 x 272 x 16 with two layers. The two layers can be |
reiniermarcel | 0:a115ff47d1c1 | 7 | /// exchanged, or blended in various ways (transparency, OR, AND, and more). |
reiniermarcel | 0:a115ff47d1c1 | 8 | /// It includes graphics acceleration capabilities for drawing primitives, |
reiniermarcel | 0:a115ff47d1c1 | 9 | /// such as line, rectangle, circles, and more. |
reiniermarcel | 0:a115ff47d1c1 | 10 | /// |
reiniermarcel | 0:a115ff47d1c1 | 11 | /// The controller additionally supports backlight control (via PWM), keypad scanning |
reiniermarcel | 0:a115ff47d1c1 | 12 | /// (for a 4 x 5 matrix) and resistive touch-panel support. |
reiniermarcel | 0:a115ff47d1c1 | 13 | /// |
reiniermarcel | 0:a115ff47d1c1 | 14 | /// @section Display_Config Display Configuration |
reiniermarcel | 0:a115ff47d1c1 | 15 | /// |
reiniermarcel | 0:a115ff47d1c1 | 16 | /// This section details basics for bringing the display online. At a minimum, |
reiniermarcel | 0:a115ff47d1c1 | 17 | /// the display is instantiated. After that any of the available commands |
reiniermarcel | 0:a115ff47d1c1 | 18 | /// may be issued. |
reiniermarcel | 0:a115ff47d1c1 | 19 | /// |
reiniermarcel | 0:a115ff47d1c1 | 20 | /// During the instantiation, the display is powered on, cleared, and the backlight |
reiniermarcel | 0:a115ff47d1c1 | 21 | /// is energized. Additionally, the keypad and touchscreen features are activated. |
reiniermarcel | 0:a115ff47d1c1 | 22 | /// It is important to keep in mind that the keypad had the default mapping, and |
reiniermarcel | 0:a115ff47d1c1 | 23 | /// the touchscreen does not have the calibration matrix configured, so additional |
reiniermarcel | 0:a115ff47d1c1 | 24 | /// steps may be necessary. |
reiniermarcel | 0:a115ff47d1c1 | 25 | /// |
reiniermarcel | 0:a115ff47d1c1 | 26 | /// @code |
reiniermarcel | 0:a115ff47d1c1 | 27 | /// RA8875 lcd(p5, p6, p7, p12, NC, "tft"); |
reiniermarcel | 0:a115ff47d1c1 | 28 | /// lcd.init(); |
reiniermarcel | 0:a115ff47d1c1 | 29 | /// lcd.foreground(Blue); |
reiniermarcel | 0:a115ff47d1c1 | 30 | /// lcd.line(0,0, 479,271); |
reiniermarcel | 0:a115ff47d1c1 | 31 | /// ... |
reiniermarcel | 0:a115ff47d1c1 | 32 | /// @endcode |
reiniermarcel | 0:a115ff47d1c1 | 33 | /// |
reiniermarcel | 0:a115ff47d1c1 | 34 | /// @section Touch_Panel Touch Panel |
reiniermarcel | 0:a115ff47d1c1 | 35 | /// |
reiniermarcel | 0:a115ff47d1c1 | 36 | /// The supported touch panel interface is for a resistive panel, and is natively |
reiniermarcel | 0:a115ff47d1c1 | 37 | /// supported by the RA8875 controller. There are a few steps to enable this interface. |
reiniermarcel | 0:a115ff47d1c1 | 38 | /// |
reiniermarcel | 0:a115ff47d1c1 | 39 | /// @subsection Touch_Panel_Enable Touch Panel Enable |
reiniermarcel | 0:a115ff47d1c1 | 40 | /// |
reiniermarcel | 0:a115ff47d1c1 | 41 | /// @see TouchPanelInit has two forms - fully automatic, and controlled. See the APIs for |
reiniermarcel | 0:a115ff47d1c1 | 42 | /// details. |
reiniermarcel | 0:a115ff47d1c1 | 43 | /// |
reiniermarcel | 0:a115ff47d1c1 | 44 | /// @subsection Touch_Panel_Calibration |
reiniermarcel | 0:a115ff47d1c1 | 45 | /// |
reiniermarcel | 0:a115ff47d1c1 | 46 | /// The touch panel is not initially calibrated on startup. The application should |
reiniermarcel | 0:a115ff47d1c1 | 47 | /// provide a means to activate the calibration process, and that should not require |
reiniermarcel | 0:a115ff47d1c1 | 48 | /// the touchscreen as it may not yet be usable. Alternately, a calibration matrix |
reiniermarcel | 0:a115ff47d1c1 | 49 | /// can be loaded from non-volatile and installed. |
reiniermarcel | 0:a115ff47d1c1 | 50 | /// |
reiniermarcel | 0:a115ff47d1c1 | 51 | /// @section Keypad Keypad |
reiniermarcel | 0:a115ff47d1c1 | 52 | /// |
reiniermarcel | 0:a115ff47d1c1 | 53 | /// The keypad has a default keypad mapping, but there is an API that permits |
reiniermarcel | 0:a115ff47d1c1 | 54 | /// installing a custom keymap. |
reiniermarcel | 0:a115ff47d1c1 | 55 | /// |
reiniermarcel | 0:a115ff47d1c1 | 56 | #ifndef RA8875_H |
reiniermarcel | 0:a115ff47d1c1 | 57 | #define RA8875_H |
reiniermarcel | 0:a115ff47d1c1 | 58 | #include <mbed.h> |
reiniermarcel | 0:a115ff47d1c1 | 59 | |
reiniermarcel | 0:a115ff47d1c1 | 60 | #include "RA8875_Regs.h" |
reiniermarcel | 0:a115ff47d1c1 | 61 | #include "GraphicsDisplay.h" |
reiniermarcel | 0:a115ff47d1c1 | 62 | |
reiniermarcel | 0:a115ff47d1c1 | 63 | #define RA8875_DEFAULT_SPI_FREQ 5000000 |
reiniermarcel | 0:a115ff47d1c1 | 64 | |
reiniermarcel | 0:a115ff47d1c1 | 65 | // Define this to enable code that monitors the performance of various |
reiniermarcel | 0:a115ff47d1c1 | 66 | // graphics commands. |
reiniermarcel | 0:a115ff47d1c1 | 67 | //#define PERF_METRICS |
reiniermarcel | 0:a115ff47d1c1 | 68 | |
reiniermarcel | 0:a115ff47d1c1 | 69 | // What better place for some test code than in here and the companion |
reiniermarcel | 0:a115ff47d1c1 | 70 | // .cpp file. See also the bottom of this file. |
reiniermarcel | 0:a115ff47d1c1 | 71 | //#define TESTENABLE |
reiniermarcel | 0:a115ff47d1c1 | 72 | |
reiniermarcel | 0:a115ff47d1c1 | 73 | /// DOS colors - slightly color enhanced |
reiniermarcel | 0:a115ff47d1c1 | 74 | #define Black (color_t)(RGB(0,0,0)) |
reiniermarcel | 0:a115ff47d1c1 | 75 | #define Blue (color_t)(RGB(0,0,187)) |
reiniermarcel | 0:a115ff47d1c1 | 76 | #define Green (color_t)(RGB(0,187,0)) |
reiniermarcel | 0:a115ff47d1c1 | 77 | #define Cyan (color_t)(RGB(0,187,187)) |
reiniermarcel | 0:a115ff47d1c1 | 78 | #define Red (color_t)(RGB(187,0,0)) |
reiniermarcel | 0:a115ff47d1c1 | 79 | #define Magenta (color_t)(RGB(187,0,187)) |
reiniermarcel | 0:a115ff47d1c1 | 80 | #define Brown (color_t)(RGB(63,63,0)) |
reiniermarcel | 0:a115ff47d1c1 | 81 | #define Gray (color_t)(RGB(187,187,187)) |
reiniermarcel | 0:a115ff47d1c1 | 82 | #define Charcoal (color_t)(RGB(85,85,85)) |
reiniermarcel | 0:a115ff47d1c1 | 83 | #define BrightBlue (color_t)(RGB(0,0,255)) |
reiniermarcel | 0:a115ff47d1c1 | 84 | #define BrightGreen (color_t)(RGB(0,255,0)) |
reiniermarcel | 0:a115ff47d1c1 | 85 | #define BrightCyan (color_t)(RGB(0,255,255)) |
reiniermarcel | 0:a115ff47d1c1 | 86 | #define BrightRed (color_t)(RGB(255,0,0)) |
reiniermarcel | 0:a115ff47d1c1 | 87 | #define Orange (color_t)(RGB(255,85,85)) |
reiniermarcel | 0:a115ff47d1c1 | 88 | #define Pink (color_t)(RGB(255,85,255)) |
reiniermarcel | 0:a115ff47d1c1 | 89 | #define Yellow (color_t)(RGB(187,187,0)) |
reiniermarcel | 0:a115ff47d1c1 | 90 | #define White (color_t)(RGB(255,255,255)) |
reiniermarcel | 0:a115ff47d1c1 | 91 | |
reiniermarcel | 0:a115ff47d1c1 | 92 | #define DarkBlue (color_t)(RGB(0,0,63)) |
reiniermarcel | 0:a115ff47d1c1 | 93 | #define DarkGreen (color_t)(RGB(0,63,0)) |
reiniermarcel | 0:a115ff47d1c1 | 94 | #define DarkCyan (color_t)(RGB(0,63,63)) |
reiniermarcel | 0:a115ff47d1c1 | 95 | #define DarkRed (color_t)(RGB(63,0,0)) |
reiniermarcel | 0:a115ff47d1c1 | 96 | #define DarkMagenta (color_t)(RGB(63,0,63)) |
reiniermarcel | 0:a115ff47d1c1 | 97 | #define DarkBrown (color_t)(RGB(63,63,0)) |
reiniermarcel | 0:a115ff47d1c1 | 98 | #define DarkGray (color_t)(RGB(63,63,63)) |
reiniermarcel | 0:a115ff47d1c1 | 99 | |
reiniermarcel | 0:a115ff47d1c1 | 100 | |
reiniermarcel | 0:a115ff47d1c1 | 101 | //namespace SW_graphics |
reiniermarcel | 0:a115ff47d1c1 | 102 | //{ |
reiniermarcel | 0:a115ff47d1c1 | 103 | |
reiniermarcel | 0:a115ff47d1c1 | 104 | |
reiniermarcel | 0:a115ff47d1c1 | 105 | /// This is a graphics library for the Raio RA8875 Display Controller chip |
reiniermarcel | 0:a115ff47d1c1 | 106 | /// attached to a 4-wire SPI interface. |
reiniermarcel | 0:a115ff47d1c1 | 107 | /// |
reiniermarcel | 0:a115ff47d1c1 | 108 | /// It offers both primitive and high level APIs. |
reiniermarcel | 0:a115ff47d1c1 | 109 | /// |
reiniermarcel | 0:a115ff47d1c1 | 110 | /// Central to this API is a coordinate system, where the origin (0,0) is in |
reiniermarcel | 0:a115ff47d1c1 | 111 | /// the top-left corner of the display, and the width (x) extends positive to the |
reiniermarcel | 0:a115ff47d1c1 | 112 | /// right and the height (y) extends positive toward the bottom. |
reiniermarcel | 0:a115ff47d1c1 | 113 | /// |
reiniermarcel | 0:a115ff47d1c1 | 114 | /// @caution As there are both graphics and text commands, one must take care to use |
reiniermarcel | 0:a115ff47d1c1 | 115 | /// the proper coordinate system for each. Some of the text APIs are in units |
reiniermarcel | 0:a115ff47d1c1 | 116 | /// of column and row, which is measured in character positions (and dependent |
reiniermarcel | 0:a115ff47d1c1 | 117 | /// on the font size), where other text APIs permit pixel level positioning. |
reiniermarcel | 0:a115ff47d1c1 | 118 | /// |
reiniermarcel | 0:a115ff47d1c1 | 119 | /// @code |
reiniermarcel | 0:a115ff47d1c1 | 120 | /// #include "RA8875.h" |
reiniermarcel | 0:a115ff47d1c1 | 121 | /// RA8875 lcd(p5, p6, p7, p12, NC, "tft"); |
reiniermarcel | 0:a115ff47d1c1 | 122 | /// |
reiniermarcel | 0:a115ff47d1c1 | 123 | /// int main() |
reiniermarcel | 0:a115ff47d1c1 | 124 | /// { |
reiniermarcel | 0:a115ff47d1c1 | 125 | /// lcd.init(); |
reiniermarcel | 0:a115ff47d1c1 | 126 | /// lcd.printf("printing 3 x 2 = %d", 3*2); |
reiniermarcel | 0:a115ff47d1c1 | 127 | /// lcd.circle( 400,25, 25, BrightRed); |
reiniermarcel | 0:a115ff47d1c1 | 128 | /// lcd.fillcircle( 400,25, 15, RGB(128,255,128)); |
reiniermarcel | 0:a115ff47d1c1 | 129 | /// lcd.ellipse( 440,75, 35,20, BrightBlue); |
reiniermarcel | 0:a115ff47d1c1 | 130 | /// lcd.fillellipse( 440,75, 25,10, Blue); |
reiniermarcel | 0:a115ff47d1c1 | 131 | /// lcd.triangle( 440,100, 475,110, 450,125, Magenta); |
reiniermarcel | 0:a115ff47d1c1 | 132 | /// lcd.filltriangle( 445,105, 467,111, 452,120, Cyan); |
reiniermarcel | 0:a115ff47d1c1 | 133 | /// lcd.rect( 400,130, 475,155, Brown); |
reiniermarcel | 0:a115ff47d1c1 | 134 | /// lcd.fillrect( 405,135, 470,150, Pink); |
reiniermarcel | 0:a115ff47d1c1 | 135 | /// lcd.roundrect( 410,160, 475,190, 10,8, Yellow); |
reiniermarcel | 0:a115ff47d1c1 | 136 | /// lcd.fillroundrect(415,165, 470,185, 5,3, Orange); |
reiniermarcel | 0:a115ff47d1c1 | 137 | /// lcd.line( 430,200, 460,230, RGB(0,255,0)); |
reiniermarcel | 0:a115ff47d1c1 | 138 | /// for (int i=0; i<=30; i+=5) |
reiniermarcel | 0:a115ff47d1c1 | 139 | /// lcd.pixel(435+i,200+i, White); |
reiniermarcel | 0:a115ff47d1c1 | 140 | /// } |
reiniermarcel | 0:a115ff47d1c1 | 141 | /// @endcode |
reiniermarcel | 0:a115ff47d1c1 | 142 | /// |
reiniermarcel | 0:a115ff47d1c1 | 143 | /// @todo Add Scroll support for text. |
reiniermarcel | 0:a115ff47d1c1 | 144 | /// @todo Improve sync between internal and external font support - cursor, window, scroll. |
reiniermarcel | 0:a115ff47d1c1 | 145 | /// @todo Add Hardware reset signal - but testing to date indicates it is not needed. |
reiniermarcel | 0:a115ff47d1c1 | 146 | /// @todo Add high level objects - x-y graph, meter, others... but these will |
reiniermarcel | 0:a115ff47d1c1 | 147 | /// probably be best served in another class, since they may not |
reiniermarcel | 0:a115ff47d1c1 | 148 | /// be needed for many uses. |
reiniermarcel | 0:a115ff47d1c1 | 149 | /// |
reiniermarcel | 0:a115ff47d1c1 | 150 | class RA8875 : public GraphicsDisplay |
reiniermarcel | 0:a115ff47d1c1 | 151 | { |
reiniermarcel | 0:a115ff47d1c1 | 152 | public: |
reiniermarcel | 0:a115ff47d1c1 | 153 | /// cursor type to be shown as the text cursor. |
reiniermarcel | 0:a115ff47d1c1 | 154 | typedef enum |
reiniermarcel | 0:a115ff47d1c1 | 155 | { |
reiniermarcel | 0:a115ff47d1c1 | 156 | NOCURSOR, ///< cursor is hidden |
reiniermarcel | 0:a115ff47d1c1 | 157 | IBEAM, ///< | cursor |
reiniermarcel | 0:a115ff47d1c1 | 158 | UNDER, ///< _ cursor |
reiniermarcel | 0:a115ff47d1c1 | 159 | BLOCK ///< Block cursor |
reiniermarcel | 0:a115ff47d1c1 | 160 | } cursor_t; |
reiniermarcel | 0:a115ff47d1c1 | 161 | |
reiniermarcel | 0:a115ff47d1c1 | 162 | /// font type selection. |
reiniermarcel | 0:a115ff47d1c1 | 163 | typedef enum |
reiniermarcel | 0:a115ff47d1c1 | 164 | { |
reiniermarcel | 0:a115ff47d1c1 | 165 | ISO8859_1, ///< ISO8859-1 font |
reiniermarcel | 0:a115ff47d1c1 | 166 | ISO8859_2, ///< ISO8859-2 font |
reiniermarcel | 0:a115ff47d1c1 | 167 | ISO8859_3, ///< ISO8859-3 font |
reiniermarcel | 0:a115ff47d1c1 | 168 | ISO8859_4 ///< ISO8859-4 font |
reiniermarcel | 0:a115ff47d1c1 | 169 | } font_t; |
reiniermarcel | 0:a115ff47d1c1 | 170 | |
reiniermarcel | 0:a115ff47d1c1 | 171 | /// font rotation selection |
reiniermarcel | 0:a115ff47d1c1 | 172 | typedef enum |
reiniermarcel | 0:a115ff47d1c1 | 173 | { |
reiniermarcel | 0:a115ff47d1c1 | 174 | normal, ///< normal orientation |
reiniermarcel | 0:a115ff47d1c1 | 175 | rotated ///< rotated orientation |
reiniermarcel | 0:a115ff47d1c1 | 176 | } font_angle_t; |
reiniermarcel | 0:a115ff47d1c1 | 177 | |
reiniermarcel | 0:a115ff47d1c1 | 178 | /// alignment |
reiniermarcel | 0:a115ff47d1c1 | 179 | typedef enum |
reiniermarcel | 0:a115ff47d1c1 | 180 | { |
reiniermarcel | 0:a115ff47d1c1 | 181 | align_none, ///< align - none |
reiniermarcel | 0:a115ff47d1c1 | 182 | align_full ///< align - full |
reiniermarcel | 0:a115ff47d1c1 | 183 | } alignment_t; |
reiniermarcel | 0:a115ff47d1c1 | 184 | |
reiniermarcel | 0:a115ff47d1c1 | 185 | /// Scale factor - 1, 2, 3 4 |
reiniermarcel | 0:a115ff47d1c1 | 186 | typedef int HorizontalScale; |
reiniermarcel | 0:a115ff47d1c1 | 187 | |
reiniermarcel | 0:a115ff47d1c1 | 188 | /// Scale factor - 1, 2, 3, 4 |
reiniermarcel | 0:a115ff47d1c1 | 189 | typedef int VerticalScale; |
reiniermarcel | 0:a115ff47d1c1 | 190 | |
reiniermarcel | 0:a115ff47d1c1 | 191 | /// Clear screen region |
reiniermarcel | 0:a115ff47d1c1 | 192 | typedef enum |
reiniermarcel | 0:a115ff47d1c1 | 193 | { |
reiniermarcel | 0:a115ff47d1c1 | 194 | FULLWINDOW, ///< Full screen |
reiniermarcel | 0:a115ff47d1c1 | 195 | ACTIVEWINDOW ///< active window/region |
reiniermarcel | 0:a115ff47d1c1 | 196 | } Region_t; |
reiniermarcel | 0:a115ff47d1c1 | 197 | |
reiniermarcel | 0:a115ff47d1c1 | 198 | /// Set the Layer Display Mode. @ref SetLayerMode |
reiniermarcel | 0:a115ff47d1c1 | 199 | typedef enum |
reiniermarcel | 0:a115ff47d1c1 | 200 | { |
reiniermarcel | 0:a115ff47d1c1 | 201 | ShowLayer0, ///< Only layer 0 is visible, layer 1 is hidden (default) |
reiniermarcel | 0:a115ff47d1c1 | 202 | ShowLayer1, ///< Only layer 1 is visible, layer 0 is hidden |
reiniermarcel | 0:a115ff47d1c1 | 203 | LightenOverlay, ///< Lighten-overlay mode |
reiniermarcel | 0:a115ff47d1c1 | 204 | TransparentMode, ///< Transparent mode |
reiniermarcel | 0:a115ff47d1c1 | 205 | BooleanOR, ///< Boolean OR mode |
reiniermarcel | 0:a115ff47d1c1 | 206 | BooleanAND, ///< Boolean AND mode |
reiniermarcel | 0:a115ff47d1c1 | 207 | FloatingWindow ///< Floating Window mode |
reiniermarcel | 0:a115ff47d1c1 | 208 | } LayerMode_T; |
reiniermarcel | 0:a115ff47d1c1 | 209 | |
reiniermarcel | 0:a115ff47d1c1 | 210 | /// Touch Panel modes |
reiniermarcel | 0:a115ff47d1c1 | 211 | typedef enum |
reiniermarcel | 0:a115ff47d1c1 | 212 | { |
reiniermarcel | 0:a115ff47d1c1 | 213 | TP_Auto, ///< Auto touch detection mode |
reiniermarcel | 0:a115ff47d1c1 | 214 | TP_Manual, ///< Manual touch detection mode |
reiniermarcel | 0:a115ff47d1c1 | 215 | } tpmode_t; |
reiniermarcel | 0:a115ff47d1c1 | 216 | |
reiniermarcel | 0:a115ff47d1c1 | 217 | /// Constructor for a display based on the RAiO RA8875 |
reiniermarcel | 0:a115ff47d1c1 | 218 | /// display controller. |
reiniermarcel | 0:a115ff47d1c1 | 219 | /// |
reiniermarcel | 0:a115ff47d1c1 | 220 | /// This configures the registers and calls the @ref init method. |
reiniermarcel | 0:a115ff47d1c1 | 221 | /// |
reiniermarcel | 0:a115ff47d1c1 | 222 | /// @code |
reiniermarcel | 0:a115ff47d1c1 | 223 | /// #include "RA8875.h" |
reiniermarcel | 0:a115ff47d1c1 | 224 | /// RA8875 lcd(p5, p6, p7, p12, NC, "tft"); |
reiniermarcel | 0:a115ff47d1c1 | 225 | /// |
reiniermarcel | 0:a115ff47d1c1 | 226 | /// int main() |
reiniermarcel | 0:a115ff47d1c1 | 227 | /// { |
reiniermarcel | 0:a115ff47d1c1 | 228 | /// lcd.init(); |
reiniermarcel | 0:a115ff47d1c1 | 229 | /// lcd.printf("printing 3 x 2 = %d", 3*2); |
reiniermarcel | 0:a115ff47d1c1 | 230 | /// lcd.circle(400,25, 25, BrightRed); |
reiniermarcel | 0:a115ff47d1c1 | 231 | /// } |
reiniermarcel | 0:a115ff47d1c1 | 232 | /// @endcode |
reiniermarcel | 0:a115ff47d1c1 | 233 | /// |
reiniermarcel | 0:a115ff47d1c1 | 234 | /// @param[in] mosi is the SPI master out slave in pin on the mbed. |
reiniermarcel | 0:a115ff47d1c1 | 235 | /// @param[in] miso is the SPI master in slave out pin on the mbed. |
reiniermarcel | 0:a115ff47d1c1 | 236 | /// @param[in] sclk is the SPI shift clock pin on the mbed. |
reiniermarcel | 0:a115ff47d1c1 | 237 | /// @param[in] csel is the DigitalOut pin on the mbed to use as the |
reiniermarcel | 0:a115ff47d1c1 | 238 | /// active low chip select for the display controller. |
reiniermarcel | 0:a115ff47d1c1 | 239 | /// @param[in] reset is the DigitalOut pin on the mbed to use as the |
reiniermarcel | 0:a115ff47d1c1 | 240 | /// active low reset input on the display controller - |
reiniermarcel | 0:a115ff47d1c1 | 241 | /// but this is not currently used. |
reiniermarcel | 0:a115ff47d1c1 | 242 | /// @param[in] name is a text name for this object, which will permit |
reiniermarcel | 0:a115ff47d1c1 | 243 | /// capturing stdout to puts() and printf() directly to it. |
reiniermarcel | 0:a115ff47d1c1 | 244 | /// |
reiniermarcel | 0:a115ff47d1c1 | 245 | RA8875(PinName mosi, PinName miso, PinName sclk, PinName csel, PinName reset, const char * name = "lcd"); |
reiniermarcel | 0:a115ff47d1c1 | 246 | |
reiniermarcel | 0:a115ff47d1c1 | 247 | // Destructor doesn't have much to do as this would typically be created |
reiniermarcel | 0:a115ff47d1c1 | 248 | // at startup, and not at runtime. |
reiniermarcel | 0:a115ff47d1c1 | 249 | //~RA8875(); |
reiniermarcel | 0:a115ff47d1c1 | 250 | |
reiniermarcel | 0:a115ff47d1c1 | 251 | /// Initialize the driver. |
reiniermarcel | 0:a115ff47d1c1 | 252 | /// |
reiniermarcel | 0:a115ff47d1c1 | 253 | /// @param[in] width in pixels to configure the display for. This parameter is optional |
reiniermarcel | 0:a115ff47d1c1 | 254 | /// and the default is 480. |
reiniermarcel | 0:a115ff47d1c1 | 255 | /// @param[in] height in pixels to configure the display for. This parameter is optional |
reiniermarcel | 0:a115ff47d1c1 | 256 | /// and the default is 272. |
reiniermarcel | 0:a115ff47d1c1 | 257 | /// @param[in] color_bpp can be either 8 or 16, but must be consistent |
reiniermarcel | 0:a115ff47d1c1 | 258 | /// with the width and height parameters. This parameter is optional |
reiniermarcel | 0:a115ff47d1c1 | 259 | /// and the default is 16. |
reiniermarcel | 0:a115ff47d1c1 | 260 | /// @param[in] power defines if the display should be left in the power-on or off state. |
reiniermarcel | 0:a115ff47d1c1 | 261 | /// If power is true (on), the backlight is set to 100%. This parameter is optional |
reiniermarcel | 0:a115ff47d1c1 | 262 | /// and the default is true (on). @see Power. |
reiniermarcel | 0:a115ff47d1c1 | 263 | /// @param[in] keypadon defines if the keypad support should be enabled. This parameter is optional |
reiniermarcel | 0:a115ff47d1c1 | 264 | /// and the default is true (enabled). @see KeypadInit. |
reiniermarcel | 0:a115ff47d1c1 | 265 | /// @param[in] touchscreeenon defines if the keypad support should be enabled. This parameter is optional |
reiniermarcel | 0:a115ff47d1c1 | 266 | /// and the default is true (enabled). @see TouchPanelInit. |
reiniermarcel | 0:a115ff47d1c1 | 267 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 268 | /// |
reiniermarcel | 0:a115ff47d1c1 | 269 | RetCode_t init(int width = 480, int height = 272, int color_bpp = 16, |
reiniermarcel | 0:a115ff47d1c1 | 270 | bool poweron = true, bool keypadon = true, bool touchscreeenon = true); |
reiniermarcel | 0:a115ff47d1c1 | 271 | |
reiniermarcel | 0:a115ff47d1c1 | 272 | /// Get a pointer to the error code. |
reiniermarcel | 0:a115ff47d1c1 | 273 | /// |
reiniermarcel | 0:a115ff47d1c1 | 274 | /// This method returns a pointer to a text string that matches the |
reiniermarcel | 0:a115ff47d1c1 | 275 | /// code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 276 | /// |
reiniermarcel | 0:a115ff47d1c1 | 277 | /// @param[in] code is the return value from RetCode_t to look up. |
reiniermarcel | 0:a115ff47d1c1 | 278 | /// @returns a pointer to the text message representing code. If code |
reiniermarcel | 0:a115ff47d1c1 | 279 | /// is not a valid value, then it returns the text for bad_parameter; |
reiniermarcel | 0:a115ff47d1c1 | 280 | const char * GetErrorMessage(RetCode_t code); |
reiniermarcel | 0:a115ff47d1c1 | 281 | |
reiniermarcel | 0:a115ff47d1c1 | 282 | |
reiniermarcel | 0:a115ff47d1c1 | 283 | /// Select the drawing layer for subsequent commands. |
reiniermarcel | 0:a115ff47d1c1 | 284 | /// |
reiniermarcel | 0:a115ff47d1c1 | 285 | /// If the screen configuration is 480 x 272, or if it is 800 x 480 |
reiniermarcel | 0:a115ff47d1c1 | 286 | /// and 8-bit color, the the display supports two layers, which can |
reiniermarcel | 0:a115ff47d1c1 | 287 | /// be independently drawn on and shown. Additionally, complex |
reiniermarcel | 0:a115ff47d1c1 | 288 | /// operations involving both layers are permitted. |
reiniermarcel | 0:a115ff47d1c1 | 289 | /// |
reiniermarcel | 0:a115ff47d1c1 | 290 | /// @code |
reiniermarcel | 0:a115ff47d1c1 | 291 | /// //lcd.SetLayerMode(OnlyLayer0); // default is layer 0 |
reiniermarcel | 0:a115ff47d1c1 | 292 | /// lcd.rect(400,130, 475,155,Brown); |
reiniermarcel | 0:a115ff47d1c1 | 293 | /// lcd.SelectDrawingLayer(1); |
reiniermarcel | 0:a115ff47d1c1 | 294 | /// lcd.circle(400,25, 25, BrightRed); |
reiniermarcel | 0:a115ff47d1c1 | 295 | /// wait(1); |
reiniermarcel | 0:a115ff47d1c1 | 296 | /// lcd.SetLayerMode(ShowLayer1); |
reiniermarcel | 0:a115ff47d1c1 | 297 | /// @endcode |
reiniermarcel | 0:a115ff47d1c1 | 298 | /// |
reiniermarcel | 0:a115ff47d1c1 | 299 | /// @attention The user manual refers to Layer 1 and Layer 2, however the |
reiniermarcel | 0:a115ff47d1c1 | 300 | /// actual register values are value 0 and 1. This API as well as |
reiniermarcel | 0:a115ff47d1c1 | 301 | /// others that reference the layers use the values 0 and 1 for |
reiniermarcel | 0:a115ff47d1c1 | 302 | /// cleaner iteration in the code. |
reiniermarcel | 0:a115ff47d1c1 | 303 | /// |
reiniermarcel | 0:a115ff47d1c1 | 304 | /// @param[in] layer is 0 or 1 to select the layer for subsequent |
reiniermarcel | 0:a115ff47d1c1 | 305 | /// commands. |
reiniermarcel | 0:a115ff47d1c1 | 306 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 307 | /// |
reiniermarcel | 0:a115ff47d1c1 | 308 | RetCode_t SelectDrawingLayer(uint16_t layer); |
reiniermarcel | 0:a115ff47d1c1 | 309 | |
reiniermarcel | 0:a115ff47d1c1 | 310 | /// Get the currently active drawing layer. |
reiniermarcel | 0:a115ff47d1c1 | 311 | /// |
reiniermarcel | 0:a115ff47d1c1 | 312 | /// This returns a value, 0 or 1, based on the screen configuration |
reiniermarcel | 0:a115ff47d1c1 | 313 | /// and the currently active drawing layer. |
reiniermarcel | 0:a115ff47d1c1 | 314 | /// |
reiniermarcel | 0:a115ff47d1c1 | 315 | /// @code |
reiniermarcel | 0:a115ff47d1c1 | 316 | /// uint16_t prevLayer = lcd.GetDrawingLayer(); |
reiniermarcel | 0:a115ff47d1c1 | 317 | /// lcd.SelectDrawingLayer(x); |
reiniermarcel | 0:a115ff47d1c1 | 318 | /// lcd.circle(400,25, 25, BrightRed); |
reiniermarcel | 0:a115ff47d1c1 | 319 | /// lcd.SelectDrawingLayer(prevLayer); |
reiniermarcel | 0:a115ff47d1c1 | 320 | /// @endcode |
reiniermarcel | 0:a115ff47d1c1 | 321 | /// |
reiniermarcel | 0:a115ff47d1c1 | 322 | /// @attention The user manual refers to Layer 1 and Layer 2, however the |
reiniermarcel | 0:a115ff47d1c1 | 323 | /// actual register values are value 0 and 1. This API as well as |
reiniermarcel | 0:a115ff47d1c1 | 324 | /// others that reference the layers use the values 0 and 1 for |
reiniermarcel | 0:a115ff47d1c1 | 325 | /// cleaner iteration in the code. |
reiniermarcel | 0:a115ff47d1c1 | 326 | /// |
reiniermarcel | 0:a115ff47d1c1 | 327 | /// @returns the current drawing layer; 0 or 1. |
reiniermarcel | 0:a115ff47d1c1 | 328 | /// |
reiniermarcel | 0:a115ff47d1c1 | 329 | uint16_t GetDrawingLayer(void); |
reiniermarcel | 0:a115ff47d1c1 | 330 | |
reiniermarcel | 0:a115ff47d1c1 | 331 | /// Set the Layer presentation mode. |
reiniermarcel | 0:a115ff47d1c1 | 332 | /// |
reiniermarcel | 0:a115ff47d1c1 | 333 | /// This sets the presentation mode for layers, and permits showing |
reiniermarcel | 0:a115ff47d1c1 | 334 | /// a single layer, or applying a mode where the two layers |
reiniermarcel | 0:a115ff47d1c1 | 335 | /// are combined using one of the hardware methods. |
reiniermarcel | 0:a115ff47d1c1 | 336 | /// |
reiniermarcel | 0:a115ff47d1c1 | 337 | /// Refer to the RA8875 data sheet for full details. |
reiniermarcel | 0:a115ff47d1c1 | 338 | /// |
reiniermarcel | 0:a115ff47d1c1 | 339 | /// @code |
reiniermarcel | 0:a115ff47d1c1 | 340 | /// //lcd.SetLayerMode(OnlyLayer0); // default is layer 0 |
reiniermarcel | 0:a115ff47d1c1 | 341 | /// lcd.rect(400,130, 475,155,Brown); |
reiniermarcel | 0:a115ff47d1c1 | 342 | /// lcd.SelectDrawingLayer(1); |
reiniermarcel | 0:a115ff47d1c1 | 343 | /// lcd.circle(400,25, 25, BrightRed); |
reiniermarcel | 0:a115ff47d1c1 | 344 | /// wait(1); |
reiniermarcel | 0:a115ff47d1c1 | 345 | /// lcd.SetLayerMode(ShowLayer1); |
reiniermarcel | 0:a115ff47d1c1 | 346 | /// @endcode |
reiniermarcel | 0:a115ff47d1c1 | 347 | /// |
reiniermarcel | 0:a115ff47d1c1 | 348 | /// @param[in] mode sets the mode in the Layer Transparency Register. |
reiniermarcel | 0:a115ff47d1c1 | 349 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 350 | /// |
reiniermarcel | 0:a115ff47d1c1 | 351 | RetCode_t SetLayerMode(LayerMode_T mode); |
reiniermarcel | 0:a115ff47d1c1 | 352 | |
reiniermarcel | 0:a115ff47d1c1 | 353 | /// Set the layer transparency for each layer. |
reiniermarcel | 0:a115ff47d1c1 | 354 | /// |
reiniermarcel | 0:a115ff47d1c1 | 355 | /// Set the transparency, where the range of values is |
reiniermarcel | 0:a115ff47d1c1 | 356 | /// from zero (fully visible) to eight (fully transparent). |
reiniermarcel | 0:a115ff47d1c1 | 357 | /// The input value is automatically limited to this range. |
reiniermarcel | 0:a115ff47d1c1 | 358 | /// |
reiniermarcel | 0:a115ff47d1c1 | 359 | /// @code |
reiniermarcel | 0:a115ff47d1c1 | 360 | /// // draw something on each layer, then step-fade across |
reiniermarcel | 0:a115ff47d1c1 | 361 | /// display.SetLayerMode(RA8875::TransparentMode); |
reiniermarcel | 0:a115ff47d1c1 | 362 | /// for (i=0; i<=8; i++) { |
reiniermarcel | 0:a115ff47d1c1 | 363 | /// display.SetLayerTransparency(i, 8-i); |
reiniermarcel | 0:a115ff47d1c1 | 364 | /// wait_ms(200); |
reiniermarcel | 0:a115ff47d1c1 | 365 | /// } |
reiniermarcel | 0:a115ff47d1c1 | 366 | /// @endcode |
reiniermarcel | 0:a115ff47d1c1 | 367 | /// |
reiniermarcel | 0:a115ff47d1c1 | 368 | /// @param[in] layer1 sets the layer 1 transparency. |
reiniermarcel | 0:a115ff47d1c1 | 369 | /// @param[in] layer2 sets the layer 2 transparency. |
reiniermarcel | 0:a115ff47d1c1 | 370 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 371 | /// |
reiniermarcel | 0:a115ff47d1c1 | 372 | RetCode_t SetLayerTransparency(uint8_t layer1, uint8_t layer2); |
reiniermarcel | 0:a115ff47d1c1 | 373 | |
reiniermarcel | 0:a115ff47d1c1 | 374 | /// Set the background color register used for transparency. |
reiniermarcel | 0:a115ff47d1c1 | 375 | /// |
reiniermarcel | 0:a115ff47d1c1 | 376 | /// This command sets the background color registers that are used |
reiniermarcel | 0:a115ff47d1c1 | 377 | /// in the transparent color operations involving the layers. |
reiniermarcel | 0:a115ff47d1c1 | 378 | /// |
reiniermarcel | 0:a115ff47d1c1 | 379 | /// @param[in] color is optional and expressed in 16-bit format. If not |
reiniermarcel | 0:a115ff47d1c1 | 380 | /// supplied, a default of Black is used. |
reiniermarcel | 0:a115ff47d1c1 | 381 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 382 | /// |
reiniermarcel | 0:a115ff47d1c1 | 383 | RetCode_t SetBackgroundTransparencyColor(color_t color = RGB(0,0,0)); |
reiniermarcel | 0:a115ff47d1c1 | 384 | |
reiniermarcel | 0:a115ff47d1c1 | 385 | |
reiniermarcel | 0:a115ff47d1c1 | 386 | /// Get the background color value used for transparency. |
reiniermarcel | 0:a115ff47d1c1 | 387 | /// |
reiniermarcel | 0:a115ff47d1c1 | 388 | /// This command reads the background color registers that define |
reiniermarcel | 0:a115ff47d1c1 | 389 | /// the transparency color for operations involving layers. |
reiniermarcel | 0:a115ff47d1c1 | 390 | /// |
reiniermarcel | 0:a115ff47d1c1 | 391 | /// @returns the color. |
reiniermarcel | 0:a115ff47d1c1 | 392 | /// |
reiniermarcel | 0:a115ff47d1c1 | 393 | color_t GetBackgroundTransparencyColor(void); |
reiniermarcel | 0:a115ff47d1c1 | 394 | |
reiniermarcel | 0:a115ff47d1c1 | 395 | /// Initialize theTouch Panel controller with default values |
reiniermarcel | 0:a115ff47d1c1 | 396 | /// |
reiniermarcel | 0:a115ff47d1c1 | 397 | /// This activates the simplified touch panel init, which may work for |
reiniermarcel | 0:a115ff47d1c1 | 398 | /// most uses. The alternate API is available if fine-grained control |
reiniermarcel | 0:a115ff47d1c1 | 399 | /// is needed for the numerous settings. |
reiniermarcel | 0:a115ff47d1c1 | 400 | /// |
reiniermarcel | 0:a115ff47d1c1 | 401 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 402 | /// |
reiniermarcel | 0:a115ff47d1c1 | 403 | RetCode_t TouchPanelInit(void); |
reiniermarcel | 0:a115ff47d1c1 | 404 | |
reiniermarcel | 0:a115ff47d1c1 | 405 | /// Initialize the Touch Panel controller with detailed settings. |
reiniermarcel | 0:a115ff47d1c1 | 406 | /// |
reiniermarcel | 0:a115ff47d1c1 | 407 | /// This is the detailed touch panel init, which provides the ability |
reiniermarcel | 0:a115ff47d1c1 | 408 | /// to set nearly every possible option. |
reiniermarcel | 0:a115ff47d1c1 | 409 | /// |
reiniermarcel | 0:a115ff47d1c1 | 410 | /// @param[in] bTpEnable Touch Panel enable/disable control: |
reiniermarcel | 0:a115ff47d1c1 | 411 | /// - TP_ENABLE: enable the touch panel |
reiniermarcel | 0:a115ff47d1c1 | 412 | /// - TP_DISABLE: disable the touch panel |
reiniermarcel | 0:a115ff47d1c1 | 413 | /// @param[in] bTpAutoManual Touch Panel operating mode: |
reiniermarcel | 0:a115ff47d1c1 | 414 | /// - TP_MODE_AUTO: automatic capture |
reiniermarcel | 0:a115ff47d1c1 | 415 | /// - TP_MODE_MANUAL: manual capture |
reiniermarcel | 0:a115ff47d1c1 | 416 | /// @param[in] bTpDebounce Debounce circuit enable for touch panel interrupt: |
reiniermarcel | 0:a115ff47d1c1 | 417 | /// - TP_DEBOUNCE_OFF: disable the debounce circuit |
reiniermarcel | 0:a115ff47d1c1 | 418 | /// - TP_DEBOUNCE_ON: enable the debounce circuit |
reiniermarcel | 0:a115ff47d1c1 | 419 | /// @param[in] bTpManualMode When Manual Mode is selected, this sets the mode: |
reiniermarcel | 0:a115ff47d1c1 | 420 | /// - TP_MANUAL_IDLE: touch panel is idle |
reiniermarcel | 0:a115ff47d1c1 | 421 | /// - TP_MANUAL_WAIT: wait for touch panel event |
reiniermarcel | 0:a115ff47d1c1 | 422 | /// - TP_MANUAL_LATCH_X: latch X data |
reiniermarcel | 0:a115ff47d1c1 | 423 | /// - TP_MANUAL_LATCH_Y: latch Y data |
reiniermarcel | 0:a115ff47d1c1 | 424 | /// @param[in] bTpAdcClkDiv Sets the ADC clock as a fraction of the System CLK: |
reiniermarcel | 0:a115ff47d1c1 | 425 | /// - TP_ADC_CLKDIV_1: Use CLK |
reiniermarcel | 0:a115ff47d1c1 | 426 | /// - TP_ADC_CLKDIV_2: Use CLK/2 |
reiniermarcel | 0:a115ff47d1c1 | 427 | /// - TP_ADC_CLKDIV_4: Use CLK/4 |
reiniermarcel | 0:a115ff47d1c1 | 428 | /// - TP_ADC_CLKDIV_8: Use CLK/8 |
reiniermarcel | 0:a115ff47d1c1 | 429 | /// - TP_ADC_CLKDIV_16: Use CLK/16 |
reiniermarcel | 0:a115ff47d1c1 | 430 | /// - TP_ADC_CLKDIV_32: Use CLK/32 |
reiniermarcel | 0:a115ff47d1c1 | 431 | /// - TP_ADC_CLKDIV_64: Use CLK/64 |
reiniermarcel | 0:a115ff47d1c1 | 432 | /// - TP_ADC_CLKDIV_128: Use CLK/128 |
reiniermarcel | 0:a115ff47d1c1 | 433 | /// @param[in] bTpAdcSampleTime Touch Panel sample time delay before ADC data is ready: |
reiniermarcel | 0:a115ff47d1c1 | 434 | /// - TP_ADC_SAMPLE_512_CLKS: Wait 512 system clocks |
reiniermarcel | 0:a115ff47d1c1 | 435 | /// - TP_ADC_SAMPLE_1024_CLKS: Wait 1024 system clocks |
reiniermarcel | 0:a115ff47d1c1 | 436 | /// - TP_ADC_SAMPLE_2048_CLKS: Wait 2048 system clocks |
reiniermarcel | 0:a115ff47d1c1 | 437 | /// - TP_ADC_SAMPLE_4096_CLKS: Wait 4096 system clocks |
reiniermarcel | 0:a115ff47d1c1 | 438 | /// - TP_ADC_SAMPLE_8192_CLKS: Wait 8192 system clocks |
reiniermarcel | 0:a115ff47d1c1 | 439 | /// - TP_ADC_SAMPLE_16384_CLKS: Wait 16384 system clocks |
reiniermarcel | 0:a115ff47d1c1 | 440 | /// - TP_ADC_SAMPLE_32768_CLKS: Wait 32768 system clocks |
reiniermarcel | 0:a115ff47d1c1 | 441 | /// - TP_ADC_SAMPLE_65536_CLKS: Wait 65536 system clocks |
reiniermarcel | 0:a115ff47d1c1 | 442 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 443 | /// |
reiniermarcel | 0:a115ff47d1c1 | 444 | RetCode_t TouchPanelInit(uint8_t bTpEnable, uint8_t bTpAutoManual, uint8_t bTpDebounce, |
reiniermarcel | 0:a115ff47d1c1 | 445 | uint8_t bTpManualMode, uint8_t bTpAdcClkDiv, uint8_t bTpAdcSampleTime); |
reiniermarcel | 0:a115ff47d1c1 | 446 | |
reiniermarcel | 0:a115ff47d1c1 | 447 | /// Poll the TouchPanel and on a touch event return the a to d filtered x, y coordinates. |
reiniermarcel | 0:a115ff47d1c1 | 448 | /// |
reiniermarcel | 0:a115ff47d1c1 | 449 | /// This method reads the touch controller, which has a 10-bit range for each the |
reiniermarcel | 0:a115ff47d1c1 | 450 | /// x and the y axis. |
reiniermarcel | 0:a115ff47d1c1 | 451 | /// |
reiniermarcel | 0:a115ff47d1c1 | 452 | /// @note The returned values are not in display (pixel) units but are in analog to |
reiniermarcel | 0:a115ff47d1c1 | 453 | /// digital converter units. |
reiniermarcel | 0:a115ff47d1c1 | 454 | /// |
reiniermarcel | 0:a115ff47d1c1 | 455 | /// @note This API is usually not needed. @see TouchPanelComputeCalibration. |
reiniermarcel | 0:a115ff47d1c1 | 456 | /// @see TouchPanelReadable. |
reiniermarcel | 0:a115ff47d1c1 | 457 | /// |
reiniermarcel | 0:a115ff47d1c1 | 458 | /// @param[out] x is the x scale a/d value. |
reiniermarcel | 0:a115ff47d1c1 | 459 | /// @param[out] y is the y scale a/d value. |
reiniermarcel | 0:a115ff47d1c1 | 460 | /// @returns true if touch was detected, in which case the x and y values were set. |
reiniermarcel | 0:a115ff47d1c1 | 461 | /// |
reiniermarcel | 0:a115ff47d1c1 | 462 | bool TouchPanelA2DFiltered(loc_t *x, loc_t *y); |
reiniermarcel | 0:a115ff47d1c1 | 463 | |
reiniermarcel | 0:a115ff47d1c1 | 464 | /// Poll the TouchPanel and on a touch event return the a to d raw x, y coordinates. |
reiniermarcel | 0:a115ff47d1c1 | 465 | /// |
reiniermarcel | 0:a115ff47d1c1 | 466 | /// This method reads the touch controller, which has a 10-bit range for each the |
reiniermarcel | 0:a115ff47d1c1 | 467 | /// x and the y axis. A number of samples of the raw data are taken, filtered, |
reiniermarcel | 0:a115ff47d1c1 | 468 | /// and the results are returned. |
reiniermarcel | 0:a115ff47d1c1 | 469 | /// |
reiniermarcel | 0:a115ff47d1c1 | 470 | /// @note The returned values are not in display (pixel) units but are in analog to |
reiniermarcel | 0:a115ff47d1c1 | 471 | /// digital converter units. |
reiniermarcel | 0:a115ff47d1c1 | 472 | /// |
reiniermarcel | 0:a115ff47d1c1 | 473 | /// @note This API is usually not needed. @see TouchPanelComputeCalibration. |
reiniermarcel | 0:a115ff47d1c1 | 474 | /// @see TouchPanelReadable. |
reiniermarcel | 0:a115ff47d1c1 | 475 | /// |
reiniermarcel | 0:a115ff47d1c1 | 476 | /// @param[out] x is the x scale a/d value. |
reiniermarcel | 0:a115ff47d1c1 | 477 | /// @param[out] y is the y scale a/d value. |
reiniermarcel | 0:a115ff47d1c1 | 478 | /// @returns true if touch was detected, in which case the x and y values were set. |
reiniermarcel | 0:a115ff47d1c1 | 479 | /// |
reiniermarcel | 0:a115ff47d1c1 | 480 | bool TouchPanelA2DRaw(loc_t *x, loc_t *y); |
reiniermarcel | 0:a115ff47d1c1 | 481 | |
reiniermarcel | 0:a115ff47d1c1 | 482 | /// Calibrate the touch panel. |
reiniermarcel | 0:a115ff47d1c1 | 483 | /// |
reiniermarcel | 0:a115ff47d1c1 | 484 | /// This method accepts two lists - one list is target points in , |
reiniermarcel | 0:a115ff47d1c1 | 485 | /// display coordinates and the other is a lit of raw touch coordinate |
reiniermarcel | 0:a115ff47d1c1 | 486 | /// values. It generates a calibration matrix for later use. This |
reiniermarcel | 0:a115ff47d1c1 | 487 | /// matrix is also accessible to the calling API, which may store |
reiniermarcel | 0:a115ff47d1c1 | 488 | /// the matrix in persistent memory and then install the calibration |
reiniermarcel | 0:a115ff47d1c1 | 489 | /// matrix on the next power cycle. By doing so, it can avoid the |
reiniermarcel | 0:a115ff47d1c1 | 490 | /// need to calibrate on every power cycle. |
reiniermarcel | 0:a115ff47d1c1 | 491 | /// |
reiniermarcel | 0:a115ff47d1c1 | 492 | /// @note The methods "TouchPanelComputeCalibration", "TouchPanelReadable", and |
reiniermarcel | 0:a115ff47d1c1 | 493 | /// indirectly the "TouchPanelSetMatrix" methods are all derived |
reiniermarcel | 0:a115ff47d1c1 | 494 | /// from a program by Carlos E. Vidales. See the copyright note |
reiniermarcel | 0:a115ff47d1c1 | 495 | /// for further details. See also the article |
reiniermarcel | 0:a115ff47d1c1 | 496 | /// http://www.embedded.com/design/system-integration/4023968/How-To-Calibrate-Touch-Screens |
reiniermarcel | 0:a115ff47d1c1 | 497 | /// |
reiniermarcel | 0:a115ff47d1c1 | 498 | /// @copyright Copyright (c) 2001, Carlos E. Vidales. All rights reserved. |
reiniermarcel | 0:a115ff47d1c1 | 499 | /// This sample program was written and put in the public domain |
reiniermarcel | 0:a115ff47d1c1 | 500 | /// by Carlos E. Vidales. The program is provided "as is" |
reiniermarcel | 0:a115ff47d1c1 | 501 | /// without warranty of any kind, either expressed or implied. |
reiniermarcel | 0:a115ff47d1c1 | 502 | /// If you choose to use the program within your own products |
reiniermarcel | 0:a115ff47d1c1 | 503 | /// you do so at your own risk, and assume the responsibility |
reiniermarcel | 0:a115ff47d1c1 | 504 | /// for servicing, repairing or correcting the program should |
reiniermarcel | 0:a115ff47d1c1 | 505 | /// it prove defective in any manner. |
reiniermarcel | 0:a115ff47d1c1 | 506 | /// You may copy and distribute the program's source code in any |
reiniermarcel | 0:a115ff47d1c1 | 507 | /// medium, provided that you also include in each copy an |
reiniermarcel | 0:a115ff47d1c1 | 508 | /// appropriate copyright notice and disclaimer of warranty. |
reiniermarcel | 0:a115ff47d1c1 | 509 | /// You may also modify this program and distribute copies of |
reiniermarcel | 0:a115ff47d1c1 | 510 | /// it provided that you include prominent notices stating |
reiniermarcel | 0:a115ff47d1c1 | 511 | /// that you changed the file(s) and the date of any change, |
reiniermarcel | 0:a115ff47d1c1 | 512 | /// and that you do not charge any royalties or licenses for |
reiniermarcel | 0:a115ff47d1c1 | 513 | /// its use. |
reiniermarcel | 0:a115ff47d1c1 | 514 | /// |
reiniermarcel | 0:a115ff47d1c1 | 515 | /// @param[in] display is a pointer to a set of 3 points, which |
reiniermarcel | 0:a115ff47d1c1 | 516 | /// are in display units of measure. These are the targets |
reiniermarcel | 0:a115ff47d1c1 | 517 | /// the calibration was aiming for. |
reiniermarcel | 0:a115ff47d1c1 | 518 | /// @param[in] screen is a pointer to a set of 3 points, which |
reiniermarcel | 0:a115ff47d1c1 | 519 | /// are in touchscreen units of measure. These are the |
reiniermarcel | 0:a115ff47d1c1 | 520 | /// registered touches. |
reiniermarcel | 0:a115ff47d1c1 | 521 | /// @param[out] matrix is an optional parameter to hold the calibration matrix |
reiniermarcel | 0:a115ff47d1c1 | 522 | /// as a result of the calibration. This can be saved in |
reiniermarcel | 0:a115ff47d1c1 | 523 | /// non-volatile memory to recover the calibration after a power fail. |
reiniermarcel | 0:a115ff47d1c1 | 524 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 525 | /// |
reiniermarcel | 0:a115ff47d1c1 | 526 | RetCode_t TouchPanelComputeCalibration(point_t display[3], point_t screen[3], tpMatrix_t * matrix); |
reiniermarcel | 0:a115ff47d1c1 | 527 | |
reiniermarcel | 0:a115ff47d1c1 | 528 | |
reiniermarcel | 0:a115ff47d1c1 | 529 | /// Perform the touch panel calibration process. |
reiniermarcel | 0:a115ff47d1c1 | 530 | /// |
reiniermarcel | 0:a115ff47d1c1 | 531 | /// This method provides the easy "shortcut" to calibrating the touch panel. |
reiniermarcel | 0:a115ff47d1c1 | 532 | /// The process will automatically generate the calibration points, present |
reiniermarcel | 0:a115ff47d1c1 | 533 | /// the targets on-screen, detect the touches, compute the calibration |
reiniermarcel | 0:a115ff47d1c1 | 534 | /// matrix, and optionally provide the calibration matrix to the calling code |
reiniermarcel | 0:a115ff47d1c1 | 535 | /// for persistence in non-volatile memory. |
reiniermarcel | 0:a115ff47d1c1 | 536 | /// |
reiniermarcel | 0:a115ff47d1c1 | 537 | /// @param[out] matrix is an optional parameter to hold the calibration matrix |
reiniermarcel | 0:a115ff47d1c1 | 538 | /// as a result of the calibration. This can be saved in |
reiniermarcel | 0:a115ff47d1c1 | 539 | /// non-volatile memory to recover the calibration after a power fail. |
reiniermarcel | 0:a115ff47d1c1 | 540 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 541 | /// |
reiniermarcel | 0:a115ff47d1c1 | 542 | RetCode_t TouchPanelCalibrate(tpMatrix_t * matrix); |
reiniermarcel | 0:a115ff47d1c1 | 543 | |
reiniermarcel | 0:a115ff47d1c1 | 544 | /// Perform the touch panel calibration process. |
reiniermarcel | 0:a115ff47d1c1 | 545 | /// |
reiniermarcel | 0:a115ff47d1c1 | 546 | /// This method provides the easy "shortcut" to calibrating the touch panel. |
reiniermarcel | 0:a115ff47d1c1 | 547 | /// The process will automatically generate the calibration points, present |
reiniermarcel | 0:a115ff47d1c1 | 548 | /// the targets on-screen, detect the touches, compute the calibration |
reiniermarcel | 0:a115ff47d1c1 | 549 | /// matrix, and optionally provide the calibration matrix to the calling code |
reiniermarcel | 0:a115ff47d1c1 | 550 | /// for persistence in non-volatile memory. |
reiniermarcel | 0:a115ff47d1c1 | 551 | /// |
reiniermarcel | 0:a115ff47d1c1 | 552 | /// @param[in] msg is a text message to present on the screen during the |
reiniermarcel | 0:a115ff47d1c1 | 553 | /// calibration process. |
reiniermarcel | 0:a115ff47d1c1 | 554 | /// @param[out] matrix is an optional parameter to hold the calibration matrix |
reiniermarcel | 0:a115ff47d1c1 | 555 | /// as a result of the calibration. This can be saved in |
reiniermarcel | 0:a115ff47d1c1 | 556 | /// non-volatile memory to recover the calibration after a power fail. |
reiniermarcel | 0:a115ff47d1c1 | 557 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 558 | /// |
reiniermarcel | 0:a115ff47d1c1 | 559 | RetCode_t TouchPanelCalibrate(const char * msg, tpMatrix_t * matrix = NULL); |
reiniermarcel | 0:a115ff47d1c1 | 560 | |
reiniermarcel | 0:a115ff47d1c1 | 561 | /// Get the screen calibrated point of touch. |
reiniermarcel | 0:a115ff47d1c1 | 562 | /// |
reiniermarcel | 0:a115ff47d1c1 | 563 | /// This method determines if there is a touch and if so it will provide |
reiniermarcel | 0:a115ff47d1c1 | 564 | /// the screen-relative touch coordinates. This method can be used in |
reiniermarcel | 0:a115ff47d1c1 | 565 | /// a manner similar to Serial.readable(), to determine if there was a |
reiniermarcel | 0:a115ff47d1c1 | 566 | /// touch and indicate that - but not care about the coordinates. Alternately, |
reiniermarcel | 0:a115ff47d1c1 | 567 | /// if a valid pointer to a point_t is provided, then if a touch is detected |
reiniermarcel | 0:a115ff47d1c1 | 568 | /// the point_t will be populated with data. |
reiniermarcel | 0:a115ff47d1c1 | 569 | /// |
reiniermarcel | 0:a115ff47d1c1 | 570 | /// @code |
reiniermarcel | 0:a115ff47d1c1 | 571 | /// Timer t; |
reiniermarcel | 0:a115ff47d1c1 | 572 | /// t.start(); |
reiniermarcel | 0:a115ff47d1c1 | 573 | /// do { |
reiniermarcel | 0:a115ff47d1c1 | 574 | /// point_t point = {0, 0}; |
reiniermarcel | 0:a115ff47d1c1 | 575 | /// if (display.TouchPanelReadable(&point)) { |
reiniermarcel | 0:a115ff47d1c1 | 576 | /// display.pixel(point.x, point.y, Red); |
reiniermarcel | 0:a115ff47d1c1 | 577 | /// } |
reiniermarcel | 0:a115ff47d1c1 | 578 | /// } while (t.read_ms() < 30000); |
reiniermarcel | 0:a115ff47d1c1 | 579 | /// @endcode |
reiniermarcel | 0:a115ff47d1c1 | 580 | /// |
reiniermarcel | 0:a115ff47d1c1 | 581 | /// @param[out] touch is the touch point, if a touch is registered. |
reiniermarcel | 0:a115ff47d1c1 | 582 | /// @returns true if a touch was registered, and touch is updated. |
reiniermarcel | 0:a115ff47d1c1 | 583 | /// @returns false if no touch was detected, or if the calibration matrix is not defined. |
reiniermarcel | 0:a115ff47d1c1 | 584 | /// |
reiniermarcel | 0:a115ff47d1c1 | 585 | bool TouchPanelReadable(point_t * touch = NULL); |
reiniermarcel | 0:a115ff47d1c1 | 586 | |
reiniermarcel | 0:a115ff47d1c1 | 587 | /// Wait for a touch panel touch and return it. |
reiniermarcel | 0:a115ff47d1c1 | 588 | /// |
reiniermarcel | 0:a115ff47d1c1 | 589 | /// This method is similar to Serial.getc() in that it will wait for a touch |
reiniermarcel | 0:a115ff47d1c1 | 590 | /// and then return. In order to extract the coordinates of the touch, a |
reiniermarcel | 0:a115ff47d1c1 | 591 | /// valid pointer to a point_t must be provided. |
reiniermarcel | 0:a115ff47d1c1 | 592 | /// |
reiniermarcel | 0:a115ff47d1c1 | 593 | /// @note There is no timeout on this function, so its use is not recommended. |
reiniermarcel | 0:a115ff47d1c1 | 594 | /// |
reiniermarcel | 0:a115ff47d1c1 | 595 | /// @code |
reiniermarcel | 0:a115ff47d1c1 | 596 | /// Timer t; |
reiniermarcel | 0:a115ff47d1c1 | 597 | /// t.start(); |
reiniermarcel | 0:a115ff47d1c1 | 598 | /// do { |
reiniermarcel | 0:a115ff47d1c1 | 599 | /// point_t point = {0, 0}; |
reiniermarcel | 0:a115ff47d1c1 | 600 | /// display.TouchPanelGet(&point); |
reiniermarcel | 0:a115ff47d1c1 | 601 | /// display.pixel(point.x, point.y, Red); |
reiniermarcel | 0:a115ff47d1c1 | 602 | /// } while (t.read_ms() < 30000); |
reiniermarcel | 0:a115ff47d1c1 | 603 | /// @endcode |
reiniermarcel | 0:a115ff47d1c1 | 604 | /// |
reiniermarcel | 0:a115ff47d1c1 | 605 | /// @param[out] touch is the touch point, if a touch is registered. |
reiniermarcel | 0:a115ff47d1c1 | 606 | /// @returns true if a touch was registered, and touch is updated. |
reiniermarcel | 0:a115ff47d1c1 | 607 | /// @returns false if no touch was detected, or if the calibration matrix is not defined. |
reiniermarcel | 0:a115ff47d1c1 | 608 | /// |
reiniermarcel | 0:a115ff47d1c1 | 609 | bool TouchPanelGet(point_t * touch); |
reiniermarcel | 0:a115ff47d1c1 | 610 | |
reiniermarcel | 0:a115ff47d1c1 | 611 | /// Set the calibration matrix for the touch panel. |
reiniermarcel | 0:a115ff47d1c1 | 612 | /// |
reiniermarcel | 0:a115ff47d1c1 | 613 | /// This method is used to set the calibration matrix for the touch panel. After |
reiniermarcel | 0:a115ff47d1c1 | 614 | /// performing the calibration (@see TouchPanelComputeCalibration), the matrix can be stored. |
reiniermarcel | 0:a115ff47d1c1 | 615 | /// On a subsequence power cycle, the matrix may be restored from non-volatile and |
reiniermarcel | 0:a115ff47d1c1 | 616 | /// passed in to this method. It will then be held to perform the corrections when |
reiniermarcel | 0:a115ff47d1c1 | 617 | /// reading the touch panel point. |
reiniermarcel | 0:a115ff47d1c1 | 618 | /// |
reiniermarcel | 0:a115ff47d1c1 | 619 | /// @code |
reiniermarcel | 0:a115ff47d1c1 | 620 | /// FILE * fh = fopen("/local/tpmatrix.cfg", "r"); |
reiniermarcel | 0:a115ff47d1c1 | 621 | /// if (fh) { |
reiniermarcel | 0:a115ff47d1c1 | 622 | /// tpMatrix_t matrix; |
reiniermarcel | 0:a115ff47d1c1 | 623 | /// if (fread(fh, &matrix, sizeof(tpMatrix_t))) { |
reiniermarcel | 0:a115ff47d1c1 | 624 | /// lcd.TouchPanelSetMatrix(&matrix); |
reiniermarcel | 0:a115ff47d1c1 | 625 | /// } |
reiniermarcel | 0:a115ff47d1c1 | 626 | /// fclose(fh); |
reiniermarcel | 0:a115ff47d1c1 | 627 | /// } |
reiniermarcel | 0:a115ff47d1c1 | 628 | /// @endcode |
reiniermarcel | 0:a115ff47d1c1 | 629 | /// |
reiniermarcel | 0:a115ff47d1c1 | 630 | /// @param[in] matrix is a pointer to the touch panel calibration matrix. |
reiniermarcel | 0:a115ff47d1c1 | 631 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 632 | /// |
reiniermarcel | 0:a115ff47d1c1 | 633 | RetCode_t TouchPanelSetMatrix(tpMatrix_t * matrix); |
reiniermarcel | 0:a115ff47d1c1 | 634 | |
reiniermarcel | 0:a115ff47d1c1 | 635 | #if 0 |
reiniermarcel | 0:a115ff47d1c1 | 636 | /// Append interrupt handler for specific RA8875 interrupt source |
reiniermarcel | 0:a115ff47d1c1 | 637 | /// |
reiniermarcel | 0:a115ff47d1c1 | 638 | /// @param[in] bISRType Interrupt Source, should be: |
reiniermarcel | 0:a115ff47d1c1 | 639 | /// - RA8875_INT_KEYSCAN: KEYCAN interrupt |
reiniermarcel | 0:a115ff47d1c1 | 640 | /// - RA8875_INT_DMA: DMA interrupt |
reiniermarcel | 0:a115ff47d1c1 | 641 | /// - RA8875_INT_TP: Touch panel interrupt |
reiniermarcel | 0:a115ff47d1c1 | 642 | /// - RA8875_INT_BTE: BTE process complete interrupt |
reiniermarcel | 0:a115ff47d1c1 | 643 | /// - RA8875_INT_BTEMCU_FONTWR: Multi-purpose interrupt (see spec sheet) |
reiniermarcel | 0:a115ff47d1c1 | 644 | /// @param[in] fptr is a callback function to handle the interrupt event. |
reiniermarcel | 0:a115ff47d1c1 | 645 | /// @returns none |
reiniermarcel | 0:a115ff47d1c1 | 646 | /// |
reiniermarcel | 0:a115ff47d1c1 | 647 | void AppendISR(uint8_t bISRType, void(*fptr)(void)); |
reiniermarcel | 0:a115ff47d1c1 | 648 | |
reiniermarcel | 0:a115ff47d1c1 | 649 | /// Unappend interrupt handler for specific RA8875 interrupt source |
reiniermarcel | 0:a115ff47d1c1 | 650 | /// |
reiniermarcel | 0:a115ff47d1c1 | 651 | /// @param[in] bISRType Interrupt Source, should be: |
reiniermarcel | 0:a115ff47d1c1 | 652 | /// - RA8875_INT_KEYSCAN: KEYCAN interrupt |
reiniermarcel | 0:a115ff47d1c1 | 653 | /// - RA8875_INT_DMA: DMA interrupt |
reiniermarcel | 0:a115ff47d1c1 | 654 | /// - RA8875_INT_TP: Touch panel interrupt |
reiniermarcel | 0:a115ff47d1c1 | 655 | /// - RA8875_INT_BTE: BTE process complete interrupt |
reiniermarcel | 0:a115ff47d1c1 | 656 | /// - RA8875_INT_BTEMCU_FONTWR: Multi-purpose interrupt (see spec sheet) |
reiniermarcel | 0:a115ff47d1c1 | 657 | /// @return none |
reiniermarcel | 0:a115ff47d1c1 | 658 | /// |
reiniermarcel | 0:a115ff47d1c1 | 659 | void UnAppendISR(uint8_t bISRType); |
reiniermarcel | 0:a115ff47d1c1 | 660 | #endif |
reiniermarcel | 0:a115ff47d1c1 | 661 | |
reiniermarcel | 0:a115ff47d1c1 | 662 | /// Initialize the keypad interface on the RA8875 controller. |
reiniermarcel | 0:a115ff47d1c1 | 663 | /// |
reiniermarcel | 0:a115ff47d1c1 | 664 | /// Enables the keypad subsystem. It will scan the 4 x 5 matrix |
reiniermarcel | 0:a115ff47d1c1 | 665 | /// and make available key presses. |
reiniermarcel | 0:a115ff47d1c1 | 666 | /// |
reiniermarcel | 0:a115ff47d1c1 | 667 | /// @note See section 5-13 of RAIO RA8875 data sheet for more details. |
reiniermarcel | 0:a115ff47d1c1 | 668 | /// @caution When using the display from buy-display.com, be sure that |
reiniermarcel | 0:a115ff47d1c1 | 669 | /// the option for the keypad is configured on the hardware. |
reiniermarcel | 0:a115ff47d1c1 | 670 | /// |
reiniermarcel | 0:a115ff47d1c1 | 671 | /// All parameters are optional. |
reiniermarcel | 0:a115ff47d1c1 | 672 | /// @param[in] scanEnable when true, enables the key scan function (default: true). |
reiniermarcel | 0:a115ff47d1c1 | 673 | /// @param[in] longDetect when true, additionally enables the long key held detection (default: false). |
reiniermarcel | 0:a115ff47d1c1 | 674 | /// @param[in] sampleTime setting (range: 0 - 3, default: 0). |
reiniermarcel | 0:a115ff47d1c1 | 675 | /// @param[in] scanFrequency setting (range: 0 - 7, default: 0). |
reiniermarcel | 0:a115ff47d1c1 | 676 | /// @param[in] longTimeAdjustment (range: 0 - 3, default: 0). |
reiniermarcel | 0:a115ff47d1c1 | 677 | /// @param[in] interruptEnable when true, enables interrupts from keypress (default: false). |
reiniermarcel | 0:a115ff47d1c1 | 678 | /// @param[in] wakeupEnable when true, activates the wakeup function (default: false). |
reiniermarcel | 0:a115ff47d1c1 | 679 | /// |
reiniermarcel | 0:a115ff47d1c1 | 680 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 681 | /// |
reiniermarcel | 0:a115ff47d1c1 | 682 | RetCode_t KeypadInit(bool scanEnable = true, bool longDetect = false, |
reiniermarcel | 0:a115ff47d1c1 | 683 | uint8_t sampleTime = 0, uint8_t scanFrequency = 0, |
reiniermarcel | 0:a115ff47d1c1 | 684 | uint8_t longTimeAdjustment = 0, |
reiniermarcel | 0:a115ff47d1c1 | 685 | bool interruptEnable = false, bool wakeupEnable = false); |
reiniermarcel | 0:a115ff47d1c1 | 686 | |
reiniermarcel | 0:a115ff47d1c1 | 687 | /// Create Key Code definitions for the key matrix. |
reiniermarcel | 0:a115ff47d1c1 | 688 | /// |
reiniermarcel | 0:a115ff47d1c1 | 689 | /// This API provides a table of 22 key-code assignments for the matrix of keys. |
reiniermarcel | 0:a115ff47d1c1 | 690 | /// This can be used to translate the keys 1 - 20 into some other value, as |
reiniermarcel | 0:a115ff47d1c1 | 691 | /// well as to communicate the "no key" (zero) and "error state" (21). |
reiniermarcel | 0:a115ff47d1c1 | 692 | /// |
reiniermarcel | 0:a115ff47d1c1 | 693 | /// In this way, a keypad could easily emulate a piece of a keyboard, transforming |
reiniermarcel | 0:a115ff47d1c1 | 694 | /// 0 - 20 into the values 0, '0', '1', '2', '3', '4', '5', '6', '7', '8', |
reiniermarcel | 0:a115ff47d1c1 | 695 | /// '9', '+', '-', '*' , '/', '=', '<bs>', '<cr>', and so on... |
reiniermarcel | 0:a115ff47d1c1 | 696 | /// |
reiniermarcel | 0:a115ff47d1c1 | 697 | /// @code |
reiniermarcel | 0:a115ff47d1c1 | 698 | /// // Return Value by Row, Column Example reassignment |
reiniermarcel | 0:a115ff47d1c1 | 699 | /// // Column 0 1 2 3 4 |
reiniermarcel | 0:a115ff47d1c1 | 700 | /// // +-------------------------+ +-------------------------+ |
reiniermarcel | 0:a115ff47d1c1 | 701 | /// // Row 0 | 1 2 3 4 5 | | '7' '8' '9' ',' '<-' | |
reiniermarcel | 0:a115ff47d1c1 | 702 | /// // 1 | 6 7 8 9 10 | | '4' '5' '6' '/' '-' | |
reiniermarcel | 0:a115ff47d1c1 | 703 | /// // 2 | 11 12 13 14 15 | | '1' '2' '3' '*' '+' | |
reiniermarcel | 0:a115ff47d1c1 | 704 | /// // 3 | 16 17 18 19 20 | | '0' '.' '(' ')' '\n' | |
reiniermarcel | 0:a115ff47d1c1 | 705 | /// // +-------------------------+ +-------------------------+ |
reiniermarcel | 0:a115ff47d1c1 | 706 | /// // Return value 0 = No Key pressed |
reiniermarcel | 0:a115ff47d1c1 | 707 | /// // Return value 21 = Error |
reiniermarcel | 0:a115ff47d1c1 | 708 | /// const uint8_t CodeList[22] = |
reiniermarcel | 0:a115ff47d1c1 | 709 | /// {0, '7', '8', '9', ',', '\h', |
reiniermarcel | 0:a115ff47d1c1 | 710 | /// '4', '5', '6', '/', '-', |
reiniermarcel | 0:a115ff47d1c1 | 711 | /// '1', '2', '3', '*', '+', |
reiniermarcel | 0:a115ff47d1c1 | 712 | /// '0', '.', '(', ')', '\n', |
reiniermarcel | 0:a115ff47d1c1 | 713 | /// '\x1b'}; |
reiniermarcel | 0:a115ff47d1c1 | 714 | /// lcd.SetKeyMap(CodeList); |
reiniermarcel | 0:a115ff47d1c1 | 715 | /// @endcode |
reiniermarcel | 0:a115ff47d1c1 | 716 | /// |
reiniermarcel | 0:a115ff47d1c1 | 717 | /// @param[in] CodeList is a pointer to an always available byte-array |
reiniermarcel | 0:a115ff47d1c1 | 718 | /// where the first 22 bytes are used as the transformation |
reiniermarcel | 0:a115ff47d1c1 | 719 | /// from raw code to your reassigned value. |
reiniermarcel | 0:a115ff47d1c1 | 720 | /// If CodeList is NULL, the original raw value key map is |
reiniermarcel | 0:a115ff47d1c1 | 721 | /// restored. |
reiniermarcel | 0:a115ff47d1c1 | 722 | /// @returns noerror. |
reiniermarcel | 0:a115ff47d1c1 | 723 | /// |
reiniermarcel | 0:a115ff47d1c1 | 724 | RetCode_t SetKeyMap(const uint8_t * CodeList = NULL); |
reiniermarcel | 0:a115ff47d1c1 | 725 | |
reiniermarcel | 0:a115ff47d1c1 | 726 | /// Determine if a key has been hit |
reiniermarcel | 0:a115ff47d1c1 | 727 | /// |
reiniermarcel | 0:a115ff47d1c1 | 728 | /// @returns true if a key has been hit |
reiniermarcel | 0:a115ff47d1c1 | 729 | /// |
reiniermarcel | 0:a115ff47d1c1 | 730 | bool readable(); |
reiniermarcel | 0:a115ff47d1c1 | 731 | |
reiniermarcel | 0:a115ff47d1c1 | 732 | /// Blocking read of the keypad. |
reiniermarcel | 0:a115ff47d1c1 | 733 | /// |
reiniermarcel | 0:a115ff47d1c1 | 734 | /// @caution: This is a blocking read, so it is important to first call _kbhit() |
reiniermarcel | 0:a115ff47d1c1 | 735 | /// to avoid hanging your processes. |
reiniermarcel | 0:a115ff47d1c1 | 736 | /// |
reiniermarcel | 0:a115ff47d1c1 | 737 | /// A keypad connected to the RA8875 is connected in a matrix of 4 rows and 5 columns. |
reiniermarcel | 0:a115ff47d1c1 | 738 | /// When pressed, this method will return a code in the range of 1 through 20, reserving |
reiniermarcel | 0:a115ff47d1c1 | 739 | /// the value 0 to indicate that no key is pressed. |
reiniermarcel | 0:a115ff47d1c1 | 740 | /// |
reiniermarcel | 0:a115ff47d1c1 | 741 | /// Additionally, if configured to detect a "long press", bit 7 will be set to indicate |
reiniermarcel | 0:a115ff47d1c1 | 742 | /// this. In this situation, first a "normal press" would be detected and signaled and |
reiniermarcel | 0:a115ff47d1c1 | 743 | /// soon after that a "long press" of the same key would be detected and communicated. |
reiniermarcel | 0:a115ff47d1c1 | 744 | /// |
reiniermarcel | 0:a115ff47d1c1 | 745 | /// @return 8-bit where bit 7 indicates a long press. The remaining bits indicate the |
reiniermarcel | 0:a115ff47d1c1 | 746 | /// keypress using 0 = no key pressed, 1 - 20 = the key pressed. |
reiniermarcel | 0:a115ff47d1c1 | 747 | /// |
reiniermarcel | 0:a115ff47d1c1 | 748 | uint8_t getc(); |
reiniermarcel | 0:a115ff47d1c1 | 749 | |
reiniermarcel | 0:a115ff47d1c1 | 750 | /// Write a command to the display with a word of data. |
reiniermarcel | 0:a115ff47d1c1 | 751 | /// |
reiniermarcel | 0:a115ff47d1c1 | 752 | /// This is a high level command, and may invoke several primitives. |
reiniermarcel | 0:a115ff47d1c1 | 753 | /// |
reiniermarcel | 0:a115ff47d1c1 | 754 | /// @param[in] command is the command to write. |
reiniermarcel | 0:a115ff47d1c1 | 755 | /// @param[in] data is data to be written to the command register. |
reiniermarcel | 0:a115ff47d1c1 | 756 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 757 | /// |
reiniermarcel | 0:a115ff47d1c1 | 758 | RetCode_t WriteCommandW(uint8_t command, uint16_t data); |
reiniermarcel | 0:a115ff47d1c1 | 759 | |
reiniermarcel | 0:a115ff47d1c1 | 760 | /// Write a command to the display |
reiniermarcel | 0:a115ff47d1c1 | 761 | /// |
reiniermarcel | 0:a115ff47d1c1 | 762 | /// This is a high level command, and may invoke several primitives. |
reiniermarcel | 0:a115ff47d1c1 | 763 | /// |
reiniermarcel | 0:a115ff47d1c1 | 764 | /// @param[in] command is the command to write. |
reiniermarcel | 0:a115ff47d1c1 | 765 | /// @param[in] data is optional data to be written to the command register |
reiniermarcel | 0:a115ff47d1c1 | 766 | /// and only occurs if the data is in the range [0 - 0xFF]. |
reiniermarcel | 0:a115ff47d1c1 | 767 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 768 | /// |
reiniermarcel | 0:a115ff47d1c1 | 769 | virtual RetCode_t WriteCommand(unsigned char command, unsigned int data = 0xFFFF); |
reiniermarcel | 0:a115ff47d1c1 | 770 | |
reiniermarcel | 0:a115ff47d1c1 | 771 | /// Write a data word to the display |
reiniermarcel | 0:a115ff47d1c1 | 772 | /// |
reiniermarcel | 0:a115ff47d1c1 | 773 | /// This is a high level command, and may invoke several primitives. |
reiniermarcel | 0:a115ff47d1c1 | 774 | /// |
reiniermarcel | 0:a115ff47d1c1 | 775 | /// @param[in] data is the data to write. |
reiniermarcel | 0:a115ff47d1c1 | 776 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 777 | /// |
reiniermarcel | 0:a115ff47d1c1 | 778 | RetCode_t WriteDataW(uint16_t data); |
reiniermarcel | 0:a115ff47d1c1 | 779 | |
reiniermarcel | 0:a115ff47d1c1 | 780 | /// Write a data byte to the display |
reiniermarcel | 0:a115ff47d1c1 | 781 | /// |
reiniermarcel | 0:a115ff47d1c1 | 782 | /// This is a high level command, and may invoke several primitives. |
reiniermarcel | 0:a115ff47d1c1 | 783 | /// |
reiniermarcel | 0:a115ff47d1c1 | 784 | /// @param[in] data is the data to write. |
reiniermarcel | 0:a115ff47d1c1 | 785 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 786 | /// |
reiniermarcel | 0:a115ff47d1c1 | 787 | virtual RetCode_t WriteData(unsigned char data); |
reiniermarcel | 0:a115ff47d1c1 | 788 | |
reiniermarcel | 0:a115ff47d1c1 | 789 | /// Read a command register |
reiniermarcel | 0:a115ff47d1c1 | 790 | /// |
reiniermarcel | 0:a115ff47d1c1 | 791 | /// @param[in] command is the command register to read. |
reiniermarcel | 0:a115ff47d1c1 | 792 | /// @returns the value read from the register. |
reiniermarcel | 0:a115ff47d1c1 | 793 | /// |
reiniermarcel | 0:a115ff47d1c1 | 794 | unsigned char ReadCommand(unsigned char command); |
reiniermarcel | 0:a115ff47d1c1 | 795 | |
reiniermarcel | 0:a115ff47d1c1 | 796 | /// Read a data byte from the display |
reiniermarcel | 0:a115ff47d1c1 | 797 | /// |
reiniermarcel | 0:a115ff47d1c1 | 798 | /// This is a high level command, and may invoke several primitives. |
reiniermarcel | 0:a115ff47d1c1 | 799 | /// |
reiniermarcel | 0:a115ff47d1c1 | 800 | /// @returns data that was read. |
reiniermarcel | 0:a115ff47d1c1 | 801 | /// |
reiniermarcel | 0:a115ff47d1c1 | 802 | unsigned char ReadData(void); |
reiniermarcel | 0:a115ff47d1c1 | 803 | |
reiniermarcel | 0:a115ff47d1c1 | 804 | /// Read a word from the display |
reiniermarcel | 0:a115ff47d1c1 | 805 | /// |
reiniermarcel | 0:a115ff47d1c1 | 806 | /// This is a high level command, and may invoke several primitives. |
reiniermarcel | 0:a115ff47d1c1 | 807 | /// |
reiniermarcel | 0:a115ff47d1c1 | 808 | /// @returns data that was read. |
reiniermarcel | 0:a115ff47d1c1 | 809 | /// |
reiniermarcel | 0:a115ff47d1c1 | 810 | uint16_t ReadDataW(void); |
reiniermarcel | 0:a115ff47d1c1 | 811 | |
reiniermarcel | 0:a115ff47d1c1 | 812 | /// Read the display status |
reiniermarcel | 0:a115ff47d1c1 | 813 | /// |
reiniermarcel | 0:a115ff47d1c1 | 814 | /// This is a high level command, and may invoke several primitives. |
reiniermarcel | 0:a115ff47d1c1 | 815 | /// |
reiniermarcel | 0:a115ff47d1c1 | 816 | /// @returns data that was read. |
reiniermarcel | 0:a115ff47d1c1 | 817 | /// |
reiniermarcel | 0:a115ff47d1c1 | 818 | unsigned char ReadStatus(void); |
reiniermarcel | 0:a115ff47d1c1 | 819 | |
reiniermarcel | 0:a115ff47d1c1 | 820 | /// get the width in pixels of the currently active font |
reiniermarcel | 0:a115ff47d1c1 | 821 | /// |
reiniermarcel | 0:a115ff47d1c1 | 822 | /// @returns font width in pixels. |
reiniermarcel | 0:a115ff47d1c1 | 823 | /// |
reiniermarcel | 0:a115ff47d1c1 | 824 | dim_t fontwidth(void); |
reiniermarcel | 0:a115ff47d1c1 | 825 | |
reiniermarcel | 0:a115ff47d1c1 | 826 | /// get the height in pixels of the currently active font |
reiniermarcel | 0:a115ff47d1c1 | 827 | /// |
reiniermarcel | 0:a115ff47d1c1 | 828 | /// @returns font height in pixels. |
reiniermarcel | 0:a115ff47d1c1 | 829 | /// |
reiniermarcel | 0:a115ff47d1c1 | 830 | dim_t fontheight(void); |
reiniermarcel | 0:a115ff47d1c1 | 831 | |
reiniermarcel | 0:a115ff47d1c1 | 832 | /// get the number of colums based on the currently active font |
reiniermarcel | 0:a115ff47d1c1 | 833 | /// |
reiniermarcel | 0:a115ff47d1c1 | 834 | /// @returns number of columns. |
reiniermarcel | 0:a115ff47d1c1 | 835 | /// |
reiniermarcel | 0:a115ff47d1c1 | 836 | virtual int columns(void); |
reiniermarcel | 0:a115ff47d1c1 | 837 | |
reiniermarcel | 0:a115ff47d1c1 | 838 | /// get the number of rows based on the currently active font |
reiniermarcel | 0:a115ff47d1c1 | 839 | /// |
reiniermarcel | 0:a115ff47d1c1 | 840 | /// @returns number of rows. |
reiniermarcel | 0:a115ff47d1c1 | 841 | /// |
reiniermarcel | 0:a115ff47d1c1 | 842 | virtual int rows(void); |
reiniermarcel | 0:a115ff47d1c1 | 843 | |
reiniermarcel | 0:a115ff47d1c1 | 844 | /// get the screen width in pixels |
reiniermarcel | 0:a115ff47d1c1 | 845 | /// |
reiniermarcel | 0:a115ff47d1c1 | 846 | /// @returns screen width in pixels. |
reiniermarcel | 0:a115ff47d1c1 | 847 | /// |
reiniermarcel | 0:a115ff47d1c1 | 848 | virtual dim_t width(void); |
reiniermarcel | 0:a115ff47d1c1 | 849 | |
reiniermarcel | 0:a115ff47d1c1 | 850 | /// get the screen height in pixels |
reiniermarcel | 0:a115ff47d1c1 | 851 | /// |
reiniermarcel | 0:a115ff47d1c1 | 852 | /// @returns screen height in pixels. |
reiniermarcel | 0:a115ff47d1c1 | 853 | /// |
reiniermarcel | 0:a115ff47d1c1 | 854 | virtual dim_t height(void); |
reiniermarcel | 0:a115ff47d1c1 | 855 | |
reiniermarcel | 0:a115ff47d1c1 | 856 | /// get the color depth in bits per pixel. |
reiniermarcel | 0:a115ff47d1c1 | 857 | /// |
reiniermarcel | 0:a115ff47d1c1 | 858 | /// @returns 8 or 16 only. |
reiniermarcel | 0:a115ff47d1c1 | 859 | /// |
reiniermarcel | 0:a115ff47d1c1 | 860 | virtual dim_t color_bpp(void); |
reiniermarcel | 0:a115ff47d1c1 | 861 | |
reiniermarcel | 0:a115ff47d1c1 | 862 | /// Set cursor position based on the current font size. |
reiniermarcel | 0:a115ff47d1c1 | 863 | /// |
reiniermarcel | 0:a115ff47d1c1 | 864 | /// @param[in] column is the horizontal position in character positions |
reiniermarcel | 0:a115ff47d1c1 | 865 | /// @param[in] row is the vertical position in character positions |
reiniermarcel | 0:a115ff47d1c1 | 866 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 867 | /// |
reiniermarcel | 0:a115ff47d1c1 | 868 | virtual RetCode_t locate(textloc_t column, textloc_t row); |
reiniermarcel | 0:a115ff47d1c1 | 869 | |
reiniermarcel | 0:a115ff47d1c1 | 870 | /// Prepare the controller to write text to the screen by positioning |
reiniermarcel | 0:a115ff47d1c1 | 871 | /// the cursor. |
reiniermarcel | 0:a115ff47d1c1 | 872 | /// |
reiniermarcel | 0:a115ff47d1c1 | 873 | /// @code |
reiniermarcel | 0:a115ff47d1c1 | 874 | /// lcd.SetTextCursor(100, 25); |
reiniermarcel | 0:a115ff47d1c1 | 875 | /// lcd.puts("Hello"); |
reiniermarcel | 0:a115ff47d1c1 | 876 | /// @endcode |
reiniermarcel | 0:a115ff47d1c1 | 877 | /// |
reiniermarcel | 0:a115ff47d1c1 | 878 | /// @param[in] x is the horizontal position in pixels (from the left edge) |
reiniermarcel | 0:a115ff47d1c1 | 879 | /// @param[in] y is the vertical position in pixels (from the top edge) |
reiniermarcel | 0:a115ff47d1c1 | 880 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 881 | /// |
reiniermarcel | 0:a115ff47d1c1 | 882 | RetCode_t SetTextCursor(loc_t x, loc_t y); |
reiniermarcel | 0:a115ff47d1c1 | 883 | |
reiniermarcel | 0:a115ff47d1c1 | 884 | /// Get the current cursor position in pixels. |
reiniermarcel | 0:a115ff47d1c1 | 885 | /// |
reiniermarcel | 0:a115ff47d1c1 | 886 | /// @code |
reiniermarcel | 0:a115ff47d1c1 | 887 | /// point_t point = GetTextCursor(); |
reiniermarcel | 0:a115ff47d1c1 | 888 | /// if (point.x > 100 && point.y > 150) |
reiniermarcel | 0:a115ff47d1c1 | 889 | /// //... |
reiniermarcel | 0:a115ff47d1c1 | 890 | /// @endcode |
reiniermarcel | 0:a115ff47d1c1 | 891 | /// |
reiniermarcel | 0:a115ff47d1c1 | 892 | /// @returns cursor position. |
reiniermarcel | 0:a115ff47d1c1 | 893 | /// |
reiniermarcel | 0:a115ff47d1c1 | 894 | point_t GetTextCursor(void); |
reiniermarcel | 0:a115ff47d1c1 | 895 | |
reiniermarcel | 0:a115ff47d1c1 | 896 | /// Get the current cursor horizontal position in pixels. |
reiniermarcel | 0:a115ff47d1c1 | 897 | /// |
reiniermarcel | 0:a115ff47d1c1 | 898 | /// @returns cursor position horizontal offset. |
reiniermarcel | 0:a115ff47d1c1 | 899 | /// |
reiniermarcel | 0:a115ff47d1c1 | 900 | loc_t GetTextCursor_X(void); |
reiniermarcel | 0:a115ff47d1c1 | 901 | |
reiniermarcel | 0:a115ff47d1c1 | 902 | /// Get the current cursor vertical position in pixels. |
reiniermarcel | 0:a115ff47d1c1 | 903 | /// |
reiniermarcel | 0:a115ff47d1c1 | 904 | /// @returns cursor position vertical offset. |
reiniermarcel | 0:a115ff47d1c1 | 905 | /// |
reiniermarcel | 0:a115ff47d1c1 | 906 | loc_t GetTextCursor_Y(void); |
reiniermarcel | 0:a115ff47d1c1 | 907 | |
reiniermarcel | 0:a115ff47d1c1 | 908 | /// Configure additional Cursor Control settings. |
reiniermarcel | 0:a115ff47d1c1 | 909 | /// |
reiniermarcel | 0:a115ff47d1c1 | 910 | /// This API lets you modify other cursor control settings; |
reiniermarcel | 0:a115ff47d1c1 | 911 | /// Cursor visible/hidden, Cursor blink/normal, |
reiniermarcel | 0:a115ff47d1c1 | 912 | /// Cursor I-Beam/underscore/box. |
reiniermarcel | 0:a115ff47d1c1 | 913 | /// |
reiniermarcel | 0:a115ff47d1c1 | 914 | /// @param[in] cursor can be set to NOCURSOR (default), IBEAM, |
reiniermarcel | 0:a115ff47d1c1 | 915 | /// UNDER, or BLOCK. |
reiniermarcel | 0:a115ff47d1c1 | 916 | /// @param[in] blink can be set to true or false (default false) |
reiniermarcel | 0:a115ff47d1c1 | 917 | /// @returns success/failure code. @see RetCode_t |
reiniermarcel | 0:a115ff47d1c1 | 918 | /// |
reiniermarcel | 0:a115ff47d1c1 | 919 | RetCode_t SetTextCursorControl(cursor_t cursor = NOCURSOR, bool blink = false); |
reiniermarcel | 0:a115ff47d1c1 | 920 | |
reiniermarcel | 0:a115ff47d1c1 | 921 | /// Select the ISO 8859-X font to use next. |
reiniermarcel | 0:a115ff47d1c1 | 922 | /// |
reiniermarcel | 0:a115ff47d1c1 | 923 | /// Supported fonts: ISO 8859-1, -2, -3, -4 |
reiniermarcel | 0:a115ff47d1c1 | 924 | /// |
reiniermarcel | 0:a115ff47d1c1 | 925 | /// @param[in] font selects the font for the subsequent text rendering. |
reiniermarcel | 0:a115ff47d1c1 | 926 | /// |
reiniermarcel | 0:a115ff47d1c1 | 927 | /// @note if either hScale or vScale is outside of its permitted range, |
reiniermarcel | 0:a115ff47d1c1 | 928 | /// the command is not executed. |
reiniermarcel | 0:a115ff47d1c1 | 929 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 930 | /// |
reiniermarcel | 0:a115ff47d1c1 | 931 | RetCode_t SetTextFont(font_t font = ISO8859_1); |
reiniermarcel | 0:a115ff47d1c1 | 932 | |
reiniermarcel | 0:a115ff47d1c1 | 933 | /// Control the font behavior. |
reiniermarcel | 0:a115ff47d1c1 | 934 | /// |
reiniermarcel | 0:a115ff47d1c1 | 935 | /// This command lets you make several modifications to any text that |
reiniermarcel | 0:a115ff47d1c1 | 936 | /// will be written to the screen. |
reiniermarcel | 0:a115ff47d1c1 | 937 | /// |
reiniermarcel | 0:a115ff47d1c1 | 938 | /// Options can be combined: |
reiniermarcel | 0:a115ff47d1c1 | 939 | /// Default: |
reiniermarcel | 0:a115ff47d1c1 | 940 | /// @li Full alignment disabled, |
reiniermarcel | 0:a115ff47d1c1 | 941 | /// @li Font with Background color, |
reiniermarcel | 0:a115ff47d1c1 | 942 | /// @li Font in normal orientiation, |
reiniermarcel | 0:a115ff47d1c1 | 943 | /// @li Horizontal scale x 1 |
reiniermarcel | 0:a115ff47d1c1 | 944 | /// @li Vertical scale x 1 |
reiniermarcel | 0:a115ff47d1c1 | 945 | /// @li alignment |
reiniermarcel | 0:a115ff47d1c1 | 946 | /// |
reiniermarcel | 0:a115ff47d1c1 | 947 | /// @param[in] fillit defaults to FILL, but can be NOFILL |
reiniermarcel | 0:a115ff47d1c1 | 948 | /// @param[in] angle defaults to normal, but can be rotated |
reiniermarcel | 0:a115ff47d1c1 | 949 | /// @param[in] hScale defaults to 1, but can be 1, 2, 3, or 4, |
reiniermarcel | 0:a115ff47d1c1 | 950 | /// and scales the font size by this amount. |
reiniermarcel | 0:a115ff47d1c1 | 951 | /// @param[in] vScale defaults to 1, but can be 1, 2, 3, or 4, |
reiniermarcel | 0:a115ff47d1c1 | 952 | /// and scales the font size by this amount. |
reiniermarcel | 0:a115ff47d1c1 | 953 | /// @param[in] alignment defaults to align_none, but can be |
reiniermarcel | 0:a115ff47d1c1 | 954 | /// align_full. |
reiniermarcel | 0:a115ff47d1c1 | 955 | /// |
reiniermarcel | 0:a115ff47d1c1 | 956 | /// @note if either hScale or vScale is outside of its permitted range, |
reiniermarcel | 0:a115ff47d1c1 | 957 | /// the command is not executed. |
reiniermarcel | 0:a115ff47d1c1 | 958 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 959 | /// |
reiniermarcel | 0:a115ff47d1c1 | 960 | RetCode_t SetTextFontControl(fill_t fillit = FILL, |
reiniermarcel | 0:a115ff47d1c1 | 961 | font_angle_t angle = normal, |
reiniermarcel | 0:a115ff47d1c1 | 962 | HorizontalScale hScale = 1, |
reiniermarcel | 0:a115ff47d1c1 | 963 | VerticalScale vScale = 1, |
reiniermarcel | 0:a115ff47d1c1 | 964 | alignment_t alignment = align_none); |
reiniermarcel | 0:a115ff47d1c1 | 965 | |
reiniermarcel | 0:a115ff47d1c1 | 966 | /// Control the font size |
reiniermarcel | 0:a115ff47d1c1 | 967 | /// |
reiniermarcel | 0:a115ff47d1c1 | 968 | /// This command lets you set the font enlargement for both horizontal |
reiniermarcel | 0:a115ff47d1c1 | 969 | /// and vertical, independent of the rotation, background, and |
reiniermarcel | 0:a115ff47d1c1 | 970 | /// alignment. @see SetTextFontControl. |
reiniermarcel | 0:a115ff47d1c1 | 971 | /// |
reiniermarcel | 0:a115ff47d1c1 | 972 | /// @param[in] hScale defaults to 1, but can be 1, 2, 3, or 4, |
reiniermarcel | 0:a115ff47d1c1 | 973 | /// and scales the font size by this amount. |
reiniermarcel | 0:a115ff47d1c1 | 974 | /// @param[in] vScale is an optional parameter that defaults to the hScale value, |
reiniermarcel | 0:a115ff47d1c1 | 975 | /// but can be 1, 2, 3, or 4, and scales the font size by this amount. |
reiniermarcel | 0:a115ff47d1c1 | 976 | /// |
reiniermarcel | 0:a115ff47d1c1 | 977 | /// @code |
reiniermarcel | 0:a115ff47d1c1 | 978 | /// lcd.SetTextFontSize(2); // Set the font to 2x normal size |
reiniermarcel | 0:a115ff47d1c1 | 979 | /// lcd.puts("Two times"); |
reiniermarcel | 0:a115ff47d1c1 | 980 | /// lcd.SetTextFontSize(2,3); // Set the font to 2x Width and 3x Height |
reiniermarcel | 0:a115ff47d1c1 | 981 | /// lcd.puts("2*2 3*h"); |
reiniermarcel | 0:a115ff47d1c1 | 982 | /// lcd.SetTextFontSize(); // Restore to normal size in both dimensions |
reiniermarcel | 0:a115ff47d1c1 | 983 | /// lcd.puts("normal"); |
reiniermarcel | 0:a115ff47d1c1 | 984 | /// @endcode |
reiniermarcel | 0:a115ff47d1c1 | 985 | /// |
reiniermarcel | 0:a115ff47d1c1 | 986 | /// @note if either hScale or vScale is outside of its permitted range, |
reiniermarcel | 0:a115ff47d1c1 | 987 | /// the command is not executed. |
reiniermarcel | 0:a115ff47d1c1 | 988 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 989 | /// |
reiniermarcel | 0:a115ff47d1c1 | 990 | RetCode_t SetTextFontSize(HorizontalScale hScale = 1, VerticalScale vScale = -1); |
reiniermarcel | 0:a115ff47d1c1 | 991 | |
reiniermarcel | 0:a115ff47d1c1 | 992 | /// put a character on the screen. |
reiniermarcel | 0:a115ff47d1c1 | 993 | /// |
reiniermarcel | 0:a115ff47d1c1 | 994 | /// @param[in] c is the character. |
reiniermarcel | 0:a115ff47d1c1 | 995 | /// @returns the character, or EOF if there is an error. |
reiniermarcel | 0:a115ff47d1c1 | 996 | /// |
reiniermarcel | 0:a115ff47d1c1 | 997 | virtual int _putc(int c); |
reiniermarcel | 0:a115ff47d1c1 | 998 | |
reiniermarcel | 0:a115ff47d1c1 | 999 | /// Write string of text to the display |
reiniermarcel | 0:a115ff47d1c1 | 1000 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1001 | /// @code |
reiniermarcel | 0:a115ff47d1c1 | 1002 | /// lcd.puts("Test STring"); |
reiniermarcel | 0:a115ff47d1c1 | 1003 | /// @endcode |
reiniermarcel | 0:a115ff47d1c1 | 1004 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1005 | /// @param[in] string is the null terminated string to send to the display. |
reiniermarcel | 0:a115ff47d1c1 | 1006 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1007 | void puts(const char * string); |
reiniermarcel | 0:a115ff47d1c1 | 1008 | |
reiniermarcel | 0:a115ff47d1c1 | 1009 | /// Write string of text to the display at the specified location. |
reiniermarcel | 0:a115ff47d1c1 | 1010 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1011 | /// @code |
reiniermarcel | 0:a115ff47d1c1 | 1012 | /// lcd.puts(10,25, "Test STring"); |
reiniermarcel | 0:a115ff47d1c1 | 1013 | /// @endcode |
reiniermarcel | 0:a115ff47d1c1 | 1014 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1015 | /// @param[in] x is the horizontal position in pixels (from the left edge) |
reiniermarcel | 0:a115ff47d1c1 | 1016 | /// @param[in] y is the vertical position in pixels (from the top edge) |
reiniermarcel | 0:a115ff47d1c1 | 1017 | /// @param[in] string is the null terminated string to send to the display. |
reiniermarcel | 0:a115ff47d1c1 | 1018 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1019 | void puts(loc_t x, loc_t y, const char * string); |
reiniermarcel | 0:a115ff47d1c1 | 1020 | |
reiniermarcel | 0:a115ff47d1c1 | 1021 | /// Prepare the controller to write binary data to the screen by positioning |
reiniermarcel | 0:a115ff47d1c1 | 1022 | /// the memory cursor. |
reiniermarcel | 0:a115ff47d1c1 | 1023 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1024 | /// @param[in] x is the horizontal position in pixels (from the left edge) |
reiniermarcel | 0:a115ff47d1c1 | 1025 | /// @param[in] y is the vertical position in pixels (from the top edge) |
reiniermarcel | 0:a115ff47d1c1 | 1026 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1027 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1028 | virtual RetCode_t SetGraphicsCursor(loc_t x, loc_t y); |
reiniermarcel | 0:a115ff47d1c1 | 1029 | |
reiniermarcel | 0:a115ff47d1c1 | 1030 | /// Prepare the controller to read binary data from the screen by positioning |
reiniermarcel | 0:a115ff47d1c1 | 1031 | /// the memory read cursor. |
reiniermarcel | 0:a115ff47d1c1 | 1032 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1033 | /// @param[in] x is the horizontal position in pixels (from the left edge) |
reiniermarcel | 0:a115ff47d1c1 | 1034 | /// @param[in] y is the vertical position in pixels (from the top edge) |
reiniermarcel | 0:a115ff47d1c1 | 1035 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1036 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1037 | virtual RetCode_t SetGraphicsCursorRead(loc_t x, loc_t y); |
reiniermarcel | 0:a115ff47d1c1 | 1038 | |
reiniermarcel | 0:a115ff47d1c1 | 1039 | /// Set the window, which controls where items are written to the screen. |
reiniermarcel | 0:a115ff47d1c1 | 1040 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1041 | /// When something hits the window width, it wraps back to the left side |
reiniermarcel | 0:a115ff47d1c1 | 1042 | /// and down a row. If the initial write is outside the window, it will |
reiniermarcel | 0:a115ff47d1c1 | 1043 | /// be captured into the window when it crosses a boundary. |
reiniermarcel | 0:a115ff47d1c1 | 1044 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1045 | /// @code |
reiniermarcel | 0:a115ff47d1c1 | 1046 | /// lcd.window(10,10, 80,80); |
reiniermarcel | 0:a115ff47d1c1 | 1047 | /// lcd.puts("012345678901234567890123456789012345678901234567890"); |
reiniermarcel | 0:a115ff47d1c1 | 1048 | /// @endcode |
reiniermarcel | 0:a115ff47d1c1 | 1049 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1050 | /// @param[in] x is the left edge in pixels. |
reiniermarcel | 0:a115ff47d1c1 | 1051 | /// @param[in] y is the top edge in pixels. |
reiniermarcel | 0:a115ff47d1c1 | 1052 | /// @param[in] width is the window width in pixels. |
reiniermarcel | 0:a115ff47d1c1 | 1053 | /// @param[in] height is the window height in pixels. |
reiniermarcel | 0:a115ff47d1c1 | 1054 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1055 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1056 | virtual RetCode_t window(loc_t x, loc_t y, dim_t width, dim_t height); |
reiniermarcel | 0:a115ff47d1c1 | 1057 | |
reiniermarcel | 0:a115ff47d1c1 | 1058 | /// Clear either the specified layer, or the active layer. |
reiniermarcel | 0:a115ff47d1c1 | 1059 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1060 | /// The behavior is to clear the whole screen for the specified |
reiniermarcel | 0:a115ff47d1c1 | 1061 | /// layer. When not specified, the active drawing layer is cleared. |
reiniermarcel | 0:a115ff47d1c1 | 1062 | /// This command can also be used to specifically clear either, |
reiniermarcel | 0:a115ff47d1c1 | 1063 | /// or both layers. @see clsw(). |
reiniermarcel | 0:a115ff47d1c1 | 1064 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1065 | /// @code |
reiniermarcel | 0:a115ff47d1c1 | 1066 | /// lcd.cls(); |
reiniermarcel | 0:a115ff47d1c1 | 1067 | /// @endcode |
reiniermarcel | 0:a115ff47d1c1 | 1068 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1069 | /// @param[in] layers is optional. If not provided, the active layer |
reiniermarcel | 0:a115ff47d1c1 | 1070 | /// is cleared. If bit 0 is set, layer 0 is cleared, if bit |
reiniermarcel | 0:a115ff47d1c1 | 1071 | /// 1 is set, layer 1 is cleared. If both are set, both layers |
reiniermarcel | 0:a115ff47d1c1 | 1072 | /// are cleared. Any other value does not cause an action. |
reiniermarcel | 0:a115ff47d1c1 | 1073 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1074 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1075 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1076 | virtual RetCode_t cls(uint16_t layers = 0); |
reiniermarcel | 0:a115ff47d1c1 | 1077 | |
reiniermarcel | 0:a115ff47d1c1 | 1078 | /// Clear the screen, or clear only the active window. |
reiniermarcel | 0:a115ff47d1c1 | 1079 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1080 | /// The default behavior is to clear the whole screen. With the optional |
reiniermarcel | 0:a115ff47d1c1 | 1081 | /// parameter, the action can be restricted to the active window, which |
reiniermarcel | 0:a115ff47d1c1 | 1082 | /// can be set with the @see window method. |
reiniermarcel | 0:a115ff47d1c1 | 1083 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1084 | /// @code |
reiniermarcel | 0:a115ff47d1c1 | 1085 | /// lcd.window(20,20, 40,10); |
reiniermarcel | 0:a115ff47d1c1 | 1086 | /// lcd.clsw(); |
reiniermarcel | 0:a115ff47d1c1 | 1087 | /// @endcode |
reiniermarcel | 0:a115ff47d1c1 | 1088 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1089 | /// @param[in] region is an optional parameter that defaults to FULLWINDOW |
reiniermarcel | 0:a115ff47d1c1 | 1090 | /// or may be set to ACTIVEWINDOW. |
reiniermarcel | 0:a115ff47d1c1 | 1091 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1092 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1093 | RetCode_t clsw(RA8875::Region_t region = FULLWINDOW); |
reiniermarcel | 0:a115ff47d1c1 | 1094 | |
reiniermarcel | 0:a115ff47d1c1 | 1095 | /// Set the background color. |
reiniermarcel | 0:a115ff47d1c1 | 1096 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1097 | /// @param[in] color is expressed in 16-bit format. |
reiniermarcel | 0:a115ff47d1c1 | 1098 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1099 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1100 | virtual RetCode_t background(color_t color); |
reiniermarcel | 0:a115ff47d1c1 | 1101 | |
reiniermarcel | 0:a115ff47d1c1 | 1102 | /// Set the background color. |
reiniermarcel | 0:a115ff47d1c1 | 1103 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1104 | /// @param[in] r is the red element of the color. |
reiniermarcel | 0:a115ff47d1c1 | 1105 | /// @param[in] g is the green element of the color. |
reiniermarcel | 0:a115ff47d1c1 | 1106 | /// @param[in] b is the blue element of the color. |
reiniermarcel | 0:a115ff47d1c1 | 1107 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1108 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1109 | virtual RetCode_t background(unsigned char r, unsigned char g, unsigned char b); |
reiniermarcel | 0:a115ff47d1c1 | 1110 | |
reiniermarcel | 0:a115ff47d1c1 | 1111 | /// Set the foreground color. |
reiniermarcel | 0:a115ff47d1c1 | 1112 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1113 | /// @param[in] color is expressed in 16-bit format. |
reiniermarcel | 0:a115ff47d1c1 | 1114 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1115 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1116 | virtual RetCode_t foreground(color_t color); |
reiniermarcel | 0:a115ff47d1c1 | 1117 | |
reiniermarcel | 0:a115ff47d1c1 | 1118 | /// Set the foreground color. |
reiniermarcel | 0:a115ff47d1c1 | 1119 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1120 | /// @param[in] r is the red element of the color. |
reiniermarcel | 0:a115ff47d1c1 | 1121 | /// @param[in] g is the green element of the color. |
reiniermarcel | 0:a115ff47d1c1 | 1122 | /// @param[in] b is the blue element of the color. |
reiniermarcel | 0:a115ff47d1c1 | 1123 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1124 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1125 | virtual RetCode_t foreground(unsigned char r, unsigned char g, unsigned char b); |
reiniermarcel | 0:a115ff47d1c1 | 1126 | |
reiniermarcel | 0:a115ff47d1c1 | 1127 | /// Get the current foreground color value. |
reiniermarcel | 0:a115ff47d1c1 | 1128 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1129 | /// @returns the current foreground color. |
reiniermarcel | 0:a115ff47d1c1 | 1130 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1131 | color_t GetForeColor(void); |
reiniermarcel | 0:a115ff47d1c1 | 1132 | |
reiniermarcel | 0:a115ff47d1c1 | 1133 | /// Draw a pixel in the specified color. |
reiniermarcel | 0:a115ff47d1c1 | 1134 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1135 | /// @note Unlike many other operations, this does not |
reiniermarcel | 0:a115ff47d1c1 | 1136 | /// set the forecolor! |
reiniermarcel | 0:a115ff47d1c1 | 1137 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1138 | /// @param[in] x is the horizontal offset to this pixel. |
reiniermarcel | 0:a115ff47d1c1 | 1139 | /// @param[in] y is the vertical offset to this pixel. |
reiniermarcel | 0:a115ff47d1c1 | 1140 | /// @param[in] color defines the color for the pixel. |
reiniermarcel | 0:a115ff47d1c1 | 1141 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1142 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1143 | virtual RetCode_t pixel(loc_t x, loc_t y, color_t color); |
reiniermarcel | 0:a115ff47d1c1 | 1144 | |
reiniermarcel | 0:a115ff47d1c1 | 1145 | /// Draw a pixel in the current foreground color. |
reiniermarcel | 0:a115ff47d1c1 | 1146 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1147 | /// @param[in] x is the horizontal offset to this pixel. |
reiniermarcel | 0:a115ff47d1c1 | 1148 | /// @param[in] y is the veritical offset to this pixel. |
reiniermarcel | 0:a115ff47d1c1 | 1149 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1150 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1151 | virtual RetCode_t pixel(loc_t x, loc_t y); |
reiniermarcel | 0:a115ff47d1c1 | 1152 | |
reiniermarcel | 0:a115ff47d1c1 | 1153 | /// Get a pixel from the display. |
reiniermarcel | 0:a115ff47d1c1 | 1154 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1155 | /// @param[in] x is the horizontal offset to this pixel. |
reiniermarcel | 0:a115ff47d1c1 | 1156 | /// @param[in] y is the vertical offset to this pixel. |
reiniermarcel | 0:a115ff47d1c1 | 1157 | /// @returns the pixel. see @color_t |
reiniermarcel | 0:a115ff47d1c1 | 1158 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1159 | virtual color_t getPixel(loc_t x, loc_t y); |
reiniermarcel | 0:a115ff47d1c1 | 1160 | |
reiniermarcel | 0:a115ff47d1c1 | 1161 | /// Write a stream of pixels to the display. |
reiniermarcel | 0:a115ff47d1c1 | 1162 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1163 | /// @param[in] p is a pointer to a color_t array to write. |
reiniermarcel | 0:a115ff47d1c1 | 1164 | /// @param[in] count is the number of pixels to write. |
reiniermarcel | 0:a115ff47d1c1 | 1165 | /// @param[in] x is the horizontal position on the display. |
reiniermarcel | 0:a115ff47d1c1 | 1166 | /// @param[in] y is the vertical position on the display. |
reiniermarcel | 0:a115ff47d1c1 | 1167 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1168 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1169 | virtual RetCode_t pixelStream(color_t * p, uint32_t count, loc_t x, loc_t y); |
reiniermarcel | 0:a115ff47d1c1 | 1170 | |
reiniermarcel | 0:a115ff47d1c1 | 1171 | /// Get a stream of pixels from the display. |
reiniermarcel | 0:a115ff47d1c1 | 1172 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1173 | /// @param[in] p is a pointer to a color_t array to accept the stream. |
reiniermarcel | 0:a115ff47d1c1 | 1174 | /// @param[in] count is the number of pixels to read. |
reiniermarcel | 0:a115ff47d1c1 | 1175 | /// @param[in] x is the horizontal offset to this pixel. |
reiniermarcel | 0:a115ff47d1c1 | 1176 | /// @param[in] y is the vertical offset to this pixel. |
reiniermarcel | 0:a115ff47d1c1 | 1177 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1178 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1179 | virtual RetCode_t getPixelStream(color_t * p, uint32_t count, loc_t x, loc_t y); |
reiniermarcel | 0:a115ff47d1c1 | 1180 | |
reiniermarcel | 0:a115ff47d1c1 | 1181 | /// Draw a line in the specified color |
reiniermarcel | 0:a115ff47d1c1 | 1182 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1183 | /// @note As a side effect, this changes the current |
reiniermarcel | 0:a115ff47d1c1 | 1184 | /// foreground color for subsequent operations. |
reiniermarcel | 0:a115ff47d1c1 | 1185 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1186 | /// @param[in] x1 is the horizontal start of the line. |
reiniermarcel | 0:a115ff47d1c1 | 1187 | /// @param[in] y1 is the vertical start of the line. |
reiniermarcel | 0:a115ff47d1c1 | 1188 | /// @param[in] x2 is the horizontal end of the line. |
reiniermarcel | 0:a115ff47d1c1 | 1189 | /// @param[in] y2 is the vertical end of the line. |
reiniermarcel | 0:a115ff47d1c1 | 1190 | /// @param[in] color defines the foreground color. |
reiniermarcel | 0:a115ff47d1c1 | 1191 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1192 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1193 | RetCode_t line(loc_t x1, loc_t y1, loc_t x2, loc_t y2, color_t color); |
reiniermarcel | 0:a115ff47d1c1 | 1194 | |
reiniermarcel | 0:a115ff47d1c1 | 1195 | /// Draw a line |
reiniermarcel | 0:a115ff47d1c1 | 1196 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1197 | /// Draws a line using the foreground color setting. |
reiniermarcel | 0:a115ff47d1c1 | 1198 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1199 | /// @param[in] x1 is the horizontal start of the line. |
reiniermarcel | 0:a115ff47d1c1 | 1200 | /// @param[in] y1 is the vertical start of the line. |
reiniermarcel | 0:a115ff47d1c1 | 1201 | /// @param[in] x2 is the horizontal end of the line. |
reiniermarcel | 0:a115ff47d1c1 | 1202 | /// @param[in] y2 is the vertical end of the line. |
reiniermarcel | 0:a115ff47d1c1 | 1203 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1204 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1205 | RetCode_t line(loc_t x1, loc_t y1, loc_t x2, loc_t y2); |
reiniermarcel | 0:a115ff47d1c1 | 1206 | |
reiniermarcel | 0:a115ff47d1c1 | 1207 | /// Draw a rectangle in the specified color |
reiniermarcel | 0:a115ff47d1c1 | 1208 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1209 | /// @note As a side effect, this changes the current |
reiniermarcel | 0:a115ff47d1c1 | 1210 | /// foreground color for subsequent operations. |
reiniermarcel | 0:a115ff47d1c1 | 1211 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1212 | /// @param[in] rect defines the rectangle. |
reiniermarcel | 0:a115ff47d1c1 | 1213 | /// @param[in] color defines the foreground color. |
reiniermarcel | 0:a115ff47d1c1 | 1214 | /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL. |
reiniermarcel | 0:a115ff47d1c1 | 1215 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1216 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1217 | RetCode_t rect(rect_t rect, color_t color, fill_t fillit); |
reiniermarcel | 0:a115ff47d1c1 | 1218 | |
reiniermarcel | 0:a115ff47d1c1 | 1219 | /// Draw a filled rectangle in the specified color |
reiniermarcel | 0:a115ff47d1c1 | 1220 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1221 | /// @note As a side effect, this changes the current |
reiniermarcel | 0:a115ff47d1c1 | 1222 | /// foreground color for subsequent operations. |
reiniermarcel | 0:a115ff47d1c1 | 1223 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1224 | /// @param[in] rect defines the rectangle. |
reiniermarcel | 0:a115ff47d1c1 | 1225 | /// @param[in] color defines the foreground color. |
reiniermarcel | 0:a115ff47d1c1 | 1226 | /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL. |
reiniermarcel | 0:a115ff47d1c1 | 1227 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1228 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1229 | RetCode_t fillrect(rect_t rect, color_t color, fill_t fillit = FILL); |
reiniermarcel | 0:a115ff47d1c1 | 1230 | |
reiniermarcel | 0:a115ff47d1c1 | 1231 | /// Draw a rectangle in the specified color |
reiniermarcel | 0:a115ff47d1c1 | 1232 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1233 | /// @note As a side effect, this changes the current |
reiniermarcel | 0:a115ff47d1c1 | 1234 | /// foreground color for subsequent operations. |
reiniermarcel | 0:a115ff47d1c1 | 1235 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1236 | /// @param[in] x1 is the horizontal start of the line. |
reiniermarcel | 0:a115ff47d1c1 | 1237 | /// @param[in] y1 is the vertical start of the line. |
reiniermarcel | 0:a115ff47d1c1 | 1238 | /// @param[in] x2 is the horizontal end of the line. |
reiniermarcel | 0:a115ff47d1c1 | 1239 | /// @param[in] y2 is the vertical end of the line. |
reiniermarcel | 0:a115ff47d1c1 | 1240 | /// @param[in] color defines the foreground color. |
reiniermarcel | 0:a115ff47d1c1 | 1241 | /// @param[in] fillit is optional to FILL the rectangle. default is FILL. |
reiniermarcel | 0:a115ff47d1c1 | 1242 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1243 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1244 | RetCode_t rect(loc_t x1, loc_t y1, loc_t x2, loc_t y2, |
reiniermarcel | 0:a115ff47d1c1 | 1245 | color_t color, fill_t fillit = NOFILL); |
reiniermarcel | 0:a115ff47d1c1 | 1246 | |
reiniermarcel | 0:a115ff47d1c1 | 1247 | /// Draw a filled rectangle in the specified color |
reiniermarcel | 0:a115ff47d1c1 | 1248 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1249 | /// @note As a side effect, this changes the current |
reiniermarcel | 0:a115ff47d1c1 | 1250 | /// foreground color for subsequent operations. |
reiniermarcel | 0:a115ff47d1c1 | 1251 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1252 | /// @param[in] x1 is the horizontal start of the line. |
reiniermarcel | 0:a115ff47d1c1 | 1253 | /// @param[in] y1 is the vertical start of the line. |
reiniermarcel | 0:a115ff47d1c1 | 1254 | /// @param[in] x2 is the horizontal end of the line. |
reiniermarcel | 0:a115ff47d1c1 | 1255 | /// @param[in] y2 is the vertical end of the line. |
reiniermarcel | 0:a115ff47d1c1 | 1256 | /// @param[in] color defines the foreground color. |
reiniermarcel | 0:a115ff47d1c1 | 1257 | /// @param[in] fillit is optional to NOFILL the rectangle. default is FILL. |
reiniermarcel | 0:a115ff47d1c1 | 1258 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1259 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1260 | virtual RetCode_t fillrect(loc_t x1, loc_t y1, loc_t x2, loc_t y2, |
reiniermarcel | 0:a115ff47d1c1 | 1261 | color_t color, fill_t fillit = FILL); |
reiniermarcel | 0:a115ff47d1c1 | 1262 | |
reiniermarcel | 0:a115ff47d1c1 | 1263 | /// Draw a rectangle |
reiniermarcel | 0:a115ff47d1c1 | 1264 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1265 | /// Draws a rectangle using the foreground color setting. |
reiniermarcel | 0:a115ff47d1c1 | 1266 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1267 | /// @param[in] x1 is the horizontal start of the line. |
reiniermarcel | 0:a115ff47d1c1 | 1268 | /// @param[in] y1 is the vertical start of the line. |
reiniermarcel | 0:a115ff47d1c1 | 1269 | /// @param[in] x2 is the horizontal end of the line. |
reiniermarcel | 0:a115ff47d1c1 | 1270 | /// @param[in] y2 is the vertical end of the line. |
reiniermarcel | 0:a115ff47d1c1 | 1271 | /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL. |
reiniermarcel | 0:a115ff47d1c1 | 1272 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1273 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1274 | RetCode_t rect(loc_t x1, loc_t y1, loc_t x2, loc_t y2, |
reiniermarcel | 0:a115ff47d1c1 | 1275 | fill_t fillit = NOFILL); |
reiniermarcel | 0:a115ff47d1c1 | 1276 | |
reiniermarcel | 0:a115ff47d1c1 | 1277 | /// Draw a filled rectangle with rounded corners using the specified color. |
reiniermarcel | 0:a115ff47d1c1 | 1278 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1279 | /// This draws a rounded rectangle. A numbers of checks are made on the values, |
reiniermarcel | 0:a115ff47d1c1 | 1280 | /// and it could reduce this to drawing a line (if either x1 == x2, or y1 == y2), |
reiniermarcel | 0:a115ff47d1c1 | 1281 | /// or a single point (x1 == x2 && y1 == y2). If the radius parameters are |
reiniermarcel | 0:a115ff47d1c1 | 1282 | /// > 1/2 the length of that side (width or height), an error value is returned. |
reiniermarcel | 0:a115ff47d1c1 | 1283 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1284 | /// @note As a side effect, this changes the current |
reiniermarcel | 0:a115ff47d1c1 | 1285 | /// foreground color for subsequent operations. |
reiniermarcel | 0:a115ff47d1c1 | 1286 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1287 | /// @param[in] x1 is the horizontal start of the line and must be <= x2. |
reiniermarcel | 0:a115ff47d1c1 | 1288 | /// @param[in] y1 is the vertical start of the line and must be <= y2. |
reiniermarcel | 0:a115ff47d1c1 | 1289 | /// @param[in] x2 is the horizontal end of the line and must be >= x1. |
reiniermarcel | 0:a115ff47d1c1 | 1290 | /// @param[in] y2 is the vertical end of the line and must be >= y1. |
reiniermarcel | 0:a115ff47d1c1 | 1291 | /// @param[in] radius1 defines the horizontal radius of the curved corner. Take care |
reiniermarcel | 0:a115ff47d1c1 | 1292 | /// that this value < 1/2 the width of the rectangle, or bad_parameter |
reiniermarcel | 0:a115ff47d1c1 | 1293 | /// is returned. |
reiniermarcel | 0:a115ff47d1c1 | 1294 | /// @param[in] radius2 defines the vertical radius of the curved corner. Take care |
reiniermarcel | 0:a115ff47d1c1 | 1295 | /// that this value < 1/2 the height of the rectangle, or bad_parameter |
reiniermarcel | 0:a115ff47d1c1 | 1296 | /// is returned. |
reiniermarcel | 0:a115ff47d1c1 | 1297 | /// @param[in] color defines the foreground color. |
reiniermarcel | 0:a115ff47d1c1 | 1298 | /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL. |
reiniermarcel | 0:a115ff47d1c1 | 1299 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1300 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1301 | RetCode_t fillroundrect(loc_t x1, loc_t y1, loc_t x2, loc_t y2, |
reiniermarcel | 0:a115ff47d1c1 | 1302 | dim_t radius1, dim_t radius2, color_t color, fill_t fillit = FILL); |
reiniermarcel | 0:a115ff47d1c1 | 1303 | |
reiniermarcel | 0:a115ff47d1c1 | 1304 | /// Draw a rectangle with rounded corners using the specified color. |
reiniermarcel | 0:a115ff47d1c1 | 1305 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1306 | /// This draws a rounded rectangle. A numbers of checks are made on the values, |
reiniermarcel | 0:a115ff47d1c1 | 1307 | /// and it could reduce this to drawing a line (if either x1 == x2, or y1 == y2), |
reiniermarcel | 0:a115ff47d1c1 | 1308 | /// or a single point (x1 == x2 && y1 == y2). If the radius parameters are |
reiniermarcel | 0:a115ff47d1c1 | 1309 | /// > 1/2 the length of that side (width or height), an error value is returned. |
reiniermarcel | 0:a115ff47d1c1 | 1310 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1311 | /// @note As a side effect, this changes the current |
reiniermarcel | 0:a115ff47d1c1 | 1312 | /// foreground color for subsequent operations. |
reiniermarcel | 0:a115ff47d1c1 | 1313 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1314 | /// @param[in] x1 is the horizontal start of the line and must be <= x2. |
reiniermarcel | 0:a115ff47d1c1 | 1315 | /// @param[in] y1 is the vertical start of the line and must be <= y2. |
reiniermarcel | 0:a115ff47d1c1 | 1316 | /// @param[in] x2 is the horizontal end of the line and must be >= x1. |
reiniermarcel | 0:a115ff47d1c1 | 1317 | /// @param[in] y2 is the vertical end of the line and must be >= y1. |
reiniermarcel | 0:a115ff47d1c1 | 1318 | /// @param[in] radius1 defines the horizontal radius of the curved corner. Take care |
reiniermarcel | 0:a115ff47d1c1 | 1319 | /// that this value < 1/2 the width of the rectangle, or bad_parameter |
reiniermarcel | 0:a115ff47d1c1 | 1320 | /// is returned. |
reiniermarcel | 0:a115ff47d1c1 | 1321 | /// @param[in] radius2 defines the vertical radius of the curved corner. Take care |
reiniermarcel | 0:a115ff47d1c1 | 1322 | /// that this value < 1/2 the height of the rectangle, or bad_parameter |
reiniermarcel | 0:a115ff47d1c1 | 1323 | /// is returned. |
reiniermarcel | 0:a115ff47d1c1 | 1324 | /// @param[in] color defines the foreground color. |
reiniermarcel | 0:a115ff47d1c1 | 1325 | /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL. |
reiniermarcel | 0:a115ff47d1c1 | 1326 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1327 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1328 | RetCode_t roundrect(loc_t x1, loc_t y1, loc_t x2, loc_t y2, |
reiniermarcel | 0:a115ff47d1c1 | 1329 | dim_t radius1, dim_t radius2, color_t color, fill_t fillit = NOFILL); |
reiniermarcel | 0:a115ff47d1c1 | 1330 | |
reiniermarcel | 0:a115ff47d1c1 | 1331 | /// Draw a rectangle with rounded corners. |
reiniermarcel | 0:a115ff47d1c1 | 1332 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1333 | /// This draws a rounded rectangle. A numbers of checks are made on the values, |
reiniermarcel | 0:a115ff47d1c1 | 1334 | /// and it could reduce this to drawing a line (if either x1 == x2, or y1 == y2), |
reiniermarcel | 0:a115ff47d1c1 | 1335 | /// or a single point (x1 == x2 && y1 == y2). If the radius parameters are |
reiniermarcel | 0:a115ff47d1c1 | 1336 | /// > 1/2 the length of that side (width or height), an error value is returned. |
reiniermarcel | 0:a115ff47d1c1 | 1337 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1338 | /// @param[in] x1 is the horizontal start of the line and must be <= x2. |
reiniermarcel | 0:a115ff47d1c1 | 1339 | /// @param[in] y1 is the vertical start of the line and must be <= y2. |
reiniermarcel | 0:a115ff47d1c1 | 1340 | /// @param[in] x2 is the horizontal end of the line and must be >= x1. |
reiniermarcel | 0:a115ff47d1c1 | 1341 | /// @param[in] y2 is the vertical end of the line and must be >= y1. |
reiniermarcel | 0:a115ff47d1c1 | 1342 | /// @param[in] radius1 defines the horizontal radius of the curved corner. Take care |
reiniermarcel | 0:a115ff47d1c1 | 1343 | /// that this value < 1/2 the width of the rectangle, or bad_parameter |
reiniermarcel | 0:a115ff47d1c1 | 1344 | /// is returned. |
reiniermarcel | 0:a115ff47d1c1 | 1345 | /// @param[in] radius2 defines the vertical radius of the curved corner. Take care |
reiniermarcel | 0:a115ff47d1c1 | 1346 | /// that this value < 1/2 the height of the rectangle, or bad_parameter |
reiniermarcel | 0:a115ff47d1c1 | 1347 | /// is returned. |
reiniermarcel | 0:a115ff47d1c1 | 1348 | /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL. |
reiniermarcel | 0:a115ff47d1c1 | 1349 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1350 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1351 | RetCode_t roundrect(loc_t x1, loc_t y1, loc_t x2, loc_t y2, |
reiniermarcel | 0:a115ff47d1c1 | 1352 | dim_t radius1, dim_t radius2, fill_t fillit = NOFILL); |
reiniermarcel | 0:a115ff47d1c1 | 1353 | |
reiniermarcel | 0:a115ff47d1c1 | 1354 | /// Draw a triangle in the specified color. |
reiniermarcel | 0:a115ff47d1c1 | 1355 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1356 | /// @note As a side effect, this changes the current |
reiniermarcel | 0:a115ff47d1c1 | 1357 | /// foreground color for subsequent operations. |
reiniermarcel | 0:a115ff47d1c1 | 1358 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1359 | /// @param[in] x1 is the horizontal for point 1. |
reiniermarcel | 0:a115ff47d1c1 | 1360 | /// @param[in] y1 is the vertical for point 1. |
reiniermarcel | 0:a115ff47d1c1 | 1361 | /// @param[in] x2 is the horizontal for point 2. |
reiniermarcel | 0:a115ff47d1c1 | 1362 | /// @param[in] y2 is the vertical for point 2. |
reiniermarcel | 0:a115ff47d1c1 | 1363 | /// @param[in] x3 is the horizontal for point 3. |
reiniermarcel | 0:a115ff47d1c1 | 1364 | /// @param[in] y3 is the vertical for point 3. |
reiniermarcel | 0:a115ff47d1c1 | 1365 | /// @param[in] color defines the foreground color. |
reiniermarcel | 0:a115ff47d1c1 | 1366 | /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL. |
reiniermarcel | 0:a115ff47d1c1 | 1367 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1368 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1369 | RetCode_t triangle(loc_t x1, loc_t y1, loc_t x2, loc_t y2, |
reiniermarcel | 0:a115ff47d1c1 | 1370 | loc_t x3, loc_t y3, color_t color, fill_t fillit = NOFILL); |
reiniermarcel | 0:a115ff47d1c1 | 1371 | |
reiniermarcel | 0:a115ff47d1c1 | 1372 | /// Draw a filled triangle in the specified color. |
reiniermarcel | 0:a115ff47d1c1 | 1373 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1374 | /// @note As a side effect, this changes the current |
reiniermarcel | 0:a115ff47d1c1 | 1375 | /// foreground color for subsequent operations. |
reiniermarcel | 0:a115ff47d1c1 | 1376 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1377 | /// @param[in] x1 is the horizontal for point 1. |
reiniermarcel | 0:a115ff47d1c1 | 1378 | /// @param[in] y1 is the vertical for point 1. |
reiniermarcel | 0:a115ff47d1c1 | 1379 | /// @param[in] x2 is the horizontal for point 2. |
reiniermarcel | 0:a115ff47d1c1 | 1380 | /// @param[in] y2 is the vertical for point 2. |
reiniermarcel | 0:a115ff47d1c1 | 1381 | /// @param[in] x3 is the horizontal for point 3. |
reiniermarcel | 0:a115ff47d1c1 | 1382 | /// @param[in] y3 is the vertical for point 3. |
reiniermarcel | 0:a115ff47d1c1 | 1383 | /// @param[in] color defines the foreground color. |
reiniermarcel | 0:a115ff47d1c1 | 1384 | /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL. |
reiniermarcel | 0:a115ff47d1c1 | 1385 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1386 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1387 | RetCode_t filltriangle(loc_t x1, loc_t y1, loc_t x2, loc_t y2, |
reiniermarcel | 0:a115ff47d1c1 | 1388 | loc_t x3, loc_t y3, color_t color, fill_t fillit = FILL); |
reiniermarcel | 0:a115ff47d1c1 | 1389 | |
reiniermarcel | 0:a115ff47d1c1 | 1390 | /// Draw a triangle |
reiniermarcel | 0:a115ff47d1c1 | 1391 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1392 | /// Draws a triangle using the foreground color setting. |
reiniermarcel | 0:a115ff47d1c1 | 1393 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1394 | /// @param[in] x1 is the horizontal for point 1. |
reiniermarcel | 0:a115ff47d1c1 | 1395 | /// @param[in] y1 is the vertical for point 1. |
reiniermarcel | 0:a115ff47d1c1 | 1396 | /// @param[in] x2 is the horizontal for point 2. |
reiniermarcel | 0:a115ff47d1c1 | 1397 | /// @param[in] y2 is the vertical for point 2. |
reiniermarcel | 0:a115ff47d1c1 | 1398 | /// @param[in] x3 is the horizontal for point 3. |
reiniermarcel | 0:a115ff47d1c1 | 1399 | /// @param[in] y3 is the vertical for point 3. |
reiniermarcel | 0:a115ff47d1c1 | 1400 | /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL. |
reiniermarcel | 0:a115ff47d1c1 | 1401 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1402 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1403 | RetCode_t triangle(loc_t x1, loc_t y1, loc_t x2, loc_t y2, |
reiniermarcel | 0:a115ff47d1c1 | 1404 | loc_t x3, loc_t y3, fill_t fillit = NOFILL); |
reiniermarcel | 0:a115ff47d1c1 | 1405 | |
reiniermarcel | 0:a115ff47d1c1 | 1406 | /// Draw a circle using the specified color. |
reiniermarcel | 0:a115ff47d1c1 | 1407 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1408 | /// @note As a side effect, this changes the current |
reiniermarcel | 0:a115ff47d1c1 | 1409 | /// foreground color for subsequent operations. |
reiniermarcel | 0:a115ff47d1c1 | 1410 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1411 | /// @param[in] x is the horizontal center of the circle. |
reiniermarcel | 0:a115ff47d1c1 | 1412 | /// @param[in] y is the vertical center of the circle. |
reiniermarcel | 0:a115ff47d1c1 | 1413 | /// @param[in] radius defines the size of the circle. |
reiniermarcel | 0:a115ff47d1c1 | 1414 | /// @param[in] color defines the foreground color. |
reiniermarcel | 0:a115ff47d1c1 | 1415 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1416 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1417 | RetCode_t circle(loc_t x, loc_t y, dim_t radius, color_t color, fill_t fillit = NOFILL); |
reiniermarcel | 0:a115ff47d1c1 | 1418 | |
reiniermarcel | 0:a115ff47d1c1 | 1419 | /// Draw a filled circle using the specified color. |
reiniermarcel | 0:a115ff47d1c1 | 1420 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1421 | /// @note As a side effect, this changes the current |
reiniermarcel | 0:a115ff47d1c1 | 1422 | /// foreground color for subsequent operations. |
reiniermarcel | 0:a115ff47d1c1 | 1423 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1424 | /// @param[in] x is the horizontal center of the circle. |
reiniermarcel | 0:a115ff47d1c1 | 1425 | /// @param[in] y is the vertical center of the circle. |
reiniermarcel | 0:a115ff47d1c1 | 1426 | /// @param[in] radius defines the size of the circle. |
reiniermarcel | 0:a115ff47d1c1 | 1427 | /// @param[in] color defines the foreground color. |
reiniermarcel | 0:a115ff47d1c1 | 1428 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1429 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1430 | RetCode_t fillcircle(loc_t x, loc_t y, dim_t radius, color_t color, fill_t fillit = FILL); |
reiniermarcel | 0:a115ff47d1c1 | 1431 | |
reiniermarcel | 0:a115ff47d1c1 | 1432 | /// Draw a circle. |
reiniermarcel | 0:a115ff47d1c1 | 1433 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1434 | /// Draws a circle using the foreground color setting. |
reiniermarcel | 0:a115ff47d1c1 | 1435 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1436 | /// @param[in] x is the horizontal center of the circle. |
reiniermarcel | 0:a115ff47d1c1 | 1437 | /// @param[in] y is the vertical center of the circle. |
reiniermarcel | 0:a115ff47d1c1 | 1438 | /// @param[in] radius defines the size of the circle. |
reiniermarcel | 0:a115ff47d1c1 | 1439 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1440 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1441 | RetCode_t circle(loc_t x, loc_t y, dim_t radius, fill_t fillit = NOFILL); |
reiniermarcel | 0:a115ff47d1c1 | 1442 | |
reiniermarcel | 0:a115ff47d1c1 | 1443 | /// Draw an Ellipse using the specified color |
reiniermarcel | 0:a115ff47d1c1 | 1444 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1445 | /// @note As a side effect, this changes the current |
reiniermarcel | 0:a115ff47d1c1 | 1446 | /// foreground color for subsequent operations. |
reiniermarcel | 0:a115ff47d1c1 | 1447 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1448 | /// @param[in] x is the horizontal center of the ellipse. |
reiniermarcel | 0:a115ff47d1c1 | 1449 | /// @param[in] y is the vertical center of the ellipse. |
reiniermarcel | 0:a115ff47d1c1 | 1450 | /// @param[in] radius1 defines the horizontal radius of the ellipse. |
reiniermarcel | 0:a115ff47d1c1 | 1451 | /// @param[in] radius2 defines the vertical radius of the ellipse. |
reiniermarcel | 0:a115ff47d1c1 | 1452 | /// @param[in] color defines the foreground color. |
reiniermarcel | 0:a115ff47d1c1 | 1453 | /// @param[in] fillit defines whether the circle is filled or not. |
reiniermarcel | 0:a115ff47d1c1 | 1454 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1455 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1456 | RetCode_t ellipse(loc_t x, loc_t y, dim_t radius1, dim_t radius2, |
reiniermarcel | 0:a115ff47d1c1 | 1457 | color_t color, fill_t fillit = NOFILL); |
reiniermarcel | 0:a115ff47d1c1 | 1458 | |
reiniermarcel | 0:a115ff47d1c1 | 1459 | /// Draw a filled Ellipse using the specified color |
reiniermarcel | 0:a115ff47d1c1 | 1460 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1461 | /// @note As a side effect, this changes the current |
reiniermarcel | 0:a115ff47d1c1 | 1462 | /// foreground color for subsequent operations. |
reiniermarcel | 0:a115ff47d1c1 | 1463 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1464 | /// @param[in] x is the horizontal center of the ellipse. |
reiniermarcel | 0:a115ff47d1c1 | 1465 | /// @param[in] y is the vertical center of the ellipse. |
reiniermarcel | 0:a115ff47d1c1 | 1466 | /// @param[in] radius1 defines the horizontal radius of the ellipse. |
reiniermarcel | 0:a115ff47d1c1 | 1467 | /// @param[in] radius2 defines the vertical radius of the ellipse. |
reiniermarcel | 0:a115ff47d1c1 | 1468 | /// @param[in] color defines the foreground color. |
reiniermarcel | 0:a115ff47d1c1 | 1469 | /// @param[in] fillit defines whether the circle is filled or not. |
reiniermarcel | 0:a115ff47d1c1 | 1470 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1471 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1472 | RetCode_t fillellipse(loc_t x, loc_t y, dim_t radius1, dim_t radius2, |
reiniermarcel | 0:a115ff47d1c1 | 1473 | color_t color, fill_t fillit = FILL); |
reiniermarcel | 0:a115ff47d1c1 | 1474 | |
reiniermarcel | 0:a115ff47d1c1 | 1475 | /// Draw an Ellipse |
reiniermarcel | 0:a115ff47d1c1 | 1476 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1477 | /// Draws it using the foreground color setting. |
reiniermarcel | 0:a115ff47d1c1 | 1478 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1479 | /// @param[in] x is the horizontal center of the ellipse. |
reiniermarcel | 0:a115ff47d1c1 | 1480 | /// @param[in] y is the vertical center of the ellipse. |
reiniermarcel | 0:a115ff47d1c1 | 1481 | /// @param[in] radius1 defines the horizontal radius of the ellipse. |
reiniermarcel | 0:a115ff47d1c1 | 1482 | /// @param[in] radius2 defines the vertical radius of the ellipse. |
reiniermarcel | 0:a115ff47d1c1 | 1483 | /// @param[in] fillit defines whether the circle is filled or not. |
reiniermarcel | 0:a115ff47d1c1 | 1484 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1485 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1486 | RetCode_t ellipse(loc_t x, loc_t y, dim_t radius1, dim_t radius2, fill_t fillit = NOFILL); |
reiniermarcel | 0:a115ff47d1c1 | 1487 | |
reiniermarcel | 0:a115ff47d1c1 | 1488 | /// Control display power |
reiniermarcel | 0:a115ff47d1c1 | 1489 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1490 | /// @param[in] on when set to true will turn on the display, when false it is turned off. |
reiniermarcel | 0:a115ff47d1c1 | 1491 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1492 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1493 | RetCode_t Power(bool on); |
reiniermarcel | 0:a115ff47d1c1 | 1494 | |
reiniermarcel | 0:a115ff47d1c1 | 1495 | /// Reset the display controller via the Software Reset interface. |
reiniermarcel | 0:a115ff47d1c1 | 1496 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1497 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1498 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1499 | RetCode_t Reset(void); |
reiniermarcel | 0:a115ff47d1c1 | 1500 | |
reiniermarcel | 0:a115ff47d1c1 | 1501 | /// Set backlight brightness. |
reiniermarcel | 0:a115ff47d1c1 | 1502 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1503 | /// When the built-in PWM is used to control the backlight, this |
reiniermarcel | 0:a115ff47d1c1 | 1504 | /// API can be used to set the brightness. |
reiniermarcel | 0:a115ff47d1c1 | 1505 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1506 | /// @param[in] brightness ranges from 0 (off) to 255 (full on) |
reiniermarcel | 0:a115ff47d1c1 | 1507 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1508 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1509 | RetCode_t Backlight_u8(unsigned char brightness); |
reiniermarcel | 0:a115ff47d1c1 | 1510 | |
reiniermarcel | 0:a115ff47d1c1 | 1511 | /// Set backlight brightness. |
reiniermarcel | 0:a115ff47d1c1 | 1512 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1513 | /// When the built-in PWM is used to control the backlight, this |
reiniermarcel | 0:a115ff47d1c1 | 1514 | /// API can be used to set the brightness. |
reiniermarcel | 0:a115ff47d1c1 | 1515 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1516 | /// @param[in] brightness ranges from 0.0 (off) to 1.0 (full on) |
reiniermarcel | 0:a115ff47d1c1 | 1517 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1518 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1519 | RetCode_t Backlight(float brightness); |
reiniermarcel | 0:a115ff47d1c1 | 1520 | |
reiniermarcel | 0:a115ff47d1c1 | 1521 | /// Select a bitmap font (provided by the user) for all subsequent text. |
reiniermarcel | 0:a115ff47d1c1 | 1522 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1523 | /// @note Tool to create the fonts is accessible from its creator |
reiniermarcel | 0:a115ff47d1c1 | 1524 | /// available at http://www.mikroe.com. |
reiniermarcel | 0:a115ff47d1c1 | 1525 | /// Change the data to an array of type char[]. |
reiniermarcel | 0:a115ff47d1c1 | 1526 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1527 | /// @param[in] font is a pointer to a specially formed font array. |
reiniermarcel | 0:a115ff47d1c1 | 1528 | /// This special font array has a 4-byte header, followed by |
reiniermarcel | 0:a115ff47d1c1 | 1529 | /// the data: |
reiniermarcel | 0:a115ff47d1c1 | 1530 | /// - the number of bytes per char |
reiniermarcel | 0:a115ff47d1c1 | 1531 | /// - the vertical size in pixels for each character |
reiniermarcel | 0:a115ff47d1c1 | 1532 | /// - the horizontal size in pixels for each character |
reiniermarcel | 0:a115ff47d1c1 | 1533 | /// - the number of bytes per vertical line (width of the array) |
reiniermarcel | 0:a115ff47d1c1 | 1534 | /// @returns error code. |
reiniermarcel | 0:a115ff47d1c1 | 1535 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1536 | virtual RetCode_t set_font(const unsigned char * font = NULL); |
reiniermarcel | 0:a115ff47d1c1 | 1537 | |
reiniermarcel | 0:a115ff47d1c1 | 1538 | /// Get the RGB value for a DOS color. |
reiniermarcel | 0:a115ff47d1c1 | 1539 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1540 | /// @param[in] i is the color, in the range 0 to 15; |
reiniermarcel | 0:a115ff47d1c1 | 1541 | /// @returns the RGB color of the selected index, or 0 |
reiniermarcel | 0:a115ff47d1c1 | 1542 | /// if the index is out of bounds. |
reiniermarcel | 0:a115ff47d1c1 | 1543 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1544 | color_t DOSColor(int i); |
reiniermarcel | 0:a115ff47d1c1 | 1545 | |
reiniermarcel | 0:a115ff47d1c1 | 1546 | /// Get the color name (string) for a DOS color. |
reiniermarcel | 0:a115ff47d1c1 | 1547 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1548 | /// @param[in] i is the color, in the range 0 to 15; |
reiniermarcel | 0:a115ff47d1c1 | 1549 | /// @returns a pointer to a string with the color name, |
reiniermarcel | 0:a115ff47d1c1 | 1550 | /// or NULL if the index is out of bounds. |
reiniermarcel | 0:a115ff47d1c1 | 1551 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1552 | const char * DOSColorNames(int i); |
reiniermarcel | 0:a115ff47d1c1 | 1553 | |
reiniermarcel | 0:a115ff47d1c1 | 1554 | /// Advanced method indicating the start of a graphics stream. |
reiniermarcel | 0:a115ff47d1c1 | 1555 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1556 | /// This is called prior to a stream of pixel data being sent. |
reiniermarcel | 0:a115ff47d1c1 | 1557 | /// This may cause register configuration changes in the derived |
reiniermarcel | 0:a115ff47d1c1 | 1558 | /// class in order to prepare the hardware to accept the streaming |
reiniermarcel | 0:a115ff47d1c1 | 1559 | /// data. |
reiniermarcel | 0:a115ff47d1c1 | 1560 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1561 | /// Following this command, a series of @see _putp() commands can |
reiniermarcel | 0:a115ff47d1c1 | 1562 | /// be used to send individual pixels to the screen. |
reiniermarcel | 0:a115ff47d1c1 | 1563 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1564 | /// To conclude the graphics stream, @see _EndGraphicsStream should |
reiniermarcel | 0:a115ff47d1c1 | 1565 | /// be callled. |
reiniermarcel | 0:a115ff47d1c1 | 1566 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1567 | /// @returns error code. |
reiniermarcel | 0:a115ff47d1c1 | 1568 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1569 | virtual RetCode_t _StartGraphicsStream(void); |
reiniermarcel | 0:a115ff47d1c1 | 1570 | |
reiniermarcel | 0:a115ff47d1c1 | 1571 | /// Advanced method to put a single color pixel to the screen. |
reiniermarcel | 0:a115ff47d1c1 | 1572 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1573 | /// This method may be called as many times as necessary after |
reiniermarcel | 0:a115ff47d1c1 | 1574 | /// @see _StartGraphicsStream() is called, and it should be followed |
reiniermarcel | 0:a115ff47d1c1 | 1575 | /// by _EndGraphicsStream. |
reiniermarcel | 0:a115ff47d1c1 | 1576 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1577 | /// @param[in] pixel is a color value to be put on the screen. |
reiniermarcel | 0:a115ff47d1c1 | 1578 | /// @returns error code. |
reiniermarcel | 0:a115ff47d1c1 | 1579 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1580 | virtual RetCode_t _putp(color_t pixel); |
reiniermarcel | 0:a115ff47d1c1 | 1581 | |
reiniermarcel | 0:a115ff47d1c1 | 1582 | /// Advanced method indicating the end of a graphics stream. |
reiniermarcel | 0:a115ff47d1c1 | 1583 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1584 | /// This is called to conclude a stream of pixel data that was sent. |
reiniermarcel | 0:a115ff47d1c1 | 1585 | /// This may cause register configuration changes in the derived |
reiniermarcel | 0:a115ff47d1c1 | 1586 | /// class in order to stop the hardware from accept the streaming |
reiniermarcel | 0:a115ff47d1c1 | 1587 | /// data. |
reiniermarcel | 0:a115ff47d1c1 | 1588 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1589 | /// @returns error code. |
reiniermarcel | 0:a115ff47d1c1 | 1590 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1591 | virtual RetCode_t _EndGraphicsStream(void); |
reiniermarcel | 0:a115ff47d1c1 | 1592 | |
reiniermarcel | 0:a115ff47d1c1 | 1593 | /// Set the SPI port frequency (in Hz). |
reiniermarcel | 0:a115ff47d1c1 | 1594 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1595 | /// This uses the mbed SPI driver, and is therefore dependent on |
reiniermarcel | 0:a115ff47d1c1 | 1596 | /// its capabilities. The RA8875 can accept writes via SPI faster |
reiniermarcel | 0:a115ff47d1c1 | 1597 | /// than a read can be performed. The frequency set by this API |
reiniermarcel | 0:a115ff47d1c1 | 1598 | /// is for the SPI writes. It will automatically reduce the SPI |
reiniermarcel | 0:a115ff47d1c1 | 1599 | /// clock rate when a read is performed, and restore it for the |
reiniermarcel | 0:a115ff47d1c1 | 1600 | /// next write. Alternately, the 2nd parameters permits setting |
reiniermarcel | 0:a115ff47d1c1 | 1601 | /// the read speed rather than letting it compute it automatically. |
reiniermarcel | 0:a115ff47d1c1 | 1602 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1603 | /// @note The primary effect of this is to recover more CPU cycles |
reiniermarcel | 0:a115ff47d1c1 | 1604 | /// for your application code. Keep in mind that when more than |
reiniermarcel | 0:a115ff47d1c1 | 1605 | /// one command is sent to the display controller, that it |
reiniermarcel | 0:a115ff47d1c1 | 1606 | /// will wait for the controller to finish the prior command. |
reiniermarcel | 0:a115ff47d1c1 | 1607 | /// In this case, the performance is limited by the RA8875. |
reiniermarcel | 0:a115ff47d1c1 | 1608 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1609 | /// @param[in] Hz is the frequency in Hz, tested range includes the |
reiniermarcel | 0:a115ff47d1c1 | 1610 | /// range from 1,000,000 (1MHz) to 10,000,000 (10 MHz). Values |
reiniermarcel | 0:a115ff47d1c1 | 1611 | /// outside this range will be accepted, but operation may |
reiniermarcel | 0:a115ff47d1c1 | 1612 | /// be unreliable. This depends partially on your hardware design |
reiniermarcel | 0:a115ff47d1c1 | 1613 | /// and the wires connecting the display module. |
reiniermarcel | 0:a115ff47d1c1 | 1614 | /// The default value is 5,000,000, which should work for most |
reiniermarcel | 0:a115ff47d1c1 | 1615 | /// applications as a starting point. |
reiniermarcel | 0:a115ff47d1c1 | 1616 | /// @param[in] Hz2 is an optional parameter and will set the read |
reiniermarcel | 0:a115ff47d1c1 | 1617 | /// speed independently of the write speed. |
reiniermarcel | 0:a115ff47d1c1 | 1618 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1619 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1620 | RetCode_t frequency(unsigned long Hz = RA8875_DEFAULT_SPI_FREQ, unsigned long Hz2 = 0); |
reiniermarcel | 0:a115ff47d1c1 | 1621 | |
reiniermarcel | 0:a115ff47d1c1 | 1622 | /// This method captures the specified area as a 24-bit bitmap file. |
reiniermarcel | 0:a115ff47d1c1 | 1623 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1624 | /// Even though this is a 16-bit display, the stored image is in |
reiniermarcel | 0:a115ff47d1c1 | 1625 | /// 24-bit format. |
reiniermarcel | 0:a115ff47d1c1 | 1626 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1627 | /// This method will interrogate the current display setting and |
reiniermarcel | 0:a115ff47d1c1 | 1628 | /// create a bitmap based on those settings. For instance, if |
reiniermarcel | 0:a115ff47d1c1 | 1629 | /// only layer 1 is visible, then the bitmap is only layer 1. However, |
reiniermarcel | 0:a115ff47d1c1 | 1630 | /// if there is some other operation in effect (transparent mode). |
reiniermarcel | 0:a115ff47d1c1 | 1631 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1632 | /// @param[in] x is the left edge of the region to capture |
reiniermarcel | 0:a115ff47d1c1 | 1633 | /// @param[in] y is the top edge of the region to capture |
reiniermarcel | 0:a115ff47d1c1 | 1634 | /// @param[in] w is the width of the region to capture |
reiniermarcel | 0:a115ff47d1c1 | 1635 | /// @param[in] h is the height of the region to capture. |
reiniermarcel | 0:a115ff47d1c1 | 1636 | /// @param[out] Name_BMP is the filename to write the image to. |
reiniermarcel | 0:a115ff47d1c1 | 1637 | /// @return success or error code. |
reiniermarcel | 0:a115ff47d1c1 | 1638 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1639 | RetCode_t PrintScreen(loc_t x, loc_t y, dim_t w, dim_t h, const char *Name_BMP); |
reiniermarcel | 0:a115ff47d1c1 | 1640 | |
reiniermarcel | 0:a115ff47d1c1 | 1641 | /// This method captures the specified area as a 24-bit bitmap file, |
reiniermarcel | 0:a115ff47d1c1 | 1642 | /// including the option of layer selection. |
reiniermarcel | 0:a115ff47d1c1 | 1643 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1644 | /// @caution This method is deprecated as the alternate PrintScreen API |
reiniermarcel | 0:a115ff47d1c1 | 1645 | /// automatically examines the display layer configuration. |
reiniermarcel | 0:a115ff47d1c1 | 1646 | /// Therefore, calls to this API will ignore the layer parameter |
reiniermarcel | 0:a115ff47d1c1 | 1647 | /// and automatically execute the other method. |
reiniermarcel | 0:a115ff47d1c1 | 1648 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1649 | /// Even though this is a 16-bit display, the stored image is in |
reiniermarcel | 0:a115ff47d1c1 | 1650 | /// 24-bit format. |
reiniermarcel | 0:a115ff47d1c1 | 1651 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1652 | /// @param[in] layer is 0 or 1 to select the layer to extract. |
reiniermarcel | 0:a115ff47d1c1 | 1653 | /// @param[in] x is the left edge of the region to capture |
reiniermarcel | 0:a115ff47d1c1 | 1654 | /// @param[in] y is the top edge of the region to capture |
reiniermarcel | 0:a115ff47d1c1 | 1655 | /// @param[in] w is the width of the region to capture |
reiniermarcel | 0:a115ff47d1c1 | 1656 | /// @param[in] h is the height of the region to capture. |
reiniermarcel | 0:a115ff47d1c1 | 1657 | /// @param[out] Name_BMP is the filename to write the image to. |
reiniermarcel | 0:a115ff47d1c1 | 1658 | /// @return success or error code. |
reiniermarcel | 0:a115ff47d1c1 | 1659 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1660 | RetCode_t PrintScreen(uint16_t layer, loc_t x, loc_t y, dim_t w, dim_t h, const char *Name_BMP); |
reiniermarcel | 0:a115ff47d1c1 | 1661 | |
reiniermarcel | 0:a115ff47d1c1 | 1662 | |
reiniermarcel | 0:a115ff47d1c1 | 1663 | #ifdef PERF_METRICS |
reiniermarcel | 0:a115ff47d1c1 | 1664 | /// Clear the performance metrics to zero. |
reiniermarcel | 0:a115ff47d1c1 | 1665 | void ClearPerformance(); |
reiniermarcel | 0:a115ff47d1c1 | 1666 | |
reiniermarcel | 0:a115ff47d1c1 | 1667 | /// Count idle time. |
reiniermarcel | 0:a115ff47d1c1 | 1668 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1669 | /// @param[in] t is the amount of idle time to accumulate. |
reiniermarcel | 0:a115ff47d1c1 | 1670 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1671 | void CountIdleTime(uint32_t t); |
reiniermarcel | 0:a115ff47d1c1 | 1672 | |
reiniermarcel | 0:a115ff47d1c1 | 1673 | /// Report the performance metrics for drawing functions using |
reiniermarcel | 0:a115ff47d1c1 | 1674 | /// the available serial channel. |
reiniermarcel | 0:a115ff47d1c1 | 1675 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1676 | /// @param[in,out] pc is the serial channel to write to. |
reiniermarcel | 0:a115ff47d1c1 | 1677 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1678 | void ReportPerformance(Serial & pc); |
reiniermarcel | 0:a115ff47d1c1 | 1679 | #endif |
reiniermarcel | 0:a115ff47d1c1 | 1680 | |
reiniermarcel | 0:a115ff47d1c1 | 1681 | |
reiniermarcel | 0:a115ff47d1c1 | 1682 | private: |
reiniermarcel | 0:a115ff47d1c1 | 1683 | /// Touch Panel register name definitions |
reiniermarcel | 0:a115ff47d1c1 | 1684 | #define TPCR0 0x70 |
reiniermarcel | 0:a115ff47d1c1 | 1685 | #define TPCR1 0x71 |
reiniermarcel | 0:a115ff47d1c1 | 1686 | #define TPXH 0x72 |
reiniermarcel | 0:a115ff47d1c1 | 1687 | #define TPYH 0x73 |
reiniermarcel | 0:a115ff47d1c1 | 1688 | #define TPXYL 0x74 |
reiniermarcel | 0:a115ff47d1c1 | 1689 | #define INTC1 0xF0 |
reiniermarcel | 0:a115ff47d1c1 | 1690 | #define INTC2 0xF1 |
reiniermarcel | 0:a115ff47d1c1 | 1691 | |
reiniermarcel | 0:a115ff47d1c1 | 1692 | /// Specify the default settings for the Touch Panel, where different from the chip defaults |
reiniermarcel | 0:a115ff47d1c1 | 1693 | #define TP_MODE_DEFAULT TP_MODE_AUTO |
reiniermarcel | 0:a115ff47d1c1 | 1694 | #define TP_DEBOUNCE_DEFAULT TP_DEBOUNCE_ON |
reiniermarcel | 0:a115ff47d1c1 | 1695 | #define TP_ADC_CLKDIV_DEFAULT TP_ADC_CLKDIV_8 |
reiniermarcel | 0:a115ff47d1c1 | 1696 | |
reiniermarcel | 0:a115ff47d1c1 | 1697 | #define TP_ADC_SAMPLE_DEFAULT_CLKS TP_ADC_SAMPLE_8192_CLKS |
reiniermarcel | 0:a115ff47d1c1 | 1698 | |
reiniermarcel | 0:a115ff47d1c1 | 1699 | /// Other Touch Panel params |
reiniermarcel | 0:a115ff47d1c1 | 1700 | #define TPBUFSIZE 16 // Depth of the averaging buffers for x and y data |
reiniermarcel | 0:a115ff47d1c1 | 1701 | |
reiniermarcel | 0:a115ff47d1c1 | 1702 | /// Touch Panel calibration matrix. |
reiniermarcel | 0:a115ff47d1c1 | 1703 | tpMatrix_t tpMatrix; |
reiniermarcel | 0:a115ff47d1c1 | 1704 | |
reiniermarcel | 0:a115ff47d1c1 | 1705 | /// Internal function to put a character using the built-in (internal) font engine |
reiniermarcel | 0:a115ff47d1c1 | 1706 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1707 | /// @param[in] is the character to put to the screen. |
reiniermarcel | 0:a115ff47d1c1 | 1708 | /// @returns the character put. |
reiniermarcel | 0:a115ff47d1c1 | 1709 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1710 | int _internal_putc(int c); |
reiniermarcel | 0:a115ff47d1c1 | 1711 | |
reiniermarcel | 0:a115ff47d1c1 | 1712 | /// Internal function to put a character using the external font engine |
reiniermarcel | 0:a115ff47d1c1 | 1713 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1714 | /// @param[in] is the character to put to the screen. |
reiniermarcel | 0:a115ff47d1c1 | 1715 | /// @returns the character put. |
reiniermarcel | 0:a115ff47d1c1 | 1716 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1717 | int _external_putc(int c); |
reiniermarcel | 0:a115ff47d1c1 | 1718 | |
reiniermarcel | 0:a115ff47d1c1 | 1719 | /// Select the peripheral to use it. |
reiniermarcel | 0:a115ff47d1c1 | 1720 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1721 | /// @param[in] chipsel when true will select the peripheral, and when false |
reiniermarcel | 0:a115ff47d1c1 | 1722 | /// will deselect the chip. This is the logical selection, and |
reiniermarcel | 0:a115ff47d1c1 | 1723 | /// the pin selection is the invert of this. |
reiniermarcel | 0:a115ff47d1c1 | 1724 | /// @returns success/failure code. @see RetCode_t. |
reiniermarcel | 0:a115ff47d1c1 | 1725 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1726 | RetCode_t _select(bool chipsel); |
reiniermarcel | 0:a115ff47d1c1 | 1727 | |
reiniermarcel | 0:a115ff47d1c1 | 1728 | /// Wait while the status register indicates the controller is busy. |
reiniermarcel | 0:a115ff47d1c1 | 1729 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1730 | /// @param[in] mask is the mask of bits to monitor. |
reiniermarcel | 0:a115ff47d1c1 | 1731 | /// @returns true if a normal exit. |
reiniermarcel | 0:a115ff47d1c1 | 1732 | /// @returns false if a timeout exit. |
reiniermarcel | 0:a115ff47d1c1 | 1733 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1734 | bool _WaitWhileBusy(uint8_t mask); |
reiniermarcel | 0:a115ff47d1c1 | 1735 | |
reiniermarcel | 0:a115ff47d1c1 | 1736 | /// Wait while the the register anded with the mask is true. |
reiniermarcel | 0:a115ff47d1c1 | 1737 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1738 | /// @param[in] reg is the register to monitor |
reiniermarcel | 0:a115ff47d1c1 | 1739 | /// @param[in] mask is the bit mask to monitor |
reiniermarcel | 0:a115ff47d1c1 | 1740 | /// @returns true if it was a normal exit |
reiniermarcel | 0:a115ff47d1c1 | 1741 | /// @returns false if it was a timeout that caused the exit. |
reiniermarcel | 0:a115ff47d1c1 | 1742 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1743 | bool _WaitWhileReg(uint8_t reg, uint8_t mask); |
reiniermarcel | 0:a115ff47d1c1 | 1744 | |
reiniermarcel | 0:a115ff47d1c1 | 1745 | /// set the spi port to either the write or the read speed. |
reiniermarcel | 0:a115ff47d1c1 | 1746 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1747 | /// This is a private API used to toggle between the write |
reiniermarcel | 0:a115ff47d1c1 | 1748 | /// and the read speed for the SPI port to the RA8875, since |
reiniermarcel | 0:a115ff47d1c1 | 1749 | /// it can accept writes faster than reads. |
reiniermarcel | 0:a115ff47d1c1 | 1750 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1751 | /// @param[in] writeSpeed when true selects the write frequency, |
reiniermarcel | 0:a115ff47d1c1 | 1752 | /// and when false it selects the read frequency. |
reiniermarcel | 0:a115ff47d1c1 | 1753 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1754 | void _setWriteSpeed(bool writeSpeed); |
reiniermarcel | 0:a115ff47d1c1 | 1755 | |
reiniermarcel | 0:a115ff47d1c1 | 1756 | /// The most primitive - to write a data value to the SPI interface. |
reiniermarcel | 0:a115ff47d1c1 | 1757 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1758 | /// @param[in] data is the value to write. |
reiniermarcel | 0:a115ff47d1c1 | 1759 | /// @returns a value read from the port, since SPI is often shift |
reiniermarcel | 0:a115ff47d1c1 | 1760 | /// in while shifting out. |
reiniermarcel | 0:a115ff47d1c1 | 1761 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1762 | unsigned char _spiwrite(unsigned char data); |
reiniermarcel | 0:a115ff47d1c1 | 1763 | |
reiniermarcel | 0:a115ff47d1c1 | 1764 | /// The most primitive - to read a data value to the SPI interface. |
reiniermarcel | 0:a115ff47d1c1 | 1765 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1766 | /// This is really just a specialcase of the write command, where |
reiniermarcel | 0:a115ff47d1c1 | 1767 | /// the value zero is written in order to read. |
reiniermarcel | 0:a115ff47d1c1 | 1768 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1769 | /// @returns a value read from the port, since SPI is often shift |
reiniermarcel | 0:a115ff47d1c1 | 1770 | /// in while shifting out. |
reiniermarcel | 0:a115ff47d1c1 | 1771 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1772 | unsigned char _spiread(); |
reiniermarcel | 0:a115ff47d1c1 | 1773 | |
reiniermarcel | 0:a115ff47d1c1 | 1774 | const uint8_t * pKeyMap; |
reiniermarcel | 0:a115ff47d1c1 | 1775 | |
reiniermarcel | 0:a115ff47d1c1 | 1776 | SPI spi; ///< spi port |
reiniermarcel | 0:a115ff47d1c1 | 1777 | bool spiWriteSpeed; ///< indicates if the current mode is write or read |
reiniermarcel | 0:a115ff47d1c1 | 1778 | unsigned long spiwritefreq; ///< saved write freq |
reiniermarcel | 0:a115ff47d1c1 | 1779 | unsigned long spireadfreq; ///< saved read freq |
reiniermarcel | 0:a115ff47d1c1 | 1780 | DigitalOut cs; ///< chip select pin, assumed active low |
reiniermarcel | 0:a115ff47d1c1 | 1781 | DigitalOut res; ///< reset pin, assumed active low |
reiniermarcel | 0:a115ff47d1c1 | 1782 | const unsigned char * font; ///< reference to an external font somewhere in memory |
reiniermarcel | 0:a115ff47d1c1 | 1783 | loc_t cursor_x, cursor_y; ///< used for external fonts only |
reiniermarcel | 0:a115ff47d1c1 | 1784 | |
reiniermarcel | 0:a115ff47d1c1 | 1785 | #ifdef PERF_METRICS |
reiniermarcel | 0:a115ff47d1c1 | 1786 | typedef enum |
reiniermarcel | 0:a115ff47d1c1 | 1787 | { |
reiniermarcel | 0:a115ff47d1c1 | 1788 | PRF_CLS, |
reiniermarcel | 0:a115ff47d1c1 | 1789 | PRF_DRAWPIXEL, |
reiniermarcel | 0:a115ff47d1c1 | 1790 | PRF_PIXELSTREAM, |
reiniermarcel | 0:a115ff47d1c1 | 1791 | PRF_READPIXEL, |
reiniermarcel | 0:a115ff47d1c1 | 1792 | PRF_READPIXELSTREAM, |
reiniermarcel | 0:a115ff47d1c1 | 1793 | PRF_DRAWLINE, |
reiniermarcel | 0:a115ff47d1c1 | 1794 | PRF_DRAWRECTANGLE, |
reiniermarcel | 0:a115ff47d1c1 | 1795 | PRF_DRAWROUNDEDRECTANGLE, |
reiniermarcel | 0:a115ff47d1c1 | 1796 | PRF_DRAWTRIANGLE, |
reiniermarcel | 0:a115ff47d1c1 | 1797 | PRF_DRAWCIRCLE, |
reiniermarcel | 0:a115ff47d1c1 | 1798 | PRF_DRAWELLIPSE, |
reiniermarcel | 0:a115ff47d1c1 | 1799 | METRICCOUNT |
reiniermarcel | 0:a115ff47d1c1 | 1800 | } method_e; |
reiniermarcel | 0:a115ff47d1c1 | 1801 | unsigned long metrics[METRICCOUNT]; |
reiniermarcel | 0:a115ff47d1c1 | 1802 | unsigned long idletime_usec; |
reiniermarcel | 0:a115ff47d1c1 | 1803 | void RegisterPerformance(method_e method); |
reiniermarcel | 0:a115ff47d1c1 | 1804 | Timer performance; |
reiniermarcel | 0:a115ff47d1c1 | 1805 | #endif |
reiniermarcel | 0:a115ff47d1c1 | 1806 | }; |
reiniermarcel | 0:a115ff47d1c1 | 1807 | |
reiniermarcel | 0:a115ff47d1c1 | 1808 | //} // namespace |
reiniermarcel | 0:a115ff47d1c1 | 1809 | |
reiniermarcel | 0:a115ff47d1c1 | 1810 | //using namespace SW_graphics; |
reiniermarcel | 0:a115ff47d1c1 | 1811 | |
reiniermarcel | 0:a115ff47d1c1 | 1812 | |
reiniermarcel | 0:a115ff47d1c1 | 1813 | #ifdef TESTENABLE |
reiniermarcel | 0:a115ff47d1c1 | 1814 | // ______________ ______________ ______________ _______________ |
reiniermarcel | 0:a115ff47d1c1 | 1815 | // /_____ _____/ / ___________/ / ___________/ /_____ ______/ |
reiniermarcel | 0:a115ff47d1c1 | 1816 | // / / / / / / / / |
reiniermarcel | 0:a115ff47d1c1 | 1817 | // / / / /___ / /__________ / / |
reiniermarcel | 0:a115ff47d1c1 | 1818 | // / / / ____/ /__________ / / / |
reiniermarcel | 0:a115ff47d1c1 | 1819 | // / / / / / / / / |
reiniermarcel | 0:a115ff47d1c1 | 1820 | // / / / /__________ ___________/ / / / |
reiniermarcel | 0:a115ff47d1c1 | 1821 | // /__/ /_____________/ /_____________/ /__/ |
reiniermarcel | 0:a115ff47d1c1 | 1822 | |
reiniermarcel | 0:a115ff47d1c1 | 1823 | #include "WebColors.h" |
reiniermarcel | 0:a115ff47d1c1 | 1824 | #include "Arial12x12.h" |
reiniermarcel | 0:a115ff47d1c1 | 1825 | #include <algorithm> |
reiniermarcel | 0:a115ff47d1c1 | 1826 | |
reiniermarcel | 0:a115ff47d1c1 | 1827 | extern "C" void mbed_reset(); |
reiniermarcel | 0:a115ff47d1c1 | 1828 | |
reiniermarcel | 0:a115ff47d1c1 | 1829 | /// This activates a small set of tests for the graphics library. |
reiniermarcel | 0:a115ff47d1c1 | 1830 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1831 | /// Call this API and pass it the reference to the display class. |
reiniermarcel | 0:a115ff47d1c1 | 1832 | /// It will then run a series of tests. It accepts interaction via |
reiniermarcel | 0:a115ff47d1c1 | 1833 | /// stdin to switch from automatic test mode to manual, run a specific |
reiniermarcel | 0:a115ff47d1c1 | 1834 | /// test, or to exit the test mode. |
reiniermarcel | 0:a115ff47d1c1 | 1835 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1836 | /// @param[in] lcd is a reference to the display class. |
reiniermarcel | 0:a115ff47d1c1 | 1837 | /// @param[in] pc is a reference to a serial interface, typically the USB to PC. |
reiniermarcel | 0:a115ff47d1c1 | 1838 | /// |
reiniermarcel | 0:a115ff47d1c1 | 1839 | void RunTestSet(RA8875 & lcd, Serial & pc); |
reiniermarcel | 0:a115ff47d1c1 | 1840 | |
reiniermarcel | 0:a115ff47d1c1 | 1841 | |
reiniermarcel | 0:a115ff47d1c1 | 1842 | // To enable the test code, uncomment this section, or copy the |
reiniermarcel | 0:a115ff47d1c1 | 1843 | // necessary pieces to your "main()". |
reiniermarcel | 0:a115ff47d1c1 | 1844 | // |
reiniermarcel | 0:a115ff47d1c1 | 1845 | // #include "mbed.h" |
reiniermarcel | 0:a115ff47d1c1 | 1846 | // #include "RA8875.h" |
reiniermarcel | 0:a115ff47d1c1 | 1847 | // RA8875 lcd(p5, p6, p7, p12, NC, "tft"); // MOSI, MISO, SCK, /ChipSelect, /reset, name |
reiniermarcel | 0:a115ff47d1c1 | 1848 | // Serial pc(USBTX, USBRX); |
reiniermarcel | 0:a115ff47d1c1 | 1849 | // extern "C" void mbed_reset(); |
reiniermarcel | 0:a115ff47d1c1 | 1850 | // int main() |
reiniermarcel | 0:a115ff47d1c1 | 1851 | // { |
reiniermarcel | 0:a115ff47d1c1 | 1852 | // pc.baud(460800); // I like a snappy terminal, so crank it up! |
reiniermarcel | 0:a115ff47d1c1 | 1853 | // pc.printf("\r\nRA8875 Test - Build " __DATE__ " " __TIME__ "\r\n"); |
reiniermarcel | 0:a115ff47d1c1 | 1854 | // |
reiniermarcel | 0:a115ff47d1c1 | 1855 | // pc.printf("Turning on display\r\n"); |
reiniermarcel | 0:a115ff47d1c1 | 1856 | // lcd.Reset(); |
reiniermarcel | 0:a115ff47d1c1 | 1857 | // lcd.Power(true); // display power is on, but the backlight is independent |
reiniermarcel | 0:a115ff47d1c1 | 1858 | // lcd.Backlight(0.5); |
reiniermarcel | 0:a115ff47d1c1 | 1859 | // RunTestSet(lcd, pc); |
reiniermarcel | 0:a115ff47d1c1 | 1860 | // } |
reiniermarcel | 0:a115ff47d1c1 | 1861 | |
reiniermarcel | 0:a115ff47d1c1 | 1862 | #endif // TESTENABLE |
reiniermarcel | 0:a115ff47d1c1 | 1863 | |
reiniermarcel | 0:a115ff47d1c1 | 1864 | #endif |