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

Dependents:   FRDM_RA8875_mPaint RA8875_Demo RA8875_KeyPadDemo SignalGenerator ... more

Fork of SPI_TFT by Peter Drescher

See Components - RA8875 Based Display

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

Offline Help Manual (Windows chm)

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

Committer:
WiredHome
Date:
Thu Aug 08 11:29:48 2019 +0000
Revision:
183:808f272e481e
Parent:
182:8832d03a2a29
Child:
185:cb7591a43f44
Minor code-cleanup

Who changed what in which revision?

UserRevisionLine numberNew contents of line
WiredHome 78:faf49c381591 1 ///
WiredHome 78:faf49c381591 2 /// @mainpage RA8875 Display Controller Driver library
WiredHome 78:faf49c381591 3 ///
WiredHome 78:faf49c381591 4 /// The RA8875 Display controller is a powerful interface for low cost displays. It
WiredHome 167:8aa3fb2a5a31 5 /// can support displays up to 800 x 480 pixels x 16-bit color.
WiredHome 167:8aa3fb2a5a31 6 ///
WiredHome 182:8832d03a2a29 7 /// @image html Example_Program.png "Image of an Example Program"
WiredHome 182:8832d03a2a29 8 ///
WiredHome 167:8aa3fb2a5a31 9 /// Aside from 800 x 480 pixel displays, another common implementation is
WiredHome 167:8aa3fb2a5a31 10 /// 480 x 272 x 16 with two layers. The two layers can be exchanged, or blended
WiredHome 167:8aa3fb2a5a31 11 /// in various ways (transparency, OR, AND, and more). It includes graphics
WiredHome 167:8aa3fb2a5a31 12 /// acceleration capabilities for drawing primitives, such as line, rectangle,
WiredHome 167:8aa3fb2a5a31 13 /// circles, and more.
WiredHome 167:8aa3fb2a5a31 14 ///
WiredHome 167:8aa3fb2a5a31 15 /// It is not a display for video-speed animations, and maybe could hold its own
WiredHome 167:8aa3fb2a5a31 16 /// as a slow picture frame, at least when using the SPI ports. How the performance
WiredHome 167:8aa3fb2a5a31 17 /// differs using I2C, 8-bit parallel or 16-bit parallel has not been evaluated.
WiredHome 167:8aa3fb2a5a31 18 /// Certainly the parallel interface option would be expected to be a lot faster.
WiredHome 167:8aa3fb2a5a31 19 ///
WiredHome 167:8aa3fb2a5a31 20 /// What it is good at is performing as a basic display for appliance or simple
WiredHome 167:8aa3fb2a5a31 21 /// home automation, and because of the built-in capability to draw lines, circles,
WiredHome 167:8aa3fb2a5a31 22 /// ellipses, rectangles, rounded rectangles, and triangles, it does a lot of the
WiredHome 167:8aa3fb2a5a31 23 /// work that your host micro would otherwise be doing, and in many cases it does
WiredHome 167:8aa3fb2a5a31 24 /// it much faster.
WiredHome 78:faf49c381591 25 ///
WiredHome 167:8aa3fb2a5a31 26 /// While it is good to know about Bresenham's algorithm (to draw a line) and how
WiredHome 167:8aa3fb2a5a31 27 /// to implement it in software, this controller simplifies things -
WiredHome 167:8aa3fb2a5a31 28 /// You just give it (x1,y1), (x2,y2) and tell it to draw a line.
WiredHome 167:8aa3fb2a5a31 29 /// Without the hardware acceleration built into the RA8875, the host would have to
WiredHome 167:8aa3fb2a5a31 30 /// compute every point, set the graphics cursor to that point, and fill in that
WiredHome 167:8aa3fb2a5a31 31 /// point with the target color. A diagonal line of some length might take 100
WiredHome 167:8aa3fb2a5a31 32 /// interactions instead of just a few. Other drawing primitives are similarly easy.
WiredHome 167:8aa3fb2a5a31 33 ///
WiredHome 167:8aa3fb2a5a31 34 /// It has some built-in fonts, which can be enhanced with optional font-chips, and
WiredHome 167:8aa3fb2a5a31 35 /// with the provided software font engine, and a few instructions, you can convert
WiredHome 167:8aa3fb2a5a31 36 /// most any True Type Font into the data structures suitable for this display.
WiredHome 167:8aa3fb2a5a31 37 ///
WiredHome 167:8aa3fb2a5a31 38 /// To round out the features, this library offers the ability to render Bitmap (BMP),
WiredHome 167:8aa3fb2a5a31 39 /// Icon (ICO), Join Photographic Experts Group (JPG), and Graphics Interchange Format
WiredHome 167:8aa3fb2a5a31 40 /// (GIF) images. These are implemented primarily in software, taking advantage of the
WiredHome 167:8aa3fb2a5a31 41 /// hardware acceleration where it can.
WiredHome 167:8aa3fb2a5a31 42 ///
WiredHome 167:8aa3fb2a5a31 43 /// When you are satisfied with what appears on screen, there is a PrintScreen method
WiredHome 167:8aa3fb2a5a31 44 /// to pull that image back out and write it to a file system as a BitMap image.
WiredHome 101:e0aad446094a 45 ///
WiredHome 78:faf49c381591 46 /// The controller additionally supports backlight control (via PWM), keypad scanning
WiredHome 167:8aa3fb2a5a31 47 /// (for a 4 x 5 matrix) and resistive touch-panel support. Support for capacitive
WiredHome 167:8aa3fb2a5a31 48 /// touch screens is also integrated, in a manner that makes the resistive and
WiredHome 167:8aa3fb2a5a31 49 /// capacitive interfaces nearly API identical. The capacitive touch support is for
WiredHome 167:8aa3fb2a5a31 50 /// either the FT5206 or the GSL1680 controller chips.
WiredHome 167:8aa3fb2a5a31 51 ///
WiredHome 167:8aa3fb2a5a31 52 /// Here's a few hints to get started:
WiredHome 167:8aa3fb2a5a31 53 /// * @ref Display_Config
WiredHome 167:8aa3fb2a5a31 54 /// * @ref Touch_Panel
WiredHome 167:8aa3fb2a5a31 55 /// * @ref Hardwired_KeyPad
WiredHome 167:8aa3fb2a5a31 56 /// * @ref Example_Program
WiredHome 167:8aa3fb2a5a31 57 /// * @ref Wiring_Diagram
WiredHome 182:8832d03a2a29 58 /// * @ref External_Resources
WiredHome 167:8aa3fb2a5a31 59 /// * @ref Future_Plans
WiredHome 167:8aa3fb2a5a31 60 ///
WiredHome 167:8aa3fb2a5a31 61 /// @todo Add APIs for the 2nd RA8875 PWM channel. If the frequency can be independently
WiredHome 167:8aa3fb2a5a31 62 /// controlled, it could be used as a simple beeper.
WiredHome 167:8aa3fb2a5a31 63 /// @todo Figure out how to "init()" in the constructor. I ran into some issues if
WiredHome 167:8aa3fb2a5a31 64 /// the display was instantiated before main(), and the code would not run,
WiredHome 167:8aa3fb2a5a31 65 /// thus the exposure and activation of the init() function. If the constructor
WiredHome 167:8aa3fb2a5a31 66 /// was within main(), then it seemed to work as expected.
WiredHome 78:faf49c381591 67 ///
WiredHome 167:8aa3fb2a5a31 68 /// @note As the author of this library, let me state that I am not affiliated with
WiredHome 167:8aa3fb2a5a31 69 /// Raio (silicon provider of the RA8875), or with BuyDisplay.com (where a lot
WiredHome 167:8aa3fb2a5a31 70 /// of these displays can be purchased), I am simply a very satisfied customer
WiredHome 167:8aa3fb2a5a31 71 /// of the technology of the RA8875 chip.
WiredHome 167:8aa3fb2a5a31 72 ///
WiredHome 167:8aa3fb2a5a31 73 /// @copyright Copyright © 2012-2019 by Smartware Computing, all rights reserved.
WiredHome 167:8aa3fb2a5a31 74 /// This library is predominantly, that of Smartware Computing, however some
WiredHome 167:8aa3fb2a5a31 75 /// portions are compiled from the work of others. Where the contribution of
WiredHome 167:8aa3fb2a5a31 76 /// others was listed as copyright, that copyright is maintained, even as a
WiredHome 167:8aa3fb2a5a31 77 /// derivative work may have been created for better integration in this library.
WiredHome 167:8aa3fb2a5a31 78 /// See @ref Copyright_References.
WiredHome 167:8aa3fb2a5a31 79 ///
WiredHome 167:8aa3fb2a5a31 80 /// @page Copyright_References Copyright References
WiredHome 167:8aa3fb2a5a31 81 ///
WiredHome 167:8aa3fb2a5a31 82 /// Following are links to the known copyright references. If I overlooked any, it was
WiredHome 167:8aa3fb2a5a31 83 /// unintentional - please let me know so I can update it. Some portions of the code
WiredHome 167:8aa3fb2a5a31 84 /// have been acquired from the cloud, and where any copyright information was available,
WiredHome 167:8aa3fb2a5a31 85 /// it was preserved.
WiredHome 167:8aa3fb2a5a31 86 ///
WiredHome 167:8aa3fb2a5a31 87 /// * @ref GraphicDisplay_Copyright
WiredHome 167:8aa3fb2a5a31 88 /// * @ref TextDisplay_Copyright
WiredHome 167:8aa3fb2a5a31 89 /// * @ref TinyJPEGDecompressor_Copyright
WiredHome 167:8aa3fb2a5a31 90 /// * @ref RA8875::TouchPanelComputeCalibration
WiredHome 167:8aa3fb2a5a31 91 ///
WiredHome 167:8aa3fb2a5a31 92 /// @page Display_Config Display Configuration
WiredHome 78:faf49c381591 93 ///
WiredHome 78:faf49c381591 94 /// This section details basics for bringing the display online. At a minimum,
WiredHome 167:8aa3fb2a5a31 95 /// the display is instantiated, after which nearly any of the available commands
WiredHome 78:faf49c381591 96 /// may be issued.
WiredHome 78:faf49c381591 97 ///
WiredHome 182:8832d03a2a29 98 /// @image html RA8875_Display.png "Schematic Representation of the Display"
WiredHome 182:8832d03a2a29 99 ///
WiredHome 78:faf49c381591 100 /// During the instantiation, the display is powered on, cleared, and the backlight
WiredHome 78:faf49c381591 101 /// is energized. Additionally, the keypad and touchscreen features are activated.
WiredHome 167:8aa3fb2a5a31 102 /// It is important to keep in mind that the keypad has its default mapping,
WiredHome 167:8aa3fb2a5a31 103 /// a resistive touchscreen does not yet have the calibration matrix configured,
WiredHome 167:8aa3fb2a5a31 104 /// and the RA8875::init() function is required to configure other important options
WiredHome 167:8aa3fb2a5a31 105 /// like the display resolution.
WiredHome 78:faf49c381591 106 ///
WiredHome 78:faf49c381591 107 /// @code
WiredHome 78:faf49c381591 108 /// RA8875 lcd(p5, p6, p7, p12, NC, "tft");
WiredHome 81:01da2e34283d 109 /// lcd.init();
WiredHome 78:faf49c381591 110 /// lcd.foreground(Blue);
WiredHome 78:faf49c381591 111 /// lcd.line(0,0, 479,271);
WiredHome 78:faf49c381591 112 /// ...
WiredHome 78:faf49c381591 113 /// @endcode
WiredHome 78:faf49c381591 114 ///
WiredHome 167:8aa3fb2a5a31 115 /// @section RA8875_Capabilities Basic Capabilities
WiredHome 167:8aa3fb2a5a31 116 /// @subsection RA8875_Resolution Display Resolution
WiredHome 167:8aa3fb2a5a31 117 /// There are two very common display resolutions that use the RA8875:
WiredHome 167:8aa3fb2a5a31 118 /// * 480 x 272 pixels
WiredHome 167:8aa3fb2a5a31 119 /// * 800 x 480 pixels
WiredHome 167:8aa3fb2a5a31 120 ///
WiredHome 167:8aa3fb2a5a31 121 /// @subsection RA8875_Layers Display Layers
WiredHome 167:8aa3fb2a5a31 122 /// The RA8875 Controller, depending on the resolution and color depth, can support
WiredHome 167:8aa3fb2a5a31 123 /// multiple display layers.
WiredHome 167:8aa3fb2a5a31 124 ///
WiredHome 167:8aa3fb2a5a31 125 /// * 1 Layer - when the color depth is 16 bits per pixel
WiredHome 167:8aa3fb2a5a31 126 /// * 2 Layers - when the color depth is 8 bits per pixel and the resolution is 480 x 272.
WiredHome 78:faf49c381591 127 ///
WiredHome 167:8aa3fb2a5a31 128 ///
WiredHome 167:8aa3fb2a5a31 129 ///
WiredHome 167:8aa3fb2a5a31 130 /// @page Touch_Panel Touch Panel
WiredHome 167:8aa3fb2a5a31 131 ///
WiredHome 167:8aa3fb2a5a31 132 /// There is support for various touch panel interfaces.
WiredHome 167:8aa3fb2a5a31 133 /// * @ref Resistive_Touch_Panel - native control for a resistive touch panel.
WiredHome 167:8aa3fb2a5a31 134 /// There are a few steps to enable this interface.
WiredHome 182:8832d03a2a29 135 ///
WiredHome 182:8832d03a2a29 136 /// For the Capacitive Touch controllers, an I2C interface is required.
WiredHome 182:8832d03a2a29 137 ///
WiredHome 182:8832d03a2a29 138 /// @image html RA8875_Touch.png "Schematic Representation of the Touch Interface"
WiredHome 182:8832d03a2a29 139 ///
WiredHome 167:8aa3fb2a5a31 140 /// * @ref CapSense_FT5206 - FT5206 capacitive touch controller, integrated in
WiredHome 167:8aa3fb2a5a31 141 /// several popular RA8875-based displays. See @ref Capacitive_Touch_Panel.
WiredHome 167:8aa3fb2a5a31 142 /// * @ref CapSense_GSL1680 - GSL1680 capacitive touch controller, integrated in
WiredHome 167:8aa3fb2a5a31 143 /// several popular RA8875-based displays. See @ref Capacitive_Touch_Panel.
WiredHome 167:8aa3fb2a5a31 144 ///
WiredHome 182:8832d03a2a29 145 /// @page MicroSD_Interface Micro SD Interface
WiredHome 182:8832d03a2a29 146 ///
WiredHome 182:8832d03a2a29 147 /// Several of the displays from BuyDisplay.com include the option for a Micro SD
WiredHome 182:8832d03a2a29 148 /// card adapter. This is not tied in to the RA8875 controller, it is just provided
WiredHome 182:8832d03a2a29 149 /// as a convenience to the display product.
WiredHome 182:8832d03a2a29 150 ///
WiredHome 182:8832d03a2a29 151 /// @image html RA8875_MicroSD.png "Schematic Representation of the Micro SD Interface"
WiredHome 78:faf49c381591 152 ///
WiredHome 167:8aa3fb2a5a31 153 ///
WiredHome 167:8aa3fb2a5a31 154 /// @page Hardwired_KeyPad Hardwired Keypad
WiredHome 167:8aa3fb2a5a31 155 ///
WiredHome 167:8aa3fb2a5a31 156 /// The RA8875 controller supports a hardwired matrix of keys, which can be used to
WiredHome 167:8aa3fb2a5a31 157 /// easily monitor for up to 20 keys (4 x 5 matrix). It is quite flexible, so these
WiredHome 167:8aa3fb2a5a31 158 /// could be a set of independent functions, or they could be wired as a simple
WiredHome 167:8aa3fb2a5a31 159 /// calculator or telephone style of keypad.
WiredHome 167:8aa3fb2a5a31 160 ///
WiredHome 182:8832d03a2a29 161 /// @image html RA8875_Keypad.png "Schematic Representation of the Keypad Interface"
WiredHome 182:8832d03a2a29 162 ///
WiredHome 167:8aa3fb2a5a31 163 /// Various parameters can be configured, such as the scan rate, using @ref RA8875::KeypadInit().
WiredHome 167:8aa3fb2a5a31 164 /// The keypad has a default keypad mapping, but there is an API that permits
WiredHome 167:8aa3fb2a5a31 165 /// installing a custom @ref RA8875::SetKeyMap().
WiredHome 78:faf49c381591 166 ///
WiredHome 167:8aa3fb2a5a31 167 /// @page Resistive_Touch_Panel Resistive Touch Panel
WiredHome 167:8aa3fb2a5a31 168 ///
WiredHome 167:8aa3fb2a5a31 169 /// The RA8875 controller supports a native resistive touchscreen interface than can
WiredHome 167:8aa3fb2a5a31 170 /// track a single touch-point.
WiredHome 78:faf49c381591 171 ///
WiredHome 167:8aa3fb2a5a31 172 /// If your display has this option, you can easily accept touch input, but it comes with
WiredHome 167:8aa3fb2a5a31 173 /// some additional requirements - calibration being the primary concern.
WiredHome 167:8aa3fb2a5a31 174 ///
WiredHome 167:8aa3fb2a5a31 175 /// @section Touch_Panel_Enable Touch Panel Enable
WiredHome 167:8aa3fb2a5a31 176 ///
WiredHome 167:8aa3fb2a5a31 177 /// @ref RA8875::TouchPanelInit() has two forms - one fully automatic, and more controlled.
WiredHome 167:8aa3fb2a5a31 178 /// See the APIs for details.
WiredHome 167:8aa3fb2a5a31 179 ///
WiredHome 167:8aa3fb2a5a31 180 /// @section Touch_Panel_Calibration
WiredHome 78:faf49c381591 181 ///
WiredHome 78:faf49c381591 182 /// The touch panel is not initially calibrated on startup. The application should
WiredHome 78:faf49c381591 183 /// provide a means to activate the calibration process, and that should not require
WiredHome 78:faf49c381591 184 /// the touchscreen as it may not yet be usable. Alternately, a calibration matrix
WiredHome 78:faf49c381591 185 /// can be loaded from non-volatile and installed.
WiredHome 78:faf49c381591 186 ///
WiredHome 167:8aa3fb2a5a31 187 /// @page Capacitive_Touch_Panel Capacitive Touch Panel
WiredHome 167:8aa3fb2a5a31 188 ///
WiredHome 167:8aa3fb2a5a31 189 /// Common to many of the commercially available display modules that use the RA8875 is
WiredHome 167:8aa3fb2a5a31 190 /// an option for a capacitive sense touch screen [Cap Sense] There are two known Cap Sense
WiredHome 167:8aa3fb2a5a31 191 /// controllers that this library can work with:
WiredHome 167:8aa3fb2a5a31 192 ///
WiredHome 167:8aa3fb2a5a31 193 /// * @ref CapSense_FT5206.
WiredHome 167:8aa3fb2a5a31 194 /// * @ref CapSense_GSL1680.
WiredHome 167:8aa3fb2a5a31 195 ///
WiredHome 167:8aa3fb2a5a31 196 /// @page CapSense_FT5206 Capacitive Sense - FT5206 Controller
WiredHome 167:8aa3fb2a5a31 197 ///
WiredHome 167:8aa3fb2a5a31 198 /// This is the more common controller. It supports up to 5 simultaneous touch point
WiredHome 167:8aa3fb2a5a31 199 /// tracking.
WiredHome 167:8aa3fb2a5a31 200 ///
WiredHome 167:8aa3fb2a5a31 201 /// @page CapSense_GSL1680 Capacitive Sense - GSL1680 Controller
WiredHome 167:8aa3fb2a5a31 202 ///
WiredHome 167:8aa3fb2a5a31 203 /// This is the less common controller. It supports either 5 or 10 simultaneous touch point
WiredHome 167:8aa3fb2a5a31 204 /// tracking, depending on the firmware installed in the controller.
WiredHome 167:8aa3fb2a5a31 205 ///
WiredHome 182:8832d03a2a29 206
WiredHome 182:8832d03a2a29 207
WiredHome 167:8aa3fb2a5a31 208 /// @page Example_Program Example Program
WiredHome 167:8aa3fb2a5a31 209 ///
WiredHome 167:8aa3fb2a5a31 210 /// This is just a small sample of what can be done, and what it can look like:
WiredHome 167:8aa3fb2a5a31 211 /// @image html Example_Program.png "Example Program"
WiredHome 78:faf49c381591 212 ///
WiredHome 167:8aa3fb2a5a31 213 /// @code
WiredHome 167:8aa3fb2a5a31 214 /// // Small test program
WiredHome 167:8aa3fb2a5a31 215 /// #include "mbed.h" // Working: v146, not fully working: v147
WiredHome 167:8aa3fb2a5a31 216 /// #include "RA8875.h" // Working: v149
WiredHome 167:8aa3fb2a5a31 217 /// RA8875 lcd(p5, p6, p7, p12, NC, "tft");
WiredHome 167:8aa3fb2a5a31 218 ///
WiredHome 167:8aa3fb2a5a31 219 /// int main()
WiredHome 167:8aa3fb2a5a31 220 /// {
WiredHome 167:8aa3fb2a5a31 221 /// lcd.init(480,272,16,100);
WiredHome 167:8aa3fb2a5a31 222 /// lcd.printf("printing 3 x 2 = %d", 3*2);
WiredHome 167:8aa3fb2a5a31 223 /// lcd.circle( 400,25, 25, BrightRed);
WiredHome 167:8aa3fb2a5a31 224 /// lcd.fillcircle( 400,25, 15, RGB(128,255,128));
WiredHome 167:8aa3fb2a5a31 225 /// lcd.ellipse( 440,75, 35,20, BrightBlue);
WiredHome 167:8aa3fb2a5a31 226 /// lcd.fillellipse( 440,75, 25,10, Blue);
WiredHome 167:8aa3fb2a5a31 227 /// lcd.triangle( 440,100, 475,110, 450,125, Magenta);
WiredHome 167:8aa3fb2a5a31 228 /// lcd.filltriangle( 445,105, 467,111, 452,120, Cyan);
WiredHome 167:8aa3fb2a5a31 229 /// lcd.rect( 400,130, 475,155, Brown);
WiredHome 167:8aa3fb2a5a31 230 /// lcd.fillrect( 405,135, 470,150, Pink);
WiredHome 167:8aa3fb2a5a31 231 /// lcd.roundrect( 410,160, 475,190, 10,8, Yellow);
WiredHome 167:8aa3fb2a5a31 232 /// lcd.fillroundrect(415,165, 470,185, 5,3, Orange);
WiredHome 167:8aa3fb2a5a31 233 /// lcd.line( 430,200, 460,230, RGB(0,255,0));
WiredHome 167:8aa3fb2a5a31 234 /// for (int i=0; i<=30; i+=5)
WiredHome 167:8aa3fb2a5a31 235 /// lcd.pixel(435+i,200+i, White);
WiredHome 167:8aa3fb2a5a31 236 /// }
WiredHome 167:8aa3fb2a5a31 237 /// @endcode
WiredHome 78:faf49c381591 238 ///
WiredHome 182:8832d03a2a29 239
WiredHome 182:8832d03a2a29 240
WiredHome 167:8aa3fb2a5a31 241 /// @page Wiring_Diagram Example Wiring Diagram
WiredHome 167:8aa3fb2a5a31 242 ///
WiredHome 167:8aa3fb2a5a31 243 /// This library was crafted around the 4-Wire SPI interface. This was the chosen
WiredHome 167:8aa3fb2a5a31 244 /// interface method in order to balance the requirements of the host micro IO with
WiredHome 167:8aa3fb2a5a31 245 /// the capability of this display. Alternatives include: 3-Wire SPI, I2C, 8-bit and
WiredHome 167:8aa3fb2a5a31 246 /// 16-bit parallel.
WiredHome 167:8aa3fb2a5a31 247 ///
WiredHome 182:8832d03a2a29 248 /// @section Schematic_Basic Basic Schematic
WiredHome 182:8832d03a2a29 249 ///
WiredHome 182:8832d03a2a29 250 /// The basic schematic should be the most portable to any system that has SPI support.
WiredHome 182:8832d03a2a29 251 ///
WiredHome 182:8832d03a2a29 252 /// @image html RA8875_display_schematic.png "Basic Display support"
WiredHome 182:8832d03a2a29 253 ///
WiredHome 182:8832d03a2a29 254 /// @section Schematic_DisplayTouch Display with Capacitive Touch
WiredHome 182:8832d03a2a29 255 ///
WiredHome 182:8832d03a2a29 256 /// A more advanced schematic - this with the I2C interface connecting to the Capacitive
WiredHome 182:8832d03a2a29 257 /// Touch controller. Note that this requires additional IO pins.
WiredHome 182:8832d03a2a29 258 ///
WiredHome 182:8832d03a2a29 259 /// @image html RA8875_captouch_wiring.png "Display and Capacitive Touch support"
WiredHome 182:8832d03a2a29 260 ///
WiredHome 182:8832d03a2a29 261 /// @section Schematic_DisplayTouchMicroSD Display with Capacitive Touch and micro SD
WiredHome 182:8832d03a2a29 262 ///
WiredHome 182:8832d03a2a29 263 /// The most advanced schematic - taking advantage of the display, the capacitive touch
WiredHome 182:8832d03a2a29 264 /// controller, and the peripheral support for a micro SD card on some of the display
WiredHome 182:8832d03a2a29 265 /// modules.
WiredHome 182:8832d03a2a29 266 ///
WiredHome 182:8832d03a2a29 267 /// @note There are online indications that the RA8875 has a defect in its SPI interface
WiredHome 182:8832d03a2a29 268 /// where it will not release the MISO pin. If this pin is shared with the micro SD
WiredHome 182:8832d03a2a29 269 /// port, then it could interfere with successful read/write of the files.
WiredHome 182:8832d03a2a29 270 /// The easiest solution is to put that interface on a separate SPI port.
WiredHome 182:8832d03a2a29 271 ///
WiredHome 182:8832d03a2a29 272 /// @image html RA8875_display_full.png "Display, Touch, and micro SD support"
WiredHome 167:8aa3fb2a5a31 273 ///
WiredHome 182:8832d03a2a29 274 /// @page External_Resources External Resources
WiredHome 182:8832d03a2a29 275 ///
WiredHome 182:8832d03a2a29 276 /// There are many websites with information on the RA8875 Display. This partial list
WiredHome 182:8832d03a2a29 277 /// may be helpful:
WiredHome 182:8832d03a2a29 278 ///
WiredHome 182:8832d03a2a29 279 /// * <a href="https://os.mbed.com/components/RA8875-Based-Display/">RA8875 Library</a>
WiredHome 182:8832d03a2a29 280 /// on the <a href="https://os.mbed.com/">mbed site</a><br/>
WiredHome 182:8832d03a2a29 281 /// This page has **a lot** of detail, schematices, sample programs, instructions to
WiredHome 182:8832d03a2a29 282 /// create your own fonts, and more...
WiredHome 182:8832d03a2a29 283 /// * <a href="https://os.mbed.com/search/?q=RA8875">RA8875 search on the mbed site</a><br/>
WiredHome 182:8832d03a2a29 284 /// Many more links, discussions, questions and answers, and more...
WiredHome 182:8832d03a2a29 285 /// * <a href="https://www.buydisplay.com/">Buy Display</a> site<br/>
WiredHome 182:8832d03a2a29 286 /// Where you can find many inexpensive displays, some with the **RA8875** controller
WiredHome 182:8832d03a2a29 287 /// (which this library supports), and others using different controllers (thus not
WiredHome 182:8832d03a2a29 288 /// supported by this library).
WiredHome 182:8832d03a2a29 289 /// * <a href="https://github.com/sumotoy/RA8875/wiki/Fix-compatibility-with-other-SPI-devices">SPI Bug notes</a><br/>
WiredHome 182:8832d03a2a29 290 /// A link to a site that discusses a SPI bug on the RA8875. [I have not verified this
WiredHome 182:8832d03a2a29 291 /// bug]
WiredHome 182:8832d03a2a29 292 /// * <a href="https://www.google.com/search?safe=on&source=hp&ei=1oN1XP6hEsPq_AbZlKMw&q=RA8875">RA8875 - Google</a><br/>
WiredHome 182:8832d03a2a29 293 /// Because new things show up all the time.
WiredHome 182:8832d03a2a29 294 /// * <a href="https://www.bing.com/search?q=RA8875">RA8875 - Bing</a><br/>
WiredHome 182:8832d03a2a29 295 /// And you want to look in more than one place.
WiredHome 182:8832d03a2a29 296 ///
WiredHome 182:8832d03a2a29 297 /// @image html RA8875_display_full.png "Example Wiring Diagram"
WiredHome 182:8832d03a2a29 298 ///
WiredHome 182:8832d03a2a29 299
WiredHome 182:8832d03a2a29 300
WiredHome 167:8aa3fb2a5a31 301 /// @page Future_Plans Future Plans
WiredHome 167:8aa3fb2a5a31 302 ///
WiredHome 167:8aa3fb2a5a31 303 /// Following are some notions of future plans. This does not mean they will all be
WiredHome 167:8aa3fb2a5a31 304 /// implemented, just consider them as things I'm thinking about. If you have a suggestion,
WiredHome 167:8aa3fb2a5a31 305 /// please send it to me.
WiredHome 167:8aa3fb2a5a31 306 ///
WiredHome 167:8aa3fb2a5a31 307 /// - Change the return values for several functions. Most functions return @ref RA8875::RetCode_t,
WiredHome 167:8aa3fb2a5a31 308 /// but would benefit from returning a data type related to that function. For example,
WiredHome 167:8aa3fb2a5a31 309 /// @ref RA8875::SelectDrawingLayer() could return the current drawing layer even as a new
WiredHome 167:8aa3fb2a5a31 310 /// layer is defined. This can facilitate switching back and forth between configurations.
WiredHome 167:8aa3fb2a5a31 311 /// Examples:
WiredHome 167:8aa3fb2a5a31 312 /// - @ref RA8875::SelectDrawingLayer()
WiredHome 167:8aa3fb2a5a31 313 /// - @ref RA8875::SelectUserFont()
WiredHome 167:8aa3fb2a5a31 314 /// - @ref RA8875::SetBackgroundTransparencyColor()
WiredHome 167:8aa3fb2a5a31 315 /// - @ref RA8875::SetLayerMode()
WiredHome 167:8aa3fb2a5a31 316 /// - @ref RA8875::SetLayerTransparency()
WiredHome 167:8aa3fb2a5a31 317 /// - @ref RA8875::SetOrientation()
WiredHome 167:8aa3fb2a5a31 318 /// - @ref RA8875::SetTextCursor()
WiredHome 167:8aa3fb2a5a31 319 /// - @ref RA8875::SetTextCursorControl()
WiredHome 167:8aa3fb2a5a31 320 /// - @ref RA8875::SetTextFont()
WiredHome 167:8aa3fb2a5a31 321 /// - @ref RA8875::SetTextFontControl()
WiredHome 167:8aa3fb2a5a31 322 /// - @ref RA8875::SetTextFontSize()
WiredHome 167:8aa3fb2a5a31 323 /// - @ref RA8875::background()
WiredHome 167:8aa3fb2a5a31 324 /// - @ref RA8875::foreground()
WiredHome 167:8aa3fb2a5a31 325 /// - @ref RA8875::Backlight()
WiredHome 167:8aa3fb2a5a31 326 /// - @ref RA8875::window()
WiredHome 167:8aa3fb2a5a31 327 /// - @ref RA8875::WindowMax()
WiredHome 167:8aa3fb2a5a31 328 ///
WiredHome 167:8aa3fb2a5a31 329 /// - Change the title-case of the functions to be consistent. Because this was adapted
WiredHome 167:8aa3fb2a5a31 330 /// from parts of several different libraries, it isn't very consistently titled.
WiredHome 167:8aa3fb2a5a31 331 ///
WiredHome 167:8aa3fb2a5a31 332 /// - Change names of some of the functions to be more consistent. Why are some Set*
WiredHome 167:8aa3fb2a5a31 333 /// and others are Select*. The layer commands SetDrawingLayer and GetDrawingLayer do
WiredHome 167:8aa3fb2a5a31 334 /// not need 'Drawing' in them.
WiredHome 167:8aa3fb2a5a31 335 ///
WiredHome 167:8aa3fb2a5a31 336 /// - Improve the PrintScreen method. There are two functions - one that accepts a filename,
WiredHome 167:8aa3fb2a5a31 337 /// and a second more experimental version that could pipe the image stream back to
WiredHome 167:8aa3fb2a5a31 338 /// a calling process. This could be used, for example, to send the image over a
WiredHome 167:8aa3fb2a5a31 339 /// network interface. The intended side effect is that there is then only a single
WiredHome 167:8aa3fb2a5a31 340 /// PrintScreen method with either an internal helper (for file system access) or
WiredHome 167:8aa3fb2a5a31 341 /// a callback for the user handled process.
WiredHome 101:e0aad446094a 342 ///
WiredHome 182:8832d03a2a29 343 /// - Add support for the hardware reset pin
WiredHome 182:8832d03a2a29 344 ///
WiredHome 182:8832d03a2a29 345 /// - Figure out how to "init()" in the constructor when it is not in main(). I ran into
WiredHome 182:8832d03a2a29 346 /// some issues if the display was instantiated before main(), and the code would not
WiredHome 182:8832d03a2a29 347 /// run, thus the exposure and activation of the init() function. If the instantiation
WiredHome 182:8832d03a2a29 348 /// is within main(), then it seemed to work as expected.
WiredHome 182:8832d03a2a29 349 ///
WiredHome 182:8832d03a2a29 350 /// - Add Scroll support for text.
WiredHome 182:8832d03a2a29 351 ///
WiredHome 182:8832d03a2a29 352 /// - Add high level objects - x-y graph, meter, buttons, ... but these will probably be
WiredHome 182:8832d03a2a29 353 /// best served in another class, since they may not be needed for many uses.
WiredHome 182:8832d03a2a29 354 ///
WiredHome 19:3f82c1161fd2 355 #ifndef RA8875_H
WiredHome 19:3f82c1161fd2 356 #define RA8875_H
WiredHome 19:3f82c1161fd2 357 #include <mbed.h>
WiredHome 19:3f82c1161fd2 358
WiredHome 77:9206c13aa527 359 #include "RA8875_Regs.h"
WiredHome 165:695c24cc5197 360 #include "RA8875_Touch_FT5206.h"
WiredHome 165:695c24cc5197 361 #include "RA8875_Touch_GSL1680.h"
WiredHome 19:3f82c1161fd2 362 #include "GraphicsDisplay.h"
WiredHome 19:3f82c1161fd2 363
WiredHome 41:2956a0a221e5 364 #define RA8875_DEFAULT_SPI_FREQ 5000000
WiredHome 19:3f82c1161fd2 365
WiredHome 156:4bdb2772128d 366 #ifndef MBED_ENCODE_VERSION
WiredHome 181:0032d1b8f5d4 367 #define MBED_MAJOR_VERSION 2
WiredHome 181:0032d1b8f5d4 368 #define MBED_MINOR_VERSION 0
WiredHome 181:0032d1b8f5d4 369 #define MBED_PATCH_VERSION MBED_LIBRARY_VERSION
WiredHome 156:4bdb2772128d 370 #define MBED_ENCODE_VERSION(major, minor, patch) ((major)*10000 + (minor)*100 + (patch))
WiredHome 156:4bdb2772128d 371 #endif
WiredHome 156:4bdb2772128d 372
WiredHome 19:3f82c1161fd2 373 // Define this to enable code that monitors the performance of various
WiredHome 19:3f82c1161fd2 374 // graphics commands.
WiredHome 78:faf49c381591 375 //#define PERF_METRICS
WiredHome 19:3f82c1161fd2 376
WiredHome 23:a50ded45dbaf 377 // What better place for some test code than in here and the companion
WiredHome 23:a50ded45dbaf 378 // .cpp file. See also the bottom of this file.
WiredHome 99:66edf771373a 379 //#define TESTENABLE
WiredHome 19:3f82c1161fd2 380
WiredHome 167:8aa3fb2a5a31 381 /// @page PredefinedColors Predefined Colors
WiredHome 167:8aa3fb2a5a31 382 ///
WiredHome 167:8aa3fb2a5a31 383 /// Keep in mind that the color scheme shown here is unlikely to precisely match
WiredHome 167:8aa3fb2a5a31 384 /// that on the actual display. The perceived color is additional affected by
WiredHome 167:8aa3fb2a5a31 385 /// other attributes, such as the backlight brightness.
WiredHome 167:8aa3fb2a5a31 386 ///
WiredHome 167:8aa3fb2a5a31 387 /// These are the predefined colors that are typically used where any @ref color_t
WiredHome 167:8aa3fb2a5a31 388 /// variable is applied.
WiredHome 167:8aa3fb2a5a31 389 ///
WiredHome 167:8aa3fb2a5a31 390 /// <blockquote>
WiredHome 167:8aa3fb2a5a31 391 /// <table>
WiredHome 167:8aa3fb2a5a31 392 /// <tr>
WiredHome 167:8aa3fb2a5a31 393 /// <td bgcolor='#000000'>&nbsp;</td><td>@ref Black</td>
WiredHome 167:8aa3fb2a5a31 394 /// <td bgcolor='#0000BB'>&nbsp;</td><td>@ref Blue</td>
WiredHome 167:8aa3fb2a5a31 395 /// <td bgcolor='#00BB00'>&nbsp;</td><td>@ref Green</td>
WiredHome 167:8aa3fb2a5a31 396 /// <td bgcolor='#00BBBB'>&nbsp;</td><td>@ref Cyan</td>
WiredHome 167:8aa3fb2a5a31 397 /// </tr>
WiredHome 167:8aa3fb2a5a31 398 /// <tr>
WiredHome 167:8aa3fb2a5a31 399 /// <td bgcolor='#BB0000'>&nbsp;</td><td>@ref Red</td>
WiredHome 167:8aa3fb2a5a31 400 /// <td bgcolor='#BB00BB'>&nbsp;</td><td>@ref Magenta</td>
WiredHome 167:8aa3fb2a5a31 401 /// <td bgcolor='#3F3F3F'>&nbsp;</td><td>@ref Brown</td>
WiredHome 167:8aa3fb2a5a31 402 /// <td bgcolor='#BBBBBB'>&nbsp;</td><td>@ref Gray</td>
WiredHome 167:8aa3fb2a5a31 403 /// </tr>
WiredHome 167:8aa3fb2a5a31 404 /// <tr>
WiredHome 167:8aa3fb2a5a31 405 /// <td bgcolor='#555555'>&nbsp;</td><td>@ref Charcoal</td>
WiredHome 167:8aa3fb2a5a31 406 /// <td bgcolor='#0000FF'>&nbsp;</td><td>@ref BrightBlue</td>
WiredHome 167:8aa3fb2a5a31 407 /// <td bgcolor='#00FF00'>&nbsp;</td><td>@ref BrightGreen</td>
WiredHome 167:8aa3fb2a5a31 408 /// <td bgcolor='#00FFFF'>&nbsp;</td><td>@ref BrightCyan</td>
WiredHome 167:8aa3fb2a5a31 409 /// </tr>
WiredHome 167:8aa3fb2a5a31 410 /// <tr>
WiredHome 167:8aa3fb2a5a31 411 /// <td bgcolor='#FF5555'>&nbsp;</td><td>@ref Orange</td>
WiredHome 167:8aa3fb2a5a31 412 /// <td bgcolor='#FF55FF'>&nbsp;</td><td>@ref Pink</td>
WiredHome 167:8aa3fb2a5a31 413 /// <td bgcolor='#BBBB00'>&nbsp;</td><td>@ref Yellow</td>
WiredHome 167:8aa3fb2a5a31 414 /// <td bgcolor='#FFFFFF'>&nbsp;</td><td>@ref White</td>
WiredHome 167:8aa3fb2a5a31 415 /// </tr>
WiredHome 167:8aa3fb2a5a31 416 /// <tr>
WiredHome 167:8aa3fb2a5a31 417 /// <td bgcolor='#00003F'>&nbsp;</td><td>@ref DarkBlue </td>
WiredHome 167:8aa3fb2a5a31 418 /// <td bgcolor='#003F00'>&nbsp;</td><td>@ref DarkGreen</td>
WiredHome 167:8aa3fb2a5a31 419 /// <td bgcolor='#003F3F'>&nbsp;</td><td>@ref DarkCyan </td>
WiredHome 167:8aa3fb2a5a31 420 /// <td bgcolor='#3F0000'>&nbsp;</td><td>@ref DarkRed </td>
WiredHome 167:8aa3fb2a5a31 421 /// </tr>
WiredHome 167:8aa3fb2a5a31 422 /// <tr>
WiredHome 167:8aa3fb2a5a31 423 /// <td bgcolor='#3F003F'>&nbsp;</td><td>@ref DarkMagenta</td>
WiredHome 167:8aa3fb2a5a31 424 /// <td bgcolor='#3F3F00'>&nbsp;</td><td>@ref DarkBrown </td>
WiredHome 167:8aa3fb2a5a31 425 /// <td bgcolor='#3F3F3F'>&nbsp;</td><td>@ref DarkGray </td>
WiredHome 167:8aa3fb2a5a31 426 /// <td bgcolor='#FFFFFF'>&nbsp;</td><td>&nbsp;</td>
WiredHome 167:8aa3fb2a5a31 427 /// </tr>
WiredHome 167:8aa3fb2a5a31 428 /// </table>
WiredHome 167:8aa3fb2a5a31 429 /// </blockquote>
WiredHome 167:8aa3fb2a5a31 430 ///
WiredHome 167:8aa3fb2a5a31 431
WiredHome 20:6e2e4a8372eb 432 #define Black (color_t)(RGB(0,0,0))
WiredHome 20:6e2e4a8372eb 433 #define Blue (color_t)(RGB(0,0,187))
WiredHome 20:6e2e4a8372eb 434 #define Green (color_t)(RGB(0,187,0))
WiredHome 20:6e2e4a8372eb 435 #define Cyan (color_t)(RGB(0,187,187))
WiredHome 20:6e2e4a8372eb 436 #define Red (color_t)(RGB(187,0,0))
WiredHome 20:6e2e4a8372eb 437 #define Magenta (color_t)(RGB(187,0,187))
WiredHome 81:01da2e34283d 438 #define Brown (color_t)(RGB(63,63,0))
WiredHome 20:6e2e4a8372eb 439 #define Gray (color_t)(RGB(187,187,187))
WiredHome 20:6e2e4a8372eb 440 #define Charcoal (color_t)(RGB(85,85,85))
WiredHome 62:ba5d33438fda 441 #define BrightBlue (color_t)(RGB(0,0,255))
WiredHome 62:ba5d33438fda 442 #define BrightGreen (color_t)(RGB(0,255,0))
WiredHome 62:ba5d33438fda 443 #define BrightCyan (color_t)(RGB(0,255,255))
WiredHome 62:ba5d33438fda 444 #define BrightRed (color_t)(RGB(255,0,0))
WiredHome 20:6e2e4a8372eb 445 #define Orange (color_t)(RGB(255,85,85))
WiredHome 20:6e2e4a8372eb 446 #define Pink (color_t)(RGB(255,85,255))
WiredHome 81:01da2e34283d 447 #define Yellow (color_t)(RGB(187,187,0))
WiredHome 20:6e2e4a8372eb 448 #define White (color_t)(RGB(255,255,255))
WiredHome 20:6e2e4a8372eb 449
WiredHome 62:ba5d33438fda 450 #define DarkBlue (color_t)(RGB(0,0,63))
WiredHome 62:ba5d33438fda 451 #define DarkGreen (color_t)(RGB(0,63,0))
WiredHome 62:ba5d33438fda 452 #define DarkCyan (color_t)(RGB(0,63,63))
WiredHome 62:ba5d33438fda 453 #define DarkRed (color_t)(RGB(63,0,0))
WiredHome 62:ba5d33438fda 454 #define DarkMagenta (color_t)(RGB(63,0,63))
WiredHome 62:ba5d33438fda 455 #define DarkBrown (color_t)(RGB(63,63,0))
WiredHome 62:ba5d33438fda 456 #define DarkGray (color_t)(RGB(63,63,63))
WiredHome 61:8f3153bf0baa 457
WiredHome 82:f7d300f26540 458 #define min(a,b) ((a<b)?a:b)
WiredHome 82:f7d300f26540 459 #define max(a,b) ((a>b)?a:b)
WiredHome 82:f7d300f26540 460
WiredHome 19:3f82c1161fd2 461
WiredHome 19:3f82c1161fd2 462 //namespace SW_graphics
WiredHome 19:3f82c1161fd2 463 //{
WiredHome 19:3f82c1161fd2 464
WiredHome 96:40b74dd3695b 465 class FPointerDummy; // used by the callback methods.
WiredHome 24:8ca861acf12d 466
WiredHome 21:3c1efb192927 467 /// This is a graphics library for the Raio RA8875 Display Controller chip
WiredHome 21:3c1efb192927 468 /// attached to a 4-wire SPI interface.
WiredHome 21:3c1efb192927 469 ///
WiredHome 56:7a85d226ad0d 470 /// It offers both primitive and high level APIs.
WiredHome 56:7a85d226ad0d 471 ///
WiredHome 21:3c1efb192927 472 /// Central to this API is a coordinate system, where the origin (0,0) is in
WiredHome 56:7a85d226ad0d 473 /// the top-left corner of the display, and the width (x) extends positive to the
WiredHome 56:7a85d226ad0d 474 /// right and the height (y) extends positive toward the bottom.
WiredHome 21:3c1efb192927 475 ///
WiredHome 125:7a0b70f56550 476 /// @note As there are both graphics and text commands, one must take care to use
WiredHome 21:3c1efb192927 477 /// the proper coordinate system for each. Some of the text APIs are in units
WiredHome 29:422616aa04bd 478 /// of column and row, which is measured in character positions (and dependent
WiredHome 56:7a85d226ad0d 479 /// on the font size), where other text APIs permit pixel level positioning.
WiredHome 56:7a85d226ad0d 480 ///
WiredHome 56:7a85d226ad0d 481 /// @code
WiredHome 56:7a85d226ad0d 482 /// #include "RA8875.h"
WiredHome 56:7a85d226ad0d 483 /// RA8875 lcd(p5, p6, p7, p12, NC, "tft");
WiredHome 56:7a85d226ad0d 484 ///
WiredHome 56:7a85d226ad0d 485 /// int main()
WiredHome 56:7a85d226ad0d 486 /// {
WiredHome 81:01da2e34283d 487 /// lcd.init();
WiredHome 56:7a85d226ad0d 488 /// lcd.printf("printing 3 x 2 = %d", 3*2);
WiredHome 56:7a85d226ad0d 489 /// lcd.circle( 400,25, 25, BrightRed);
WiredHome 56:7a85d226ad0d 490 /// lcd.fillcircle( 400,25, 15, RGB(128,255,128));
WiredHome 56:7a85d226ad0d 491 /// lcd.ellipse( 440,75, 35,20, BrightBlue);
WiredHome 56:7a85d226ad0d 492 /// lcd.fillellipse( 440,75, 25,10, Blue);
WiredHome 56:7a85d226ad0d 493 /// lcd.triangle( 440,100, 475,110, 450,125, Magenta);
WiredHome 56:7a85d226ad0d 494 /// lcd.filltriangle( 445,105, 467,111, 452,120, Cyan);
WiredHome 56:7a85d226ad0d 495 /// lcd.rect( 400,130, 475,155, Brown);
WiredHome 56:7a85d226ad0d 496 /// lcd.fillrect( 405,135, 470,150, Pink);
WiredHome 56:7a85d226ad0d 497 /// lcd.roundrect( 410,160, 475,190, 10,8, Yellow);
WiredHome 56:7a85d226ad0d 498 /// lcd.fillroundrect(415,165, 470,185, 5,3, Orange);
WiredHome 56:7a85d226ad0d 499 /// lcd.line( 430,200, 460,230, RGB(0,255,0));
WiredHome 56:7a85d226ad0d 500 /// for (int i=0; i<=30; i+=5)
WiredHome 56:7a85d226ad0d 501 /// lcd.pixel(435+i,200+i, White);
WiredHome 56:7a85d226ad0d 502 /// }
WiredHome 56:7a85d226ad0d 503 /// @endcode
WiredHome 29:422616aa04bd 504 ///
WiredHome 31:c72e12cd5c67 505 /// @todo Add Scroll support for text.
WiredHome 75:ca78388cfd77 506 /// @todo Add Hardware reset signal - but testing to date indicates it is not needed.
WiredHome 44:207594dece70 507 /// @todo Add high level objects - x-y graph, meter, others... but these will
WiredHome 44:207594dece70 508 /// probably be best served in another class, since they may not
WiredHome 44:207594dece70 509 /// be needed for many uses.
WiredHome 21:3c1efb192927 510 ///
WiredHome 19:3f82c1161fd2 511 class RA8875 : public GraphicsDisplay
WiredHome 19:3f82c1161fd2 512 {
WiredHome 19:3f82c1161fd2 513 public:
WiredHome 167:8aa3fb2a5a31 514 /// cursor type argument for @ref SetTextCursorControl()
WiredHome 53:86d24b9480b9 515 typedef enum
WiredHome 53:86d24b9480b9 516 {
WiredHome 53:86d24b9480b9 517 NOCURSOR, ///< cursor is hidden
WiredHome 167:8aa3fb2a5a31 518 IBEAM, ///< I Beam '|' cursor
WiredHome 167:8aa3fb2a5a31 519 UNDER, ///< Underscore '_' cursor
WiredHome 53:86d24b9480b9 520 BLOCK ///< Block cursor
WiredHome 53:86d24b9480b9 521 } cursor_t;
WiredHome 53:86d24b9480b9 522
WiredHome 167:8aa3fb2a5a31 523 /// font type selection argument for @ref SetTextFont()
WiredHome 19:3f82c1161fd2 524 typedef enum
WiredHome 19:3f82c1161fd2 525 {
WiredHome 31:c72e12cd5c67 526 ISO8859_1, ///< ISO8859-1 font
WiredHome 31:c72e12cd5c67 527 ISO8859_2, ///< ISO8859-2 font
WiredHome 31:c72e12cd5c67 528 ISO8859_3, ///< ISO8859-3 font
WiredHome 31:c72e12cd5c67 529 ISO8859_4 ///< ISO8859-4 font
WiredHome 19:3f82c1161fd2 530 } font_t;
WiredHome 19:3f82c1161fd2 531
WiredHome 167:8aa3fb2a5a31 532 /// display orientation argument for @ref SetOrientation()
WiredHome 167:8aa3fb2a5a31 533 /// with landscape mode as the normal (0 degree) orientation.
WiredHome 19:3f82c1161fd2 534 typedef enum
WiredHome 19:3f82c1161fd2 535 {
WiredHome 84:e102021864b5 536 normal, ///< normal (landscape) orientation
WiredHome 84:e102021864b5 537 rotate_0 = normal, ///< alternate to 'normal'
WiredHome 84:e102021864b5 538 rotate_90, ///< rotated clockwise 90 degree
WiredHome 84:e102021864b5 539 rotate_180, ///< rotated (clockwise) 180 degree
WiredHome 84:e102021864b5 540 rotate_270, ///< rotated clockwise 270 degree
WiredHome 84:e102021864b5 541 } orientation_t;
WiredHome 19:3f82c1161fd2 542
WiredHome 167:8aa3fb2a5a31 543 /// alignment control argument for @ref SetTextFontControl()
WiredHome 19:3f82c1161fd2 544 typedef enum
WiredHome 19:3f82c1161fd2 545 {
WiredHome 31:c72e12cd5c67 546 align_none, ///< align - none
WiredHome 31:c72e12cd5c67 547 align_full ///< align - full
WiredHome 19:3f82c1161fd2 548 } alignment_t;
WiredHome 19:3f82c1161fd2 549
WiredHome 167:8aa3fb2a5a31 550 /// Font Horizontal Scale factor - 1, 2, 3 4 for @ref SetTextFontSize(), @ref GetTextFontSize()
WiredHome 40:04aa280dfa39 551 typedef int HorizontalScale;
WiredHome 19:3f82c1161fd2 552
WiredHome 167:8aa3fb2a5a31 553 /// Font Vertical Scale factor - 1, 2, 3, 4 for @ref SetTextFontSize(), @ref GetTextFontSize()
WiredHome 40:04aa280dfa39 554 typedef int VerticalScale;
WiredHome 19:3f82c1161fd2 555
WiredHome 167:8aa3fb2a5a31 556 /// Clear screen region option for @ref clsw()
WiredHome 19:3f82c1161fd2 557 typedef enum
WiredHome 19:3f82c1161fd2 558 {
WiredHome 31:c72e12cd5c67 559 FULLWINDOW, ///< Full screen
WiredHome 31:c72e12cd5c67 560 ACTIVEWINDOW ///< active window/region
WiredHome 19:3f82c1161fd2 561 } Region_t;
WiredHome 167:8aa3fb2a5a31 562
WiredHome 167:8aa3fb2a5a31 563 /// Layer Display Mode argument for @ref SetLayerMode, @ref GetLayerMode
WiredHome 53:86d24b9480b9 564 typedef enum
WiredHome 53:86d24b9480b9 565 {
WiredHome 61:8f3153bf0baa 566 ShowLayer0, ///< Only layer 0 is visible, layer 1 is hidden (default)
WiredHome 56:7a85d226ad0d 567 ShowLayer1, ///< Only layer 1 is visible, layer 0 is hidden
WiredHome 53:86d24b9480b9 568 LightenOverlay, ///< Lighten-overlay mode
WiredHome 53:86d24b9480b9 569 TransparentMode, ///< Transparent mode
WiredHome 53:86d24b9480b9 570 BooleanOR, ///< Boolean OR mode
WiredHome 53:86d24b9480b9 571 BooleanAND, ///< Boolean AND mode
WiredHome 53:86d24b9480b9 572 FloatingWindow ///< Floating Window mode
WiredHome 53:86d24b9480b9 573 } LayerMode_T;
WiredHome 53:86d24b9480b9 574
hexley 54:e117ad10fba6 575 /// Touch Panel modes
hexley 54:e117ad10fba6 576 typedef enum
hexley 54:e117ad10fba6 577 {
hexley 54:e117ad10fba6 578 TP_Auto, ///< Auto touch detection mode
hexley 54:e117ad10fba6 579 TP_Manual, ///< Manual touch detection mode
hexley 54:e117ad10fba6 580 } tpmode_t;
WiredHome 96:40b74dd3695b 581
WiredHome 167:8aa3fb2a5a31 582 /// PrintScreen callback commands for the user code @ref PrintCallback_T()
WiredHome 96:40b74dd3695b 583 typedef enum
WiredHome 96:40b74dd3695b 584 {
WiredHome 96:40b74dd3695b 585 OPEN, ///< command to open the file. cast uint32_t * to the buffer to get the total size to be written.
WiredHome 96:40b74dd3695b 586 WRITE, ///< command to write some data, buffer points to the data and the size is in bytes.
WiredHome 96:40b74dd3695b 587 CLOSE, ///< command to close the file
WiredHome 96:40b74dd3695b 588 } filecmd_t;
WiredHome 96:40b74dd3695b 589
WiredHome 96:40b74dd3695b 590 /// print screen callback
WiredHome 96:40b74dd3695b 591 ///
WiredHome 96:40b74dd3695b 592 /// The special form of the print screen will pass one blob at a time
WiredHome 149:c62c4b2d6a15 593 /// to the callback. There are basic commands declaring that the stream
WiredHome 96:40b74dd3695b 594 /// can be opened, a block written, and the stream closed. There is
WiredHome 96:40b74dd3695b 595 /// also a command to communicate the total size being delivered.
WiredHome 96:40b74dd3695b 596 ///
WiredHome 149:c62c4b2d6a15 597 /// If the idle callback is registered, it will be activated passing
WiredHome 149:c62c4b2d6a15 598 /// a parameter indicating the percent complete, which may be of value.
WiredHome 149:c62c4b2d6a15 599 ///
WiredHome 96:40b74dd3695b 600 /// @code
WiredHome 96:40b74dd3695b 601 /// lcd.PrintScreen(x,y,w,h,callback);
WiredHome 96:40b74dd3695b 602 /// ...
WiredHome 96:40b74dd3695b 603 /// void callback(filecmd_t cmd, uint8_t * buffer, uint16_t size) {
WiredHome 96:40b74dd3695b 604 /// switch(cmd) {
WiredHome 96:40b74dd3695b 605 /// case OPEN:
WiredHome 96:40b74dd3695b 606 /// pc.printf("About to write %u bytes\r\n", *(uint32_t *)buffer);
WiredHome 96:40b74dd3695b 607 /// fh = fopen("file.bmp", "w+b");
WiredHome 96:40b74dd3695b 608 /// break;
WiredHome 96:40b74dd3695b 609 /// case WRITE:
WiredHome 96:40b74dd3695b 610 /// fwrite(buffer, size, fh);
WiredHome 96:40b74dd3695b 611 /// break;
WiredHome 96:40b74dd3695b 612 /// case CLOSE:
WiredHome 96:40b74dd3695b 613 /// fclose(fh);
WiredHome 96:40b74dd3695b 614 /// break;
WiredHome 96:40b74dd3695b 615 /// default:
WiredHome 96:40b74dd3695b 616 /// pc.printf("Unexpected callback %d\r\n", cmd);
WiredHome 96:40b74dd3695b 617 /// break;
WiredHome 96:40b74dd3695b 618 /// }
WiredHome 96:40b74dd3695b 619 /// }
WiredHome 96:40b74dd3695b 620 /// @endcode
WiredHome 96:40b74dd3695b 621 ///
WiredHome 106:c80828f5dea4 622 /// @param cmd is the command to execute. See @ref filecmd_t.
WiredHome 96:40b74dd3695b 623 /// @param buffer is a pointer to the buffer being passed.
WiredHome 96:40b74dd3695b 624 /// @param size is the number of bytes in the buffer.
WiredHome 167:8aa3fb2a5a31 625 /// @returns @ref RetCode_t value.
WiredHome 96:40b74dd3695b 626 ///
WiredHome 96:40b74dd3695b 627 typedef RetCode_t (* PrintCallback_T)(filecmd_t cmd, uint8_t * buffer, uint16_t size);
hexley 54:e117ad10fba6 628
WiredHome 167:8aa3fb2a5a31 629 /// Idle reason provided in the Idle Callback @ref IdleCallback_T()
WiredHome 123:2f45e80fec5f 630 typedef enum {
WiredHome 123:2f45e80fec5f 631 unknown, ///< reason has not been assigned (this should not happen)
WiredHome 123:2f45e80fec5f 632 status_wait, ///< driver is polling the status register while busy
WiredHome 123:2f45e80fec5f 633 command_wait, ///< driver is polling the command register while busy
WiredHome 123:2f45e80fec5f 634 getc_wait, ///< user has called the getc function
WiredHome 123:2f45e80fec5f 635 touch_wait, ///< user has called the touch function
WiredHome 149:c62c4b2d6a15 636 touchcal_wait, ///< driver is performing a touch calibration
WiredHome 149:c62c4b2d6a15 637 progress, ///< communicates progress
WiredHome 123:2f45e80fec5f 638 } IdleReason_T;
WiredHome 123:2f45e80fec5f 639
WiredHome 123:2f45e80fec5f 640 /// Idle Callback
WiredHome 123:2f45e80fec5f 641 ///
WiredHome 123:2f45e80fec5f 642 /// This defines the interface for an idle callback. That is, when the
WiredHome 125:7a0b70f56550 643 /// driver is held up, pending some event, it can call a previously registered
WiredHome 123:2f45e80fec5f 644 /// idle function. This could be most useful for servicing a watchdog.
WiredHome 123:2f45e80fec5f 645 ///
WiredHome 123:2f45e80fec5f 646 /// The user code, which is notified via this API, can force the idle
WiredHome 123:2f45e80fec5f 647 /// to abort, by returning the external_abort value back to the driver.
WiredHome 125:7a0b70f56550 648 /// It is important to note that the abort could leave the driver in
WiredHome 125:7a0b70f56550 649 /// an undesireable state, so this should be used with care.
WiredHome 125:7a0b70f56550 650 ///
WiredHome 125:7a0b70f56550 651 /// @note Should it be called the BusyCallback? It is true, that it will
WiredHome 125:7a0b70f56550 652 /// call this function when the RA8875 is busy, but this is also
WiredHome 125:7a0b70f56550 653 /// when the CPU is largely idle.
WiredHome 125:7a0b70f56550 654 ///
WiredHome 125:7a0b70f56550 655 /// @code
WiredHome 149:c62c4b2d6a15 656 /// RetCode_t myIdle_handler(RA8875::IdleReason_T reason, uint16_t param)
WiredHome 125:7a0b70f56550 657 /// {
WiredHome 125:7a0b70f56550 658 /// idleFlasher = !idleFlasher;
WiredHome 125:7a0b70f56550 659 /// if (it_has_been_too_long())
WiredHome 125:7a0b70f56550 660 /// return external_abort;
WiredHome 125:7a0b70f56550 661 /// else
WiredHome 125:7a0b70f56550 662 /// return noerror;
WiredHome 125:7a0b70f56550 663 /// }
WiredHome 125:7a0b70f56550 664 /// @endcode
WiredHome 125:7a0b70f56550 665 ///
WiredHome 125:7a0b70f56550 666 /// @param reason informs the callback why it is idle.
WiredHome 149:c62c4b2d6a15 667 /// @param param is a 2nd parameter, which is used for certain reason codes
WiredHome 149:c62c4b2d6a15 668 /// for 'progress' reason code, param ranges from 0 to 100 (percent)
WiredHome 167:8aa3fb2a5a31 669 /// @returns @ref RetCode_t value.
WiredHome 123:2f45e80fec5f 670 ///
WiredHome 149:c62c4b2d6a15 671 typedef RetCode_t (* IdleCallback_T)(IdleReason_T reason, uint16_t param = 0);
WiredHome 123:2f45e80fec5f 672
WiredHome 125:7a0b70f56550 673 /// Basic constructor for a display based on the RAiO RA8875
WiredHome 125:7a0b70f56550 674 /// display controller, which can be used with no touchscreen,
WiredHome 125:7a0b70f56550 675 /// or the RA8875 managed resistive touchscreen.
WiredHome 124:1690a7ae871c 676 ///
WiredHome 124:1690a7ae871c 677 /// This constructor differs from the alternate by supportting
WiredHome 124:1690a7ae871c 678 /// either No Touch Screen, or the RA8875 built-in resistive
WiredHome 125:7a0b70f56550 679 /// touch screen. If the application requires the use of the
WiredHome 154:ad2450fc3dc3 680 /// capacitive touchscreen, the alternate constructor must
WiredHome 125:7a0b70f56550 681 /// be used.
WiredHome 19:3f82c1161fd2 682 ///
WiredHome 61:8f3153bf0baa 683 /// This configures the registers and calls the @ref init method.
WiredHome 61:8f3153bf0baa 684 ///
WiredHome 56:7a85d226ad0d 685 /// @code
WiredHome 56:7a85d226ad0d 686 /// #include "RA8875.h"
WiredHome 56:7a85d226ad0d 687 /// RA8875 lcd(p5, p6, p7, p12, NC, "tft");
WiredHome 56:7a85d226ad0d 688 ///
WiredHome 56:7a85d226ad0d 689 /// int main()
WiredHome 56:7a85d226ad0d 690 /// {
WiredHome 157:1565f38ca44b 691 /// lcd.init(); // defaults for 480x272x16 at low brightness
WiredHome 56:7a85d226ad0d 692 /// lcd.printf("printing 3 x 2 = %d", 3*2);
WiredHome 56:7a85d226ad0d 693 /// lcd.circle(400,25, 25, BrightRed);
WiredHome 56:7a85d226ad0d 694 /// }
WiredHome 56:7a85d226ad0d 695 /// @endcode
WiredHome 56:7a85d226ad0d 696 ///
WiredHome 72:ecffe56af969 697 /// @param[in] mosi is the SPI master out slave in pin on the mbed.
WiredHome 72:ecffe56af969 698 /// @param[in] miso is the SPI master in slave out pin on the mbed.
WiredHome 72:ecffe56af969 699 /// @param[in] sclk is the SPI shift clock pin on the mbed.
WiredHome 72:ecffe56af969 700 /// @param[in] csel is the DigitalOut pin on the mbed to use as the
WiredHome 19:3f82c1161fd2 701 /// active low chip select for the display controller.
WiredHome 72:ecffe56af969 702 /// @param[in] reset is the DigitalOut pin on the mbed to use as the
WiredHome 19:3f82c1161fd2 703 /// active low reset input on the display controller -
WiredHome 19:3f82c1161fd2 704 /// but this is not currently used.
WiredHome 72:ecffe56af969 705 /// @param[in] name is a text name for this object, which will permit
WiredHome 72:ecffe56af969 706 /// capturing stdout to puts() and printf() directly to it.
WiredHome 19:3f82c1161fd2 707 ///
WiredHome 124:1690a7ae871c 708 RA8875(PinName mosi, PinName miso, PinName sclk, PinName csel, PinName reset,
WiredHome 124:1690a7ae871c 709 const char * name = "lcd");
WiredHome 124:1690a7ae871c 710
WiredHome 124:1690a7ae871c 711
WiredHome 165:695c24cc5197 712 /// Constructor for a display based on the RAiO RA8875 display controller
WiredHome 165:695c24cc5197 713 /// (using the FT5206 Capacitive TouchScreen Controller)
WiredHome 124:1690a7ae871c 714 ///
WiredHome 125:7a0b70f56550 715 /// @code
WiredHome 125:7a0b70f56550 716 /// #include "RA8875.h"
WiredHome 125:7a0b70f56550 717 /// RA8875 lcd(p5, p6, p7, p12, NC, p9,p10,p13, "tft");
WiredHome 125:7a0b70f56550 718 ///
WiredHome 125:7a0b70f56550 719 /// int main()
WiredHome 125:7a0b70f56550 720 /// {
WiredHome 125:7a0b70f56550 721 /// lcd.init();
WiredHome 125:7a0b70f56550 722 /// lcd.printf("printing 3 x 2 = %d", 3*2);
WiredHome 125:7a0b70f56550 723 /// lcd.circle(400,25, 25, BrightRed);
WiredHome 125:7a0b70f56550 724 /// TouchCode_t tp = lcd.TouchPanelReadable();
WiredHome 125:7a0b70f56550 725 /// if (tp == touch)
WiredHome 125:7a0b70f56550 726 /// ...
WiredHome 125:7a0b70f56550 727 /// }
WiredHome 125:7a0b70f56550 728 /// @endcode
WiredHome 125:7a0b70f56550 729 ///
WiredHome 124:1690a7ae871c 730 /// @param[in] mosi is the SPI master out slave in pin on the mbed.
WiredHome 124:1690a7ae871c 731 /// @param[in] miso is the SPI master in slave out pin on the mbed.
WiredHome 124:1690a7ae871c 732 /// @param[in] sclk is the SPI shift clock pin on the mbed.
WiredHome 124:1690a7ae871c 733 /// @param[in] csel is the DigitalOut pin on the mbed to use as the
WiredHome 124:1690a7ae871c 734 /// active low chip select for the display controller.
WiredHome 124:1690a7ae871c 735 /// @param[in] reset is the DigitalOut pin on the mbed to use as the
WiredHome 124:1690a7ae871c 736 /// active low reset input on the display controller -
WiredHome 124:1690a7ae871c 737 /// but this is not currently used.
WiredHome 124:1690a7ae871c 738 /// @param[in] sda is the I2C Serial Data pin you are wiring to the FT5206.
WiredHome 124:1690a7ae871c 739 /// @param[in] scl is the I2C Serial Clock pin you are wiring to the FT5206.
WiredHome 124:1690a7ae871c 740 /// @param[in] irq is the Interrupt Request pin you are wiring to the FT5206.
WiredHome 124:1690a7ae871c 741 /// @param[in] name is a text name for this object, which will permit
WiredHome 124:1690a7ae871c 742 /// capturing stdout to puts() and printf() directly to it.
WiredHome 124:1690a7ae871c 743 ///
WiredHome 124:1690a7ae871c 744 RA8875(PinName mosi, PinName miso, PinName sclk, PinName csel, PinName reset,
WiredHome 124:1690a7ae871c 745 PinName sda, PinName scl, PinName irq, const char * name = "lcd");
WiredHome 165:695c24cc5197 746
WiredHome 124:1690a7ae871c 747
WiredHome 165:695c24cc5197 748 /// Constructor for a display based on the RAiO RA8875 display controller
WiredHome 165:695c24cc5197 749 /// (using the GSL1680 Capacitive TouchScreen Controller)
WiredHome 165:695c24cc5197 750 ///
WiredHome 165:695c24cc5197 751 /// @code
WiredHome 165:695c24cc5197 752 /// #include "RA8875.h"
WiredHome 165:695c24cc5197 753 /// RA8875 lcd(p5, p6, p7, p12, NC, p9,p10,p13,p14, "tft");
WiredHome 165:695c24cc5197 754 ///
WiredHome 165:695c24cc5197 755 /// int main()
WiredHome 165:695c24cc5197 756 /// {
WiredHome 165:695c24cc5197 757 /// lcd.init();
WiredHome 165:695c24cc5197 758 /// lcd.printf("printing 3 x 2 = %d", 3*2);
WiredHome 165:695c24cc5197 759 /// lcd.circle(400,25, 25, BrightRed);
WiredHome 165:695c24cc5197 760 /// TouchCode_t tp = lcd.TouchPanelReadable();
WiredHome 165:695c24cc5197 761 /// if (tp == touch)
WiredHome 165:695c24cc5197 762 /// ...
WiredHome 165:695c24cc5197 763 /// }
WiredHome 165:695c24cc5197 764 /// @endcode
WiredHome 165:695c24cc5197 765 ///
WiredHome 165:695c24cc5197 766 /// @param[in] mosi is the SPI master out slave in pin on the mbed.
WiredHome 165:695c24cc5197 767 /// @param[in] miso is the SPI master in slave out pin on the mbed.
WiredHome 165:695c24cc5197 768 /// @param[in] sclk is the SPI shift clock pin on the mbed.
WiredHome 165:695c24cc5197 769 /// @param[in] csel is the DigitalOut pin on the mbed to use as the
WiredHome 165:695c24cc5197 770 /// active low chip select for the display controller.
WiredHome 165:695c24cc5197 771 /// @param[in] reset is the DigitalOut pin on the mbed to use as the
WiredHome 165:695c24cc5197 772 /// active low reset input on the display controller -
WiredHome 165:695c24cc5197 773 /// but this is not currently used.
WiredHome 165:695c24cc5197 774 /// @param[in] sda is the I2C Serial Data pin you are wiring to the GSL1680.
WiredHome 165:695c24cc5197 775 /// @param[in] scl is the I2C Serial Clock pin you are wiring to the GSL1680.
WiredHome 165:695c24cc5197 776 /// @param[in] wake is the wake control pin you are wiring to the GSL1680.
WiredHome 165:695c24cc5197 777 /// @param[in] irq is the Interrupt Request pin you are wiring to the GSL1680.
WiredHome 165:695c24cc5197 778 /// @param[in] name is a text name for this object, which will permit
WiredHome 165:695c24cc5197 779 /// capturing stdout to puts() and printf() directly to it.
WiredHome 165:695c24cc5197 780 ///
WiredHome 165:695c24cc5197 781 RA8875(PinName mosi, PinName miso, PinName sclk, PinName csel, PinName reset,
WiredHome 165:695c24cc5197 782 PinName sda, PinName scl, PinName wake, PinName irq, const char * name = "lcd");
WiredHome 165:695c24cc5197 783
WiredHome 19:3f82c1161fd2 784
WiredHome 45:679c2fb8480c 785 // Destructor doesn't have much to do as this would typically be created
WiredHome 45:679c2fb8480c 786 // at startup, and not at runtime.
WiredHome 19:3f82c1161fd2 787 //~RA8875();
WiredHome 19:3f82c1161fd2 788
WiredHome 79:544eb4964795 789 /// Initialize the driver.
WiredHome 79:544eb4964795 790 ///
WiredHome 132:a5d7a8541683 791 /// The RA8875 can control typical displays from the 480x272 to 800x480, and it supports 8 or 16-bit color.
WiredHome 132:a5d7a8541683 792 /// It also supports 2 graphics layers, but it cannot support 2 layers at the maximum color depth and
WiredHome 132:a5d7a8541683 793 /// screen size. When configured under 480x400, it will support both 16-bit color depth and 2 drawing layers.
WiredHome 132:a5d7a8541683 794 /// Above 480x400 it support either 16-bit color, or 2 layers, but not both.
WiredHome 132:a5d7a8541683 795 ///
WiredHome 132:a5d7a8541683 796 /// Typical of the displays that are readily purchased, you will find 480x272 and 800x480 resolutions.
WiredHome 106:c80828f5dea4 797 ///
WiredHome 81:01da2e34283d 798 /// @param[in] width in pixels to configure the display for. This parameter is optional
WiredHome 81:01da2e34283d 799 /// and the default is 480.
WiredHome 81:01da2e34283d 800 /// @param[in] height in pixels to configure the display for. This parameter is optional
WiredHome 81:01da2e34283d 801 /// and the default is 272.
WiredHome 81:01da2e34283d 802 /// @param[in] color_bpp can be either 8 or 16, but must be consistent
WiredHome 81:01da2e34283d 803 /// with the width and height parameters. This parameter is optional
WiredHome 81:01da2e34283d 804 /// and the default is 16.
WiredHome 131:5bd6ba2ee4a1 805 /// @param[in] poweron defines if the display should be initialized into the power-on or off state.
WiredHome 132:a5d7a8541683 806 /// If power is non-zero(on), the backlight is set to this value. This parameter is optional
WiredHome 157:1565f38ca44b 807 /// and the default is 40 (on at a low brightness level because many users power
WiredHome 157:1565f38ca44b 808 /// the module from their PC USB port and it often cannot support the curent
WiredHome 157:1565f38ca44b 809 /// required for full brightness). See @ref Power.
WiredHome 81:01da2e34283d 810 /// @param[in] keypadon defines if the keypad support should be enabled. This parameter is optional
WiredHome 106:c80828f5dea4 811 /// and the default is true (enabled). See @ref KeypadInit.
WiredHome 124:1690a7ae871c 812 /// @param[in] touchscreeenon defines if the touchscreen support should be enabled.
WiredHome 132:a5d7a8541683 813 /// This parameter is optional and the default is true (enabled). See @ref TouchPanelInit.
WiredHome 124:1690a7ae871c 814 /// - If the constructor was called with support for the capacitive driver, this
WiredHome 124:1690a7ae871c 815 /// parameter causes the driver to initialize.
WiredHome 124:1690a7ae871c 816 /// - If the constructor was called without support for the capacitive driver, this
WiredHome 124:1690a7ae871c 817 /// parameter is used to enable and initialize the resistive touchscreen driver.
WiredHome 167:8aa3fb2a5a31 818 /// @returns @ref RetCode_t value.
WiredHome 79:544eb4964795 819 ///
WiredHome 81:01da2e34283d 820 RetCode_t init(int width = 480, int height = 272, int color_bpp = 16,
WiredHome 157:1565f38ca44b 821 uint8_t poweron = 40, bool keypadon = true, bool touchscreeenon = true);
WiredHome 124:1690a7ae871c 822
WiredHome 125:7a0b70f56550 823
WiredHome 167:8aa3fb2a5a31 824 /// Get a pointer to the text string representing the RetCode_t
WiredHome 79:544eb4964795 825 ///
WiredHome 79:544eb4964795 826 /// This method returns a pointer to a text string that matches the
WiredHome 106:c80828f5dea4 827 /// code. See @ref RetCode_t.
WiredHome 79:544eb4964795 828 ///
WiredHome 79:544eb4964795 829 /// @param[in] code is the return value from RetCode_t to look up.
WiredHome 79:544eb4964795 830 /// @returns a pointer to the text message representing code. If code
WiredHome 79:544eb4964795 831 /// is not a valid value, then it returns the text for bad_parameter;
WiredHome 125:7a0b70f56550 832 ///
WiredHome 79:544eb4964795 833 const char * GetErrorMessage(RetCode_t code);
WiredHome 79:544eb4964795 834
WiredHome 79:544eb4964795 835
WiredHome 50:2c4f474a2453 836 /// Select the drawing layer for subsequent commands.
WiredHome 43:3becae133285 837 ///
WiredHome 43:3becae133285 838 /// If the screen configuration is 480 x 272, or if it is 800 x 480
WiredHome 43:3becae133285 839 /// and 8-bit color, the the display supports two layers, which can
WiredHome 43:3becae133285 840 /// be independently drawn on and shown. Additionally, complex
WiredHome 43:3becae133285 841 /// operations involving both layers are permitted.
WiredHome 43:3becae133285 842 ///
WiredHome 142:6e9bff59878a 843 /// @attention If the current display configuration does not support
WiredHome 142:6e9bff59878a 844 /// multiple layers, then layer 0 will be selected.
WiredHome 142:6e9bff59878a 845 ///
WiredHome 56:7a85d226ad0d 846 /// @code
WiredHome 56:7a85d226ad0d 847 /// //lcd.SetLayerMode(OnlyLayer0); // default is layer 0
WiredHome 56:7a85d226ad0d 848 /// lcd.rect(400,130, 475,155,Brown);
WiredHome 56:7a85d226ad0d 849 /// lcd.SelectDrawingLayer(1);
WiredHome 56:7a85d226ad0d 850 /// lcd.circle(400,25, 25, BrightRed);
WiredHome 56:7a85d226ad0d 851 /// wait(1);
WiredHome 56:7a85d226ad0d 852 /// lcd.SetLayerMode(ShowLayer1);
WiredHome 56:7a85d226ad0d 853 /// @endcode
WiredHome 56:7a85d226ad0d 854 ///
WiredHome 61:8f3153bf0baa 855 /// @attention The user manual refers to Layer 1 and Layer 2, however the
WiredHome 61:8f3153bf0baa 856 /// actual register values are value 0 and 1. This API as well as
WiredHome 61:8f3153bf0baa 857 /// others that reference the layers use the values 0 and 1 for
WiredHome 61:8f3153bf0baa 858 /// cleaner iteration in the code.
WiredHome 43:3becae133285 859 ///
WiredHome 72:ecffe56af969 860 /// @param[in] layer is 0 or 1 to select the layer for subsequent
WiredHome 61:8f3153bf0baa 861 /// commands.
WiredHome 143:e872d65a710d 862 /// @param[out] prevLayer is an optiona pointer to where the previous layer
WiredHome 143:e872d65a710d 863 /// will be written, making it a little easer to restore layers.
WiredHome 143:e872d65a710d 864 /// Writes 0 or 1 when the pointer is not NULL.
WiredHome 167:8aa3fb2a5a31 865 /// @returns @ref RetCode_t value.
WiredHome 143:e872d65a710d 866 ///
WiredHome 143:e872d65a710d 867 virtual RetCode_t SelectDrawingLayer(uint16_t layer, uint16_t * prevLayer = NULL);
WiredHome 125:7a0b70f56550 868
WiredHome 43:3becae133285 869
WiredHome 61:8f3153bf0baa 870 /// Get the currently active drawing layer.
WiredHome 61:8f3153bf0baa 871 ///
WiredHome 61:8f3153bf0baa 872 /// This returns a value, 0 or 1, based on the screen configuration
WiredHome 61:8f3153bf0baa 873 /// and the currently active drawing layer.
WiredHome 61:8f3153bf0baa 874 ///
WiredHome 61:8f3153bf0baa 875 /// @code
WiredHome 61:8f3153bf0baa 876 /// uint16_t prevLayer = lcd.GetDrawingLayer();
WiredHome 61:8f3153bf0baa 877 /// lcd.SelectDrawingLayer(x);
WiredHome 61:8f3153bf0baa 878 /// lcd.circle(400,25, 25, BrightRed);
WiredHome 61:8f3153bf0baa 879 /// lcd.SelectDrawingLayer(prevLayer);
WiredHome 61:8f3153bf0baa 880 /// @endcode
WiredHome 61:8f3153bf0baa 881 ///
WiredHome 61:8f3153bf0baa 882 /// @attention The user manual refers to Layer 1 and Layer 2, however the
WiredHome 61:8f3153bf0baa 883 /// actual register values are value 0 and 1. This API as well as
WiredHome 61:8f3153bf0baa 884 /// others that reference the layers use the values 0 and 1 for
WiredHome 61:8f3153bf0baa 885 /// cleaner iteration in the code.
WiredHome 61:8f3153bf0baa 886 ///
WiredHome 61:8f3153bf0baa 887 /// @returns the current drawing layer; 0 or 1.
WiredHome 61:8f3153bf0baa 888 ///
WiredHome 142:6e9bff59878a 889 virtual uint16_t GetDrawingLayer(void);
WiredHome 125:7a0b70f56550 890
WiredHome 61:8f3153bf0baa 891
WiredHome 44:207594dece70 892 /// Set the Layer presentation mode.
WiredHome 44:207594dece70 893 ///
WiredHome 44:207594dece70 894 /// This sets the presentation mode for layers, and permits showing
WiredHome 44:207594dece70 895 /// a single layer, or applying a mode where the two layers
WiredHome 44:207594dece70 896 /// are combined using one of the hardware methods.
WiredHome 44:207594dece70 897 ///
WiredHome 61:8f3153bf0baa 898 /// Refer to the RA8875 data sheet for full details.
WiredHome 61:8f3153bf0baa 899 ///
WiredHome 56:7a85d226ad0d 900 /// @code
WiredHome 56:7a85d226ad0d 901 /// //lcd.SetLayerMode(OnlyLayer0); // default is layer 0
WiredHome 56:7a85d226ad0d 902 /// lcd.rect(400,130, 475,155,Brown);
WiredHome 56:7a85d226ad0d 903 /// lcd.SelectDrawingLayer(1);
WiredHome 56:7a85d226ad0d 904 /// lcd.circle(400,25, 25, BrightRed);
WiredHome 56:7a85d226ad0d 905 /// wait(1);
WiredHome 56:7a85d226ad0d 906 /// lcd.SetLayerMode(ShowLayer1);
WiredHome 56:7a85d226ad0d 907 /// @endcode
WiredHome 56:7a85d226ad0d 908 ///
WiredHome 72:ecffe56af969 909 /// @param[in] mode sets the mode in the Layer Transparency Register.
WiredHome 167:8aa3fb2a5a31 910 /// @returns @ref RetCode_t value.
WiredHome 44:207594dece70 911 ///
WiredHome 53:86d24b9480b9 912 RetCode_t SetLayerMode(LayerMode_T mode);
WiredHome 125:7a0b70f56550 913
WiredHome 44:207594dece70 914
WiredHome 82:f7d300f26540 915 /// Get the Layer presentation mode.
WiredHome 82:f7d300f26540 916 ///
WiredHome 106:c80828f5dea4 917 /// This gets the current layer mode. See @ref LayerMode_T.
WiredHome 82:f7d300f26540 918 ///
WiredHome 82:f7d300f26540 919 /// @returns layer mode.
WiredHome 82:f7d300f26540 920 ///
WiredHome 82:f7d300f26540 921 LayerMode_T GetLayerMode(void);
WiredHome 125:7a0b70f56550 922
WiredHome 82:f7d300f26540 923
WiredHome 44:207594dece70 924 /// Set the layer transparency for each layer.
WiredHome 44:207594dece70 925 ///
WiredHome 44:207594dece70 926 /// Set the transparency, where the range of values is
WiredHome 44:207594dece70 927 /// from zero (fully visible) to eight (fully transparent).
WiredHome 44:207594dece70 928 /// The input value is automatically limited to this range.
WiredHome 44:207594dece70 929 ///
WiredHome 56:7a85d226ad0d 930 /// @code
WiredHome 56:7a85d226ad0d 931 /// // draw something on each layer, then step-fade across
WiredHome 56:7a85d226ad0d 932 /// display.SetLayerMode(RA8875::TransparentMode);
WiredHome 56:7a85d226ad0d 933 /// for (i=0; i<=8; i++) {
WiredHome 56:7a85d226ad0d 934 /// display.SetLayerTransparency(i, 8-i);
WiredHome 56:7a85d226ad0d 935 /// wait_ms(200);
WiredHome 56:7a85d226ad0d 936 /// }
WiredHome 56:7a85d226ad0d 937 /// @endcode
WiredHome 56:7a85d226ad0d 938 ///
WiredHome 72:ecffe56af969 939 /// @param[in] layer1 sets the layer 1 transparency.
WiredHome 72:ecffe56af969 940 /// @param[in] layer2 sets the layer 2 transparency.
WiredHome 167:8aa3fb2a5a31 941 /// @returns @ref RetCode_t value.
WiredHome 44:207594dece70 942 ///
WiredHome 44:207594dece70 943 RetCode_t SetLayerTransparency(uint8_t layer1, uint8_t layer2);
WiredHome 125:7a0b70f56550 944
WiredHome 44:207594dece70 945
WiredHome 53:86d24b9480b9 946 /// Set the background color register used for transparency.
WiredHome 53:86d24b9480b9 947 ///
WiredHome 53:86d24b9480b9 948 /// This command sets the background color registers that are used
WiredHome 53:86d24b9480b9 949 /// in the transparent color operations involving the layers.
WiredHome 53:86d24b9480b9 950 ///
WiredHome 72:ecffe56af969 951 /// @param[in] color is optional and expressed in 16-bit format. If not
WiredHome 53:86d24b9480b9 952 /// supplied, a default of Black is used.
WiredHome 167:8aa3fb2a5a31 953 /// @returns @ref RetCode_t value.
WiredHome 53:86d24b9480b9 954 ///
WiredHome 53:86d24b9480b9 955 RetCode_t SetBackgroundTransparencyColor(color_t color = RGB(0,0,0));
hexley 54:e117ad10fba6 956
WiredHome 73:f22a18707b5e 957
WiredHome 73:f22a18707b5e 958 /// Get the background color value used for transparency.
WiredHome 73:f22a18707b5e 959 ///
WiredHome 73:f22a18707b5e 960 /// This command reads the background color registers that define
WiredHome 73:f22a18707b5e 961 /// the transparency color for operations involving layers.
WiredHome 73:f22a18707b5e 962 ///
WiredHome 73:f22a18707b5e 963 /// @returns the color.
WiredHome 73:f22a18707b5e 964 ///
WiredHome 73:f22a18707b5e 965 color_t GetBackgroundTransparencyColor(void);
WiredHome 73:f22a18707b5e 966
WiredHome 125:7a0b70f56550 967
hexley 54:e117ad10fba6 968 /// Initialize theTouch Panel controller with default values
hexley 54:e117ad10fba6 969 ///
WiredHome 78:faf49c381591 970 /// This activates the simplified touch panel init, which may work for
WiredHome 78:faf49c381591 971 /// most uses. The alternate API is available if fine-grained control
WiredHome 124:1690a7ae871c 972 /// of the numerous settings of the resistive panel is needed.
WiredHome 78:faf49c381591 973 ///
WiredHome 157:1565f38ca44b 974 /// Additionally, for an even simpler interface for most RESISTIVE
WiredHome 157:1565f38ca44b 975 /// touch use cases, the init() method can perform the calibration.
WiredHome 157:1565f38ca44b 976 ///
WiredHome 167:8aa3fb2a5a31 977 /// @returns @ref RetCode_t value.
WiredHome 56:7a85d226ad0d 978 ///
hexley 54:e117ad10fba6 979 RetCode_t TouchPanelInit(void);
hexley 54:e117ad10fba6 980
WiredHome 125:7a0b70f56550 981
hexley 54:e117ad10fba6 982 /// Initialize the Touch Panel controller with detailed settings.
hexley 54:e117ad10fba6 983 ///
WiredHome 78:faf49c381591 984 /// This is the detailed touch panel init, which provides the ability
WiredHome 124:1690a7ae871c 985 /// to set nearly every option.
WiredHome 124:1690a7ae871c 986 ///
WiredHome 124:1690a7ae871c 987 /// @note If the capacitive touch panel was constructed, this behaves
WiredHome 124:1690a7ae871c 988 /// the same as the simplified version.
WiredHome 78:faf49c381591 989 ///
hexley 54:e117ad10fba6 990 /// @param[in] bTpEnable Touch Panel enable/disable control:
hexley 54:e117ad10fba6 991 /// - TP_ENABLE: enable the touch panel
hexley 54:e117ad10fba6 992 /// - TP_DISABLE: disable the touch panel
WiredHome 56:7a85d226ad0d 993 /// @param[in] bTpAutoManual Touch Panel operating mode:
hexley 54:e117ad10fba6 994 /// - TP_MODE_AUTO: automatic capture
hexley 54:e117ad10fba6 995 /// - TP_MODE_MANUAL: manual capture
WiredHome 56:7a85d226ad0d 996 /// @param[in] bTpDebounce Debounce circuit enable for touch panel interrupt:
hexley 54:e117ad10fba6 997 /// - TP_DEBOUNCE_OFF: disable the debounce circuit
hexley 54:e117ad10fba6 998 /// - TP_DEBOUNCE_ON: enable the debounce circuit
WiredHome 56:7a85d226ad0d 999 /// @param[in] bTpManualMode When Manual Mode is selected, this sets the mode:
hexley 54:e117ad10fba6 1000 /// - TP_MANUAL_IDLE: touch panel is idle
hexley 54:e117ad10fba6 1001 /// - TP_MANUAL_WAIT: wait for touch panel event
hexley 54:e117ad10fba6 1002 /// - TP_MANUAL_LATCH_X: latch X data
hexley 54:e117ad10fba6 1003 /// - TP_MANUAL_LATCH_Y: latch Y data
WiredHome 56:7a85d226ad0d 1004 /// @param[in] bTpAdcClkDiv Sets the ADC clock as a fraction of the System CLK:
hexley 54:e117ad10fba6 1005 /// - TP_ADC_CLKDIV_1: Use CLK
hexley 54:e117ad10fba6 1006 /// - TP_ADC_CLKDIV_2: Use CLK/2
hexley 54:e117ad10fba6 1007 /// - TP_ADC_CLKDIV_4: Use CLK/4
hexley 54:e117ad10fba6 1008 /// - TP_ADC_CLKDIV_8: Use CLK/8
hexley 54:e117ad10fba6 1009 /// - TP_ADC_CLKDIV_16: Use CLK/16
hexley 54:e117ad10fba6 1010 /// - TP_ADC_CLKDIV_32: Use CLK/32
hexley 54:e117ad10fba6 1011 /// - TP_ADC_CLKDIV_64: Use CLK/64
hexley 54:e117ad10fba6 1012 /// - TP_ADC_CLKDIV_128: Use CLK/128
WiredHome 56:7a85d226ad0d 1013 /// @param[in] bTpAdcSampleTime Touch Panel sample time delay before ADC data is ready:
hexley 54:e117ad10fba6 1014 /// - TP_ADC_SAMPLE_512_CLKS: Wait 512 system clocks
hexley 54:e117ad10fba6 1015 /// - TP_ADC_SAMPLE_1024_CLKS: Wait 1024 system clocks
hexley 54:e117ad10fba6 1016 /// - TP_ADC_SAMPLE_2048_CLKS: Wait 2048 system clocks
hexley 54:e117ad10fba6 1017 /// - TP_ADC_SAMPLE_4096_CLKS: Wait 4096 system clocks
hexley 54:e117ad10fba6 1018 /// - TP_ADC_SAMPLE_8192_CLKS: Wait 8192 system clocks
hexley 54:e117ad10fba6 1019 /// - TP_ADC_SAMPLE_16384_CLKS: Wait 16384 system clocks
hexley 54:e117ad10fba6 1020 /// - TP_ADC_SAMPLE_32768_CLKS: Wait 32768 system clocks
hexley 54:e117ad10fba6 1021 /// - TP_ADC_SAMPLE_65536_CLKS: Wait 65536 system clocks
WiredHome 167:8aa3fb2a5a31 1022 /// @returns @ref RetCode_t value.
WiredHome 56:7a85d226ad0d 1023 ///
WiredHome 78:faf49c381591 1024 RetCode_t TouchPanelInit(uint8_t bTpEnable, uint8_t bTpAutoManual, uint8_t bTpDebounce,
WiredHome 78:faf49c381591 1025 uint8_t bTpManualMode, uint8_t bTpAdcClkDiv, uint8_t bTpAdcSampleTime);
WiredHome 53:86d24b9480b9 1026
WiredHome 123:2f45e80fec5f 1027
WiredHome 123:2f45e80fec5f 1028 /// Get the screen calibrated point of touch.
WiredHome 123:2f45e80fec5f 1029 ///
WiredHome 123:2f45e80fec5f 1030 /// This method determines if there is a touch and if so it will provide
WiredHome 123:2f45e80fec5f 1031 /// the screen-relative touch coordinates. This method can be used in
WiredHome 123:2f45e80fec5f 1032 /// a manner similar to Serial.readable(), to determine if there was a
WiredHome 123:2f45e80fec5f 1033 /// touch and indicate that - but not care about the coordinates. Alternately,
WiredHome 123:2f45e80fec5f 1034 /// if a valid pointer to a point_t is provided, then if a touch is detected
WiredHome 123:2f45e80fec5f 1035 /// the point_t will be populated with data.
WiredHome 123:2f45e80fec5f 1036 ///
WiredHome 123:2f45e80fec5f 1037 /// @code
WiredHome 123:2f45e80fec5f 1038 /// Timer t;
WiredHome 123:2f45e80fec5f 1039 /// t.start();
WiredHome 123:2f45e80fec5f 1040 /// do {
WiredHome 123:2f45e80fec5f 1041 /// point_t point = {0, 0};
WiredHome 123:2f45e80fec5f 1042 /// if (display.TouchPanelReadable(&point)) {
WiredHome 123:2f45e80fec5f 1043 /// display.pixel(point, Red);
WiredHome 123:2f45e80fec5f 1044 /// }
WiredHome 123:2f45e80fec5f 1045 /// } while (t.read_ms() < 30000);
WiredHome 123:2f45e80fec5f 1046 /// @endcode
WiredHome 123:2f45e80fec5f 1047 ///
WiredHome 165:695c24cc5197 1048 /// @param[out] TouchPoint is a pointer to a point_t, which is set as the touch point,
WiredHome 165:695c24cc5197 1049 /// if a touch is registered.
WiredHome 123:2f45e80fec5f 1050 /// @returns a value indicating the state of the touch,
WiredHome 123:2f45e80fec5f 1051 /// - no_cal: no calibration matrix is available, touch coordinates are not returned.
WiredHome 123:2f45e80fec5f 1052 /// - no_touch: no touch is detected, touch coordinates are not returned.
WiredHome 123:2f45e80fec5f 1053 /// - touch: touch is detected, touch coordinates are returned.
WiredHome 123:2f45e80fec5f 1054 /// - held: held after touch, touch coordinates are returned.
WiredHome 123:2f45e80fec5f 1055 /// - release: indicates a release, touch coordinates are returned.
WiredHome 123:2f45e80fec5f 1056 ///
WiredHome 123:2f45e80fec5f 1057 TouchCode_t TouchPanelReadable(point_t * TouchPoint = NULL);
WiredHome 123:2f45e80fec5f 1058
WiredHome 125:7a0b70f56550 1059
WiredHome 124:1690a7ae871c 1060 /// Get the reported touch gesture, if any.
WiredHome 124:1690a7ae871c 1061 ///
WiredHome 124:1690a7ae871c 1062 /// If it could detect a gesture, it will return a value based on
WiredHome 132:a5d7a8541683 1063 /// the interpreted gesture.
WiredHome 124:1690a7ae871c 1064 ///
WiredHome 124:1690a7ae871c 1065 /// Valid gesture values are:
WiredHome 124:1690a7ae871c 1066 /// @li 0x00 No gesture
WiredHome 132:a5d7a8541683 1067 /// @li 0x48 Zoom in
WiredHome 132:a5d7a8541683 1068 /// @li 0x49 Zoom out
WiredHome 132:a5d7a8541683 1069 ///
WiredHome 132:a5d7a8541683 1070 /// The following gestures are defined in the FT5206 specification, but
WiredHome 132:a5d7a8541683 1071 /// do not appear to work.
WiredHome 124:1690a7ae871c 1072 /// @li 0x10 Move up
WiredHome 124:1690a7ae871c 1073 /// @li 0x14 Move left
WiredHome 124:1690a7ae871c 1074 /// @li 0x18 Move down
WiredHome 124:1690a7ae871c 1075 /// @li 0x1C Move right
WiredHome 124:1690a7ae871c 1076 ///
WiredHome 124:1690a7ae871c 1077 /// @returns gesture information.
WiredHome 124:1690a7ae871c 1078 ///
WiredHome 124:1690a7ae871c 1079 uint8_t TouchGesture(void) { return gesture; }
WiredHome 124:1690a7ae871c 1080
WiredHome 123:2f45e80fec5f 1081
WiredHome 124:1690a7ae871c 1082 /// Get the count of registered touches.
WiredHome 124:1690a7ae871c 1083 ///
WiredHome 124:1690a7ae871c 1084 /// @returns count of touch points to communicate; 0 to 5.
WiredHome 124:1690a7ae871c 1085 ///
WiredHome 124:1690a7ae871c 1086 int TouchCount(void) { return numberOfTouchPoints; }
WiredHome 125:7a0b70f56550 1087
WiredHome 124:1690a7ae871c 1088
WiredHome 124:1690a7ae871c 1089 /// Get the count of possible touch channels.
WiredHome 124:1690a7ae871c 1090 ///
WiredHome 124:1690a7ae871c 1091 /// @returns count of touch channels supported by the hardware.
WiredHome 124:1690a7ae871c 1092 ///
WiredHome 124:1690a7ae871c 1093 int TouchChannels(void);
WiredHome 125:7a0b70f56550 1094
WiredHome 124:1690a7ae871c 1095
WiredHome 124:1690a7ae871c 1096 /// Get the Touch ID value for a specified touch channel.
WiredHome 124:1690a7ae871c 1097 ///
WiredHome 124:1690a7ae871c 1098 /// Touch ID is a tracking number based on the order of the touch
WiredHome 124:1690a7ae871c 1099 /// detections. The first touch is ID 0, the next is ID 1, and
WiredHome 124:1690a7ae871c 1100 /// so on. If the first touch is lifted (no touch), the touch count
WiredHome 124:1690a7ae871c 1101 /// decrements, and the remaining touch is communicated on
WiredHome 124:1690a7ae871c 1102 /// touch channel zero, even as the Touch ID remains as originally
WiredHome 124:1690a7ae871c 1103 /// reported (1 in this example). In this way, it is easy to track
WiredHome 132:a5d7a8541683 1104 /// a specific touch.
WiredHome 124:1690a7ae871c 1105 ///
WiredHome 124:1690a7ae871c 1106 /// It is possible to query the data for a channel that is not
WiredHome 124:1690a7ae871c 1107 /// presently reported as touched.
WiredHome 124:1690a7ae871c 1108 ///
WiredHome 166:53fd4a876dac 1109 /// @param[in] channel is the touch channel, from 0 to 4, or 0 to TouchChannels()-1
WiredHome 124:1690a7ae871c 1110 /// It defaults to 0, in case the user is not interested in multi-touch.
WiredHome 124:1690a7ae871c 1111 /// @returns the touch ID, or 15 if you get the ID for an untouched channel.
WiredHome 124:1690a7ae871c 1112 /// @returns 0 if an invalid channel is queried.
WiredHome 124:1690a7ae871c 1113 ///
WiredHome 166:53fd4a876dac 1114 uint8_t TouchID(uint8_t channel = 0);
WiredHome 124:1690a7ae871c 1115
WiredHome 124:1690a7ae871c 1116 /// Get the Touch Code for a touch channel.
WiredHome 124:1690a7ae871c 1117 ///
WiredHome 124:1690a7ae871c 1118 /// It is possible to query the data for a channel that is not
WiredHome 124:1690a7ae871c 1119 /// presently reported as touched.
WiredHome 124:1690a7ae871c 1120 ///
WiredHome 166:53fd4a876dac 1121 /// @param[in] channel is the touch channel, from 0 to 4, or 0 to TouchChannels()-1
WiredHome 124:1690a7ae871c 1122 /// It defaults to 0, in case the user is not interested in multi-touch.
WiredHome 124:1690a7ae871c 1123 /// @returns the touch code (@ref TouchCode_t).
WiredHome 124:1690a7ae871c 1124 /// @returns channel 0 information if an invalid channel is queried.
WiredHome 124:1690a7ae871c 1125 ///
WiredHome 166:53fd4a876dac 1126 TouchCode_t TouchCode(uint8_t channel = 0);
WiredHome 124:1690a7ae871c 1127
WiredHome 125:7a0b70f56550 1128
WiredHome 124:1690a7ae871c 1129 /// Get the coordinates for a touch channel.
WiredHome 124:1690a7ae871c 1130 ///
WiredHome 124:1690a7ae871c 1131 /// This returns the (X,Y) coordinates for a touch channel.
WiredHome 132:a5d7a8541683 1132 ///
WiredHome 124:1690a7ae871c 1133 ///
WiredHome 124:1690a7ae871c 1134 /// It is possible to query the data for a channel that is not
WiredHome 124:1690a7ae871c 1135 /// presently reported as touched.
WiredHome 124:1690a7ae871c 1136 ///
WiredHome 166:53fd4a876dac 1137 /// @param[in] channel is an optional touch channel, from 0 to 4, or 0 to TouchChannels()-1.
WiredHome 124:1690a7ae871c 1138 /// It defaults to 0, in case the user is not interested in multi-touch.
WiredHome 124:1690a7ae871c 1139 /// @returns the coordinates as a point_t structure.
WiredHome 124:1690a7ae871c 1140 /// @returns channel 0 information if an invalid channel is queried.
WiredHome 124:1690a7ae871c 1141 ///
WiredHome 166:53fd4a876dac 1142 point_t TouchCoordinates(uint8_t channel = 0);
WiredHome 166:53fd4a876dac 1143
WiredHome 131:5bd6ba2ee4a1 1144
WiredHome 79:544eb4964795 1145 /// Poll the TouchPanel and on a touch event return the a to d filtered x, y coordinates.
hexley 54:e117ad10fba6 1146 ///
WiredHome 78:faf49c381591 1147 /// This method reads the touch controller, which has a 10-bit range for each the
WiredHome 79:544eb4964795 1148 /// x and the y axis.
WiredHome 79:544eb4964795 1149 ///
WiredHome 79:544eb4964795 1150 /// @note The returned values are not in display (pixel) units but are in analog to
WiredHome 79:544eb4964795 1151 /// digital converter units.
WiredHome 78:faf49c381591 1152 ///
WiredHome 131:5bd6ba2ee4a1 1153 /// @note This API is usually not needed and is likely to be deprecated.
WiredHome 131:5bd6ba2ee4a1 1154 /// See @ref TouchPanelComputeCalibration.
WiredHome 106:c80828f5dea4 1155 /// See @ref TouchPanelReadable.
WiredHome 78:faf49c381591 1156 ///
WiredHome 79:544eb4964795 1157 /// @param[out] x is the x scale a/d value.
WiredHome 79:544eb4964795 1158 /// @param[out] y is the y scale a/d value.
WiredHome 83:7bad0068cca0 1159 /// @returns a value indicating the state of the touch,
WiredHome 83:7bad0068cca0 1160 /// - no_cal: no calibration matrix is available, touch coordinates are not returned.
WiredHome 83:7bad0068cca0 1161 /// - no_touch: no touch is detected, touch coordinates are not returned.
WiredHome 83:7bad0068cca0 1162 /// - touch: touch is detected, touch coordinates are returned.
WiredHome 83:7bad0068cca0 1163 /// - held: held after touch, touch coordinates are returned.
WiredHome 83:7bad0068cca0 1164 /// - release: indicates a release, touch coordinates are returned.
WiredHome 56:7a85d226ad0d 1165 ///
WiredHome 83:7bad0068cca0 1166 TouchCode_t TouchPanelA2DFiltered(int *x, int *y);
hexley 54:e117ad10fba6 1167
WiredHome 125:7a0b70f56550 1168
WiredHome 79:544eb4964795 1169 /// Poll the TouchPanel and on a touch event return the a to d raw x, y coordinates.
hexley 54:e117ad10fba6 1170 ///
WiredHome 78:faf49c381591 1171 /// This method reads the touch controller, which has a 10-bit range for each the
WiredHome 78:faf49c381591 1172 /// x and the y axis. A number of samples of the raw data are taken, filtered,
WiredHome 79:544eb4964795 1173 /// and the results are returned.
WiredHome 78:faf49c381591 1174 ///
WiredHome 79:544eb4964795 1175 /// @note The returned values are not in display (pixel) units but are in analog to
WiredHome 79:544eb4964795 1176 /// digital converter units.
WiredHome 79:544eb4964795 1177 ///
WiredHome 131:5bd6ba2ee4a1 1178 /// @note This API is usually not needed and is likely to be deprecated.
WiredHome 131:5bd6ba2ee4a1 1179 /// See @ref TouchPanelComputeCalibration.
WiredHome 106:c80828f5dea4 1180 /// See @ref TouchPanelReadable.
WiredHome 78:faf49c381591 1181 ///
WiredHome 79:544eb4964795 1182 /// @param[out] x is the x scale a/d value.
WiredHome 79:544eb4964795 1183 /// @param[out] y is the y scale a/d value.
WiredHome 83:7bad0068cca0 1184 /// @returns a value indicating the state of the touch,
WiredHome 83:7bad0068cca0 1185 /// - no_cal: no calibration matrix is available, touch coordinates are not returned.
WiredHome 83:7bad0068cca0 1186 /// - no_touch: no touch is detected, touch coordinates are not returned.
WiredHome 83:7bad0068cca0 1187 /// - touch: touch is detected, touch coordinates are returned.
WiredHome 83:7bad0068cca0 1188 /// - held: held after touch, touch coordinates are returned.
WiredHome 83:7bad0068cca0 1189 /// - release: indicates a release, touch coordinates are returned.
WiredHome 83:7bad0068cca0 1190 ///
WiredHome 83:7bad0068cca0 1191 TouchCode_t TouchPanelA2DRaw(int *x, int *y);
WiredHome 125:7a0b70f56550 1192
WiredHome 83:7bad0068cca0 1193
WiredHome 85:022bba13c5c4 1194 /// Wait for a touch panel touch and return it.
WiredHome 85:022bba13c5c4 1195 ///
WiredHome 85:022bba13c5c4 1196 /// This method is similar to Serial.getc() in that it will wait for a touch
WiredHome 85:022bba13c5c4 1197 /// and then return. In order to extract the coordinates of the touch, a
WiredHome 85:022bba13c5c4 1198 /// valid pointer to a point_t must be provided.
WiredHome 85:022bba13c5c4 1199 ///
WiredHome 85:022bba13c5c4 1200 /// @note There is no timeout on this function, so its use is not recommended.
WiredHome 85:022bba13c5c4 1201 ///
WiredHome 85:022bba13c5c4 1202 /// @code
WiredHome 85:022bba13c5c4 1203 /// Timer t;
WiredHome 85:022bba13c5c4 1204 /// t.start();
WiredHome 85:022bba13c5c4 1205 /// do {
WiredHome 85:022bba13c5c4 1206 /// point_t point = {0, 0};
WiredHome 85:022bba13c5c4 1207 /// display.TouchPanelGet(&point); // hangs here until touch
WiredHome 85:022bba13c5c4 1208 /// display.pixel(point, Red);
WiredHome 85:022bba13c5c4 1209 /// } while (t.read_ms() < 30000);
WiredHome 85:022bba13c5c4 1210 /// @endcode
WiredHome 85:022bba13c5c4 1211 ///
WiredHome 85:022bba13c5c4 1212 /// @param[out] TouchPoint is the touch point, if a touch is registered.
WiredHome 85:022bba13c5c4 1213 /// @returns a value indicating the state of the touch,
WiredHome 85:022bba13c5c4 1214 /// - no_cal: no calibration matrix is available, touch coordinates are not returned.
WiredHome 85:022bba13c5c4 1215 /// - no_touch: no touch is detected, touch coordinates are not returned.
WiredHome 85:022bba13c5c4 1216 /// - touch: touch is detected, touch coordinates are returned.
WiredHome 85:022bba13c5c4 1217 /// - held: held after touch, touch coordinates are returned.
WiredHome 85:022bba13c5c4 1218 /// - release: indicates a release, touch coordinates are returned.
WiredHome 85:022bba13c5c4 1219 ///
WiredHome 85:022bba13c5c4 1220 TouchCode_t TouchPanelGet(point_t * TouchPoint);
WiredHome 85:022bba13c5c4 1221
WiredHome 83:7bad0068cca0 1222
WiredHome 157:1565f38ca44b 1223 /// Configuration Option for the Resistive Touch Panel Calibration.
WiredHome 157:1565f38ca44b 1224 ///
WiredHome 157:1565f38ca44b 1225 /// This method is only useful for the resistive touchscreen.
WiredHome 157:1565f38ca44b 1226 ///
WiredHome 157:1565f38ca44b 1227 /// Also, this method is optional - the user can take all of the responsibility
WiredHome 157:1565f38ca44b 1228 /// in their code, or for simplicity sake, this API can be used prior
WiredHome 157:1565f38ca44b 1229 /// to the init method.
WiredHome 157:1565f38ca44b 1230 ///
WiredHome 157:1565f38ca44b 1231 /// @code
WiredHome 157:1565f38ca44b 1232 /// RA8875 lcd(p5, p6, p7, p12, NC);
WiredHome 157:1565f38ca44b 1233 /// ...
WiredHome 157:1565f38ca44b 1234 /// // Be sure you previously mounted the "/sd" file system to put the cal there.
WiredHome 157:1565f38ca44b 1235 /// lcd.ResTouchPanelCfg("/sd/tpcal.cfg", "Touch '+' to calibrate the touch panel");
WiredHome 157:1565f38ca44b 1236 ///
WiredHome 157:1565f38ca44b 1237 /// // Only if the touch panel is enabled, AND is configured as the resistive
WiredHome 157:1565f38ca44b 1238 /// // panel will the prior command be useful.
WiredHome 157:1565f38ca44b 1239 /// lcd.init(LCD_W,LCD_H,LCD_C,40, false, true);
WiredHome 157:1565f38ca44b 1240 ///
WiredHome 157:1565f38ca44b 1241 /// @endcode
WiredHome 157:1565f38ca44b 1242 ///
WiredHome 157:1565f38ca44b 1243 /// @param[in] tpFQFN is a pointer to a fully qualified read-write accessible
WiredHome 157:1565f38ca44b 1244 /// filename where the calibration is held.
WiredHome 157:1565f38ca44b 1245 /// @param[in] tpCalMessage is an optional pointer to a message shown to the
WiredHome 157:1565f38ca44b 1246 /// user in the calibration process.
WiredHome 157:1565f38ca44b 1247 /// - If this parameter is not included, a default message will be shown.
WiredHome 157:1565f38ca44b 1248 /// - If this parameter points to a NULL string, no message is shown.
WiredHome 157:1565f38ca44b 1249 /// - If this parameter points to a non-NULL string, that string will be shown.
WiredHome 157:1565f38ca44b 1250 ///
WiredHome 157:1565f38ca44b 1251 void ResTouchPanelCfg(const char * tpFQFN = NULL, const char * tpCalMessage = NULL);
WiredHome 157:1565f38ca44b 1252
WiredHome 157:1565f38ca44b 1253
WiredHome 77:9206c13aa527 1254 /// Calibrate the touch panel.
WiredHome 77:9206c13aa527 1255 ///
WiredHome 77:9206c13aa527 1256 /// This method accepts two lists - one list is target points in ,
WiredHome 77:9206c13aa527 1257 /// display coordinates and the other is a lit of raw touch coordinate
WiredHome 77:9206c13aa527 1258 /// values. It generates a calibration matrix for later use. This
WiredHome 77:9206c13aa527 1259 /// matrix is also accessible to the calling API, which may store
WiredHome 77:9206c13aa527 1260 /// the matrix in persistent memory and then install the calibration
WiredHome 77:9206c13aa527 1261 /// matrix on the next power cycle. By doing so, it can avoid the
WiredHome 77:9206c13aa527 1262 /// need to calibrate on every power cycle.
WiredHome 77:9206c13aa527 1263 ///
WiredHome 81:01da2e34283d 1264 /// @note The methods "TouchPanelComputeCalibration", "TouchPanelReadable", and
WiredHome 77:9206c13aa527 1265 /// indirectly the "TouchPanelSetMatrix" methods are all derived
WiredHome 77:9206c13aa527 1266 /// from a program by Carlos E. Vidales. See the copyright note
WiredHome 77:9206c13aa527 1267 /// for further details. See also the article
WiredHome 77:9206c13aa527 1268 /// http://www.embedded.com/design/system-integration/4023968/How-To-Calibrate-Touch-Screens
WiredHome 77:9206c13aa527 1269 ///
WiredHome 167:8aa3fb2a5a31 1270 /// @copyright Copyright &copy; 2001, Carlos E. Vidales. All rights reserved.
WiredHome 78:faf49c381591 1271 /// This sample program was written and put in the public domain
WiredHome 78:faf49c381591 1272 /// by Carlos E. Vidales. The program is provided "as is"
WiredHome 78:faf49c381591 1273 /// without warranty of any kind, either expressed or implied.
WiredHome 78:faf49c381591 1274 /// If you choose to use the program within your own products
WiredHome 78:faf49c381591 1275 /// you do so at your own risk, and assume the responsibility
WiredHome 78:faf49c381591 1276 /// for servicing, repairing or correcting the program should
WiredHome 78:faf49c381591 1277 /// it prove defective in any manner.
WiredHome 78:faf49c381591 1278 /// You may copy and distribute the program's source code in any
WiredHome 78:faf49c381591 1279 /// medium, provided that you also include in each copy an
WiredHome 78:faf49c381591 1280 /// appropriate copyright notice and disclaimer of warranty.
WiredHome 78:faf49c381591 1281 /// You may also modify this program and distribute copies of
WiredHome 78:faf49c381591 1282 /// it provided that you include prominent notices stating
WiredHome 78:faf49c381591 1283 /// that you changed the file(s) and the date of any change,
WiredHome 78:faf49c381591 1284 /// and that you do not charge any royalties or licenses for
WiredHome 78:faf49c381591 1285 /// its use.
WiredHome 77:9206c13aa527 1286 ///
WiredHome 77:9206c13aa527 1287 /// @param[in] display is a pointer to a set of 3 points, which
WiredHome 77:9206c13aa527 1288 /// are in display units of measure. These are the targets
WiredHome 77:9206c13aa527 1289 /// the calibration was aiming for.
WiredHome 77:9206c13aa527 1290 /// @param[in] screen is a pointer to a set of 3 points, which
WiredHome 77:9206c13aa527 1291 /// are in touchscreen units of measure. These are the
WiredHome 77:9206c13aa527 1292 /// registered touches.
WiredHome 77:9206c13aa527 1293 /// @param[out] matrix is an optional parameter to hold the calibration matrix
WiredHome 77:9206c13aa527 1294 /// as a result of the calibration. This can be saved in
WiredHome 77:9206c13aa527 1295 /// non-volatile memory to recover the calibration after a power fail.
WiredHome 167:8aa3fb2a5a31 1296 /// @returns @ref RetCode_t value.
WiredHome 77:9206c13aa527 1297 ///
WiredHome 81:01da2e34283d 1298 RetCode_t TouchPanelComputeCalibration(point_t display[3], point_t screen[3], tpMatrix_t * matrix);
WiredHome 81:01da2e34283d 1299
WiredHome 81:01da2e34283d 1300
WiredHome 81:01da2e34283d 1301 /// Perform the touch panel calibration process.
WiredHome 81:01da2e34283d 1302 ///
WiredHome 81:01da2e34283d 1303 /// This method provides the easy "shortcut" to calibrating the touch panel.
WiredHome 81:01da2e34283d 1304 /// The process will automatically generate the calibration points, present
WiredHome 81:01da2e34283d 1305 /// the targets on-screen, detect the touches, compute the calibration
WiredHome 81:01da2e34283d 1306 /// matrix, and optionally provide the calibration matrix to the calling code
WiredHome 81:01da2e34283d 1307 /// for persistence in non-volatile memory.
WiredHome 81:01da2e34283d 1308 ///
WiredHome 81:01da2e34283d 1309 /// @param[out] matrix is an optional parameter to hold the calibration matrix
WiredHome 81:01da2e34283d 1310 /// as a result of the calibration. This can be saved in
WiredHome 81:01da2e34283d 1311 /// non-volatile memory to recover the calibration after a power fail.
WiredHome 167:8aa3fb2a5a31 1312 /// @returns @ref RetCode_t value.
WiredHome 81:01da2e34283d 1313 ///
WiredHome 85:022bba13c5c4 1314 RetCode_t TouchPanelCalibrate(tpMatrix_t * matrix = NULL);
WiredHome 81:01da2e34283d 1315
WiredHome 125:7a0b70f56550 1316
WiredHome 81:01da2e34283d 1317 /// Perform the touch panel calibration process.
WiredHome 81:01da2e34283d 1318 ///
WiredHome 81:01da2e34283d 1319 /// This method provides the easy "shortcut" to calibrating the touch panel.
WiredHome 81:01da2e34283d 1320 /// The process will automatically generate the calibration points, present
WiredHome 81:01da2e34283d 1321 /// the targets on-screen, detect the touches, compute the calibration
WiredHome 81:01da2e34283d 1322 /// matrix, and optionally provide the calibration matrix to the calling code
WiredHome 81:01da2e34283d 1323 /// for persistence in non-volatile memory.
WiredHome 81:01da2e34283d 1324 ///
WiredHome 81:01da2e34283d 1325 /// @param[in] msg is a text message to present on the screen during the
WiredHome 81:01da2e34283d 1326 /// calibration process.
WiredHome 81:01da2e34283d 1327 /// @param[out] matrix is an optional parameter to hold the calibration matrix
WiredHome 81:01da2e34283d 1328 /// as a result of the calibration. This can be saved in
WiredHome 81:01da2e34283d 1329 /// non-volatile memory to recover the calibration after a power fail.
WiredHome 88:bfddef6ec836 1330 /// @param[in] maxwait_s is the maximum number of seconds to wait for a touch
WiredHome 88:bfddef6ec836 1331 /// calibration. If no touch panel installed, it then reports
WiredHome 155:b3f225ae572c 1332 /// touch_cal_timeout. Default: 30 s.
WiredHome 167:8aa3fb2a5a31 1333 /// @returns @ref RetCode_t value.
WiredHome 81:01da2e34283d 1334 ///
WiredHome 155:b3f225ae572c 1335 RetCode_t TouchPanelCalibrate(const char * msg, tpMatrix_t * matrix = NULL, int maxwait_s = 30);
WiredHome 77:9206c13aa527 1336
WiredHome 125:7a0b70f56550 1337
WiredHome 157:1565f38ca44b 1338 /// Set the calibration matrix for the resistive touch panel.
WiredHome 77:9206c13aa527 1339 ///
WiredHome 77:9206c13aa527 1340 /// This method is used to set the calibration matrix for the touch panel. After
WiredHome 106:c80828f5dea4 1341 /// performing the calibration (See @ref TouchPanelComputeCalibration), the matrix can be stored.
WiredHome 77:9206c13aa527 1342 /// On a subsequence power cycle, the matrix may be restored from non-volatile and
WiredHome 77:9206c13aa527 1343 /// passed in to this method. It will then be held to perform the corrections when
WiredHome 77:9206c13aa527 1344 /// reading the touch panel point.
WiredHome 77:9206c13aa527 1345 ///
WiredHome 78:faf49c381591 1346 /// @code
WiredHome 78:faf49c381591 1347 /// FILE * fh = fopen("/local/tpmatrix.cfg", "r");
WiredHome 78:faf49c381591 1348 /// if (fh) {
WiredHome 78:faf49c381591 1349 /// tpMatrix_t matrix;
WiredHome 78:faf49c381591 1350 /// if (fread(fh, &matrix, sizeof(tpMatrix_t))) {
WiredHome 78:faf49c381591 1351 /// lcd.TouchPanelSetMatrix(&matrix);
WiredHome 78:faf49c381591 1352 /// }
WiredHome 78:faf49c381591 1353 /// fclose(fh);
WiredHome 78:faf49c381591 1354 /// }
WiredHome 78:faf49c381591 1355 /// @endcode
WiredHome 78:faf49c381591 1356 ///
WiredHome 77:9206c13aa527 1357 /// @param[in] matrix is a pointer to the touch panel calibration matrix.
WiredHome 167:8aa3fb2a5a31 1358 /// @returns @ref RetCode_t value.
WiredHome 77:9206c13aa527 1359 ///
WiredHome 77:9206c13aa527 1360 RetCode_t TouchPanelSetMatrix(tpMatrix_t * matrix);
WiredHome 157:1565f38ca44b 1361
WiredHome 157:1565f38ca44b 1362 /// Get the calibration matrix for the resistive touch panel.
WiredHome 157:1565f38ca44b 1363 ///
WiredHome 157:1565f38ca44b 1364 /// This method returns a const pointer to the matrix. If this matrix has
WiredHome 157:1565f38ca44b 1365 /// not be set, with either the TouchPanelSetMatrix API or the calibration
WiredHome 157:1565f38ca44b 1366 /// process, the results are indeterminate.
WiredHome 157:1565f38ca44b 1367 ///
WiredHome 157:1565f38ca44b 1368 /// return const tpMatrix_t pointer
WiredHome 157:1565f38ca44b 1369 ///
WiredHome 157:1565f38ca44b 1370 const tpMatrix_t * TouchPanelGetMatrix();
WiredHome 125:7a0b70f56550 1371
WiredHome 75:ca78388cfd77 1372 #if 0
hexley 54:e117ad10fba6 1373 /// Append interrupt handler for specific RA8875 interrupt source
hexley 54:e117ad10fba6 1374 ///
hexley 54:e117ad10fba6 1375 /// @param[in] bISRType Interrupt Source, should be:
hexley 54:e117ad10fba6 1376 /// - RA8875_INT_KEYSCAN: KEYCAN interrupt
hexley 54:e117ad10fba6 1377 /// - RA8875_INT_DMA: DMA interrupt
hexley 54:e117ad10fba6 1378 /// - RA8875_INT_TP: Touch panel interrupt
hexley 54:e117ad10fba6 1379 /// - RA8875_INT_BTE: BTE process complete interrupt
hexley 54:e117ad10fba6 1380 /// - RA8875_INT_BTEMCU_FONTWR: Multi-purpose interrupt (see spec sheet)
WiredHome 56:7a85d226ad0d 1381 /// @param[in] fptr is a callback function to handle the interrupt event.
WiredHome 56:7a85d226ad0d 1382 /// @returns none
hexley 54:e117ad10fba6 1383 ///
hexley 54:e117ad10fba6 1384 void AppendISR(uint8_t bISRType, void(*fptr)(void));
hexley 54:e117ad10fba6 1385
hexley 54:e117ad10fba6 1386 /// Unappend interrupt handler for specific RA8875 interrupt source
hexley 54:e117ad10fba6 1387 ///
hexley 54:e117ad10fba6 1388 /// @param[in] bISRType Interrupt Source, should be:
hexley 54:e117ad10fba6 1389 /// - RA8875_INT_KEYSCAN: KEYCAN interrupt
hexley 54:e117ad10fba6 1390 /// - RA8875_INT_DMA: DMA interrupt
hexley 54:e117ad10fba6 1391 /// - RA8875_INT_TP: Touch panel interrupt
hexley 54:e117ad10fba6 1392 /// - RA8875_INT_BTE: BTE process complete interrupt
hexley 54:e117ad10fba6 1393 /// - RA8875_INT_BTEMCU_FONTWR: Multi-purpose interrupt (see spec sheet)
hexley 54:e117ad10fba6 1394 /// @return none
hexley 54:e117ad10fba6 1395 ///
hexley 54:e117ad10fba6 1396 void UnAppendISR(uint8_t bISRType);
WiredHome 75:ca78388cfd77 1397 #endif
WiredHome 77:9206c13aa527 1398
WiredHome 125:7a0b70f56550 1399
WiredHome 71:dcac8efd842d 1400 /// Initialize the keypad interface on the RA8875 controller.
WiredHome 71:dcac8efd842d 1401 ///
WiredHome 71:dcac8efd842d 1402 /// Enables the keypad subsystem. It will scan the 4 x 5 matrix
WiredHome 182:8832d03a2a29 1403 /// and make available key presses. See also @ref SetKeyMap().
WiredHome 71:dcac8efd842d 1404 ///
WiredHome 71:dcac8efd842d 1405 /// @note See section 5-13 of RAIO RA8875 data sheet for more details.
WiredHome 125:7a0b70f56550 1406 /// @note When using the display from buy-display.com, be sure that
WiredHome 71:dcac8efd842d 1407 /// the option for the keypad is configured on the hardware.
WiredHome 71:dcac8efd842d 1408 ///
WiredHome 71:dcac8efd842d 1409 /// All parameters are optional.
WiredHome 76:c981284eb513 1410 /// @param[in] scanEnable when true, enables the key scan function (default: true).
WiredHome 76:c981284eb513 1411 /// @param[in] longDetect when true, additionally enables the long key held detection (default: false).
WiredHome 71:dcac8efd842d 1412 /// @param[in] sampleTime setting (range: 0 - 3, default: 0).
WiredHome 71:dcac8efd842d 1413 /// @param[in] scanFrequency setting (range: 0 - 7, default: 0).
WiredHome 71:dcac8efd842d 1414 /// @param[in] longTimeAdjustment (range: 0 - 3, default: 0).
WiredHome 76:c981284eb513 1415 /// @param[in] interruptEnable when true, enables interrupts from keypress (default: false).
WiredHome 76:c981284eb513 1416 /// @param[in] wakeupEnable when true, activates the wakeup function (default: false).
WiredHome 71:dcac8efd842d 1417 ///
WiredHome 167:8aa3fb2a5a31 1418 /// @returns @ref RetCode_t value.
WiredHome 71:dcac8efd842d 1419 ///
WiredHome 71:dcac8efd842d 1420 RetCode_t KeypadInit(bool scanEnable = true, bool longDetect = false,
WiredHome 71:dcac8efd842d 1421 uint8_t sampleTime = 0, uint8_t scanFrequency = 0,
WiredHome 71:dcac8efd842d 1422 uint8_t longTimeAdjustment = 0,
WiredHome 71:dcac8efd842d 1423 bool interruptEnable = false, bool wakeupEnable = false);
WiredHome 71:dcac8efd842d 1424
WiredHome 125:7a0b70f56550 1425
WiredHome 75:ca78388cfd77 1426 /// Create Key Code definitions for the key matrix.
WiredHome 75:ca78388cfd77 1427 ///
WiredHome 75:ca78388cfd77 1428 /// This API provides a table of 22 key-code assignments for the matrix of keys.
WiredHome 182:8832d03a2a29 1429 /// See also KeypadInit().
WiredHome 75:ca78388cfd77 1430 /// This can be used to translate the keys 1 - 20 into some other value, as
WiredHome 75:ca78388cfd77 1431 /// well as to communicate the "no key" (zero) and "error state" (21).
WiredHome 75:ca78388cfd77 1432 ///
WiredHome 75:ca78388cfd77 1433 /// In this way, a keypad could easily emulate a piece of a keyboard, transforming
WiredHome 75:ca78388cfd77 1434 /// 0 - 20 into the values 0, '0', '1', '2', '3', '4', '5', '6', '7', '8',
WiredHome 125:7a0b70f56550 1435 /// '9', '+', '-', '*' , '/', '=', '(bs)', '(cr)', and so on...
WiredHome 75:ca78388cfd77 1436 ///
WiredHome 75:ca78388cfd77 1437 /// @code
WiredHome 75:ca78388cfd77 1438 /// // Return Value by Row, Column Example reassignment
WiredHome 75:ca78388cfd77 1439 /// // Column 0 1 2 3 4
WiredHome 75:ca78388cfd77 1440 /// // +-------------------------+ +-------------------------+
WiredHome 76:c981284eb513 1441 /// // Row 0 | 1 2 3 4 5 | | '7' '8' '9' ',' '<-' |
WiredHome 75:ca78388cfd77 1442 /// // 1 | 6 7 8 9 10 | | '4' '5' '6' '/' '-' |
WiredHome 75:ca78388cfd77 1443 /// // 2 | 11 12 13 14 15 | | '1' '2' '3' '*' '+' |
WiredHome 76:c981284eb513 1444 /// // 3 | 16 17 18 19 20 | | '0' '.' '(' ')' '\n' |
WiredHome 75:ca78388cfd77 1445 /// // +-------------------------+ +-------------------------+
WiredHome 75:ca78388cfd77 1446 /// // Return value 0 = No Key pressed
WiredHome 75:ca78388cfd77 1447 /// // Return value 21 = Error
WiredHome 77:9206c13aa527 1448 /// const uint8_t CodeList[22] =
WiredHome 77:9206c13aa527 1449 /// {0, '7', '8', '9', ',', '\h',
WiredHome 77:9206c13aa527 1450 /// '4', '5', '6', '/', '-',
WiredHome 77:9206c13aa527 1451 /// '1', '2', '3', '*', '+',
WiredHome 77:9206c13aa527 1452 /// '0', '.', '(', ')', '\n',
WiredHome 77:9206c13aa527 1453 /// '\x1b'};
WiredHome 77:9206c13aa527 1454 /// lcd.SetKeyMap(CodeList);
WiredHome 75:ca78388cfd77 1455 /// @endcode
WiredHome 75:ca78388cfd77 1456 ///
WiredHome 75:ca78388cfd77 1457 /// @param[in] CodeList is a pointer to an always available byte-array
WiredHome 75:ca78388cfd77 1458 /// where the first 22 bytes are used as the transformation
WiredHome 75:ca78388cfd77 1459 /// from raw code to your reassigned value.
WiredHome 75:ca78388cfd77 1460 /// If CodeList is NULL, the original raw value key map is
WiredHome 75:ca78388cfd77 1461 /// restored.
WiredHome 167:8aa3fb2a5a31 1462 /// @returns @ref RetCode_t value.
WiredHome 75:ca78388cfd77 1463 ///
WiredHome 75:ca78388cfd77 1464 RetCode_t SetKeyMap(const uint8_t * CodeList = NULL);
WiredHome 75:ca78388cfd77 1465
WiredHome 125:7a0b70f56550 1466
WiredHome 71:dcac8efd842d 1467 /// Determine if a key has been hit
WiredHome 71:dcac8efd842d 1468 ///
WiredHome 71:dcac8efd842d 1469 /// @returns true if a key has been hit
WiredHome 71:dcac8efd842d 1470 ///
WiredHome 75:ca78388cfd77 1471 bool readable();
WiredHome 71:dcac8efd842d 1472
WiredHome 125:7a0b70f56550 1473
WiredHome 71:dcac8efd842d 1474 /// Blocking read of the keypad.
WiredHome 71:dcac8efd842d 1475 ///
WiredHome 125:7a0b70f56550 1476 /// @note: This is a blocking read, so it is important to first call _kbhit()
WiredHome 71:dcac8efd842d 1477 /// to avoid hanging your processes.
WiredHome 71:dcac8efd842d 1478 ///
WiredHome 71:dcac8efd842d 1479 /// A keypad connected to the RA8875 is connected in a matrix of 4 rows and 5 columns.
WiredHome 75:ca78388cfd77 1480 /// When pressed, this method will return a code in the range of 1 through 20, reserving
WiredHome 75:ca78388cfd77 1481 /// the value 0 to indicate that no key is pressed.
WiredHome 71:dcac8efd842d 1482 ///
WiredHome 71:dcac8efd842d 1483 /// Additionally, if configured to detect a "long press", bit 7 will be set to indicate
WiredHome 71:dcac8efd842d 1484 /// this. In this situation, first a "normal press" would be detected and signaled and
WiredHome 71:dcac8efd842d 1485 /// soon after that a "long press" of the same key would be detected and communicated.
WiredHome 71:dcac8efd842d 1486 ///
WiredHome 75:ca78388cfd77 1487 /// @return 8-bit where bit 7 indicates a long press. The remaining bits indicate the
WiredHome 75:ca78388cfd77 1488 /// keypress using 0 = no key pressed, 1 - 20 = the key pressed.
WiredHome 71:dcac8efd842d 1489 ///
WiredHome 75:ca78388cfd77 1490 uint8_t getc();
WiredHome 75:ca78388cfd77 1491
WiredHome 82:f7d300f26540 1492
WiredHome 82:f7d300f26540 1493 /// Determine if a point is within a rectangle.
WiredHome 82:f7d300f26540 1494 ///
WiredHome 82:f7d300f26540 1495 /// @param[in] rect is a rectangular region to use.
WiredHome 82:f7d300f26540 1496 /// @param[in] p is a point to analyze to see if it is within the rect.
WiredHome 82:f7d300f26540 1497 /// @returns true if p is within rect.
WiredHome 82:f7d300f26540 1498 ///
WiredHome 82:f7d300f26540 1499 bool Intersect(rect_t rect, point_t p);
WiredHome 82:f7d300f26540 1500
WiredHome 131:5bd6ba2ee4a1 1501 /// Determine if a rectangle intersects another rectangle.
WiredHome 131:5bd6ba2ee4a1 1502 ///
WiredHome 131:5bd6ba2ee4a1 1503 /// @param[in] rect1 is a rectangular region.
WiredHome 131:5bd6ba2ee4a1 1504 /// @param[in] rect2 is a second rectangular region.
WiredHome 147:3494792458d9 1505 /// @returns true if any part of rect2 intersects rect1.
WiredHome 131:5bd6ba2ee4a1 1506 ///
WiredHome 131:5bd6ba2ee4a1 1507 bool Intersect(rect_t rect1, rect_t rect2);
WiredHome 82:f7d300f26540 1508
WiredHome 147:3494792458d9 1509 /// Determine if a rectangle intersects another rectangle and provides
WiredHome 147:3494792458d9 1510 /// the area of intersection.
WiredHome 147:3494792458d9 1511 ///
WiredHome 147:3494792458d9 1512 /// @code
WiredHome 147:3494792458d9 1513 /// +---------------------+
WiredHome 147:3494792458d9 1514 /// | rect1 |
WiredHome 147:3494792458d9 1515 /// | |
WiredHome 147:3494792458d9 1516 /// | +------------------+
WiredHome 147:3494792458d9 1517 /// | | rect3 | |
WiredHome 147:3494792458d9 1518 /// | | | |
WiredHome 147:3494792458d9 1519 /// +---------------------+ |
WiredHome 147:3494792458d9 1520 /// | rect2 |
WiredHome 147:3494792458d9 1521 /// +------------------+
WiredHome 147:3494792458d9 1522 /// @endcode
WiredHome 147:3494792458d9 1523 ///
WiredHome 147:3494792458d9 1524 /// @note that the first parameter is a pointer to a rect and the
WiredHome 147:3494792458d9 1525 ///
WiredHome 147:3494792458d9 1526 /// @param[inout] pRect1 is a pointer to a rectangular region, and returns
WiredHome 147:3494792458d9 1527 /// the area of intersection.
WiredHome 147:3494792458d9 1528 /// @param[in] pRect2 is a pointer to a second rectangular region.
WiredHome 147:3494792458d9 1529 /// @returns true if pRect1 and pRect2 intersect and pRect1 is written with
WiredHome 147:3494792458d9 1530 /// the rectangle describing the intersection.
WiredHome 147:3494792458d9 1531 ///
WiredHome 167:8aa3fb2a5a31 1532 bool Intersect(rect_t * pRect1, const rect_t * pRect2);
WiredHome 147:3494792458d9 1533
WiredHome 147:3494792458d9 1534
WiredHome 38:38d503b4fad6 1535 /// Write a command to the display with a word of data.
WiredHome 38:38d503b4fad6 1536 ///
WiredHome 38:38d503b4fad6 1537 /// This is a high level command, and may invoke several primitives.
WiredHome 38:38d503b4fad6 1538 ///
WiredHome 72:ecffe56af969 1539 /// @param[in] command is the command to write.
WiredHome 72:ecffe56af969 1540 /// @param[in] data is data to be written to the command register.
WiredHome 167:8aa3fb2a5a31 1541 /// @returns @ref RetCode_t value.
WiredHome 38:38d503b4fad6 1542 ///
WiredHome 38:38d503b4fad6 1543 RetCode_t WriteCommandW(uint8_t command, uint16_t data);
WiredHome 38:38d503b4fad6 1544
WiredHome 125:7a0b70f56550 1545
WiredHome 19:3f82c1161fd2 1546 /// Write a command to the display
WiredHome 19:3f82c1161fd2 1547 ///
WiredHome 19:3f82c1161fd2 1548 /// This is a high level command, and may invoke several primitives.
WiredHome 19:3f82c1161fd2 1549 ///
WiredHome 72:ecffe56af969 1550 /// @param[in] command is the command to write.
WiredHome 72:ecffe56af969 1551 /// @param[in] data is optional data to be written to the command register
WiredHome 19:3f82c1161fd2 1552 /// and only occurs if the data is in the range [0 - 0xFF].
WiredHome 167:8aa3fb2a5a31 1553 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 1554 ///
WiredHome 32:0e4f2ae512e2 1555 virtual RetCode_t WriteCommand(unsigned char command, unsigned int data = 0xFFFF);
WiredHome 125:7a0b70f56550 1556
WiredHome 19:3f82c1161fd2 1557
WiredHome 38:38d503b4fad6 1558 /// Write a data word to the display
WiredHome 38:38d503b4fad6 1559 ///
WiredHome 38:38d503b4fad6 1560 /// This is a high level command, and may invoke several primitives.
WiredHome 38:38d503b4fad6 1561 ///
WiredHome 72:ecffe56af969 1562 /// @param[in] data is the data to write.
WiredHome 167:8aa3fb2a5a31 1563 /// @returns @ref RetCode_t value.
WiredHome 38:38d503b4fad6 1564 ///
WiredHome 38:38d503b4fad6 1565 RetCode_t WriteDataW(uint16_t data);
WiredHome 125:7a0b70f56550 1566
WiredHome 38:38d503b4fad6 1567
WiredHome 19:3f82c1161fd2 1568 /// Write a data byte to the display
WiredHome 19:3f82c1161fd2 1569 ///
WiredHome 19:3f82c1161fd2 1570 /// This is a high level command, and may invoke several primitives.
WiredHome 19:3f82c1161fd2 1571 ///
WiredHome 72:ecffe56af969 1572 /// @param[in] data is the data to write.
WiredHome 167:8aa3fb2a5a31 1573 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 1574 ///
WiredHome 32:0e4f2ae512e2 1575 virtual RetCode_t WriteData(unsigned char data);
WiredHome 125:7a0b70f56550 1576
WiredHome 19:3f82c1161fd2 1577
WiredHome 19:3f82c1161fd2 1578 /// Read a command register
WiredHome 19:3f82c1161fd2 1579 ///
WiredHome 72:ecffe56af969 1580 /// @param[in] command is the command register to read.
WiredHome 19:3f82c1161fd2 1581 /// @returns the value read from the register.
WiredHome 19:3f82c1161fd2 1582 ///
WiredHome 19:3f82c1161fd2 1583 unsigned char ReadCommand(unsigned char command);
WiredHome 136:224e03d5c31f 1584
WiredHome 136:224e03d5c31f 1585
WiredHome 136:224e03d5c31f 1586 /// Read a word from a command register
WiredHome 136:224e03d5c31f 1587 ///
WiredHome 136:224e03d5c31f 1588 /// @param[in] command is the command register to read.
WiredHome 136:224e03d5c31f 1589 /// @returns the value read from the register.
WiredHome 136:224e03d5c31f 1590 ///
WiredHome 136:224e03d5c31f 1591 uint16_t ReadCommandW(unsigned char command);
WiredHome 19:3f82c1161fd2 1592
WiredHome 136:224e03d5c31f 1593
WiredHome 41:2956a0a221e5 1594 /// Read a data byte from the display
WiredHome 19:3f82c1161fd2 1595 ///
WiredHome 19:3f82c1161fd2 1596 /// This is a high level command, and may invoke several primitives.
WiredHome 19:3f82c1161fd2 1597 ///
WiredHome 19:3f82c1161fd2 1598 /// @returns data that was read.
WiredHome 19:3f82c1161fd2 1599 ///
WiredHome 19:3f82c1161fd2 1600 unsigned char ReadData(void);
WiredHome 125:7a0b70f56550 1601
WiredHome 19:3f82c1161fd2 1602
WiredHome 41:2956a0a221e5 1603 /// Read a word from the display
WiredHome 41:2956a0a221e5 1604 ///
WiredHome 41:2956a0a221e5 1605 /// This is a high level command, and may invoke several primitives.
WiredHome 41:2956a0a221e5 1606 ///
WiredHome 41:2956a0a221e5 1607 /// @returns data that was read.
WiredHome 41:2956a0a221e5 1608 ///
WiredHome 41:2956a0a221e5 1609 uint16_t ReadDataW(void);
WiredHome 41:2956a0a221e5 1610
WiredHome 125:7a0b70f56550 1611
WiredHome 19:3f82c1161fd2 1612 /// Read the display status
WiredHome 19:3f82c1161fd2 1613 ///
WiredHome 19:3f82c1161fd2 1614 /// This is a high level command, and may invoke several primitives.
WiredHome 19:3f82c1161fd2 1615 ///
WiredHome 19:3f82c1161fd2 1616 /// @returns data that was read.
WiredHome 19:3f82c1161fd2 1617 ///
WiredHome 19:3f82c1161fd2 1618 unsigned char ReadStatus(void);
WiredHome 19:3f82c1161fd2 1619
WiredHome 125:7a0b70f56550 1620
WiredHome 19:3f82c1161fd2 1621 /// get the width in pixels of the currently active font
WiredHome 19:3f82c1161fd2 1622 ///
WiredHome 19:3f82c1161fd2 1623 /// @returns font width in pixels.
WiredHome 19:3f82c1161fd2 1624 ///
WiredHome 37:f19b7e7449dc 1625 dim_t fontwidth(void);
WiredHome 19:3f82c1161fd2 1626
WiredHome 125:7a0b70f56550 1627
WiredHome 19:3f82c1161fd2 1628 /// get the height in pixels of the currently active font
WiredHome 19:3f82c1161fd2 1629 ///
WiredHome 19:3f82c1161fd2 1630 /// @returns font height in pixels.
WiredHome 19:3f82c1161fd2 1631 ///
WiredHome 37:f19b7e7449dc 1632 dim_t fontheight(void);
WiredHome 125:7a0b70f56550 1633
WiredHome 19:3f82c1161fd2 1634
WiredHome 19:3f82c1161fd2 1635 /// get the number of colums based on the currently active font
WiredHome 19:3f82c1161fd2 1636 ///
WiredHome 19:3f82c1161fd2 1637 /// @returns number of columns.
WiredHome 19:3f82c1161fd2 1638 ///
WiredHome 19:3f82c1161fd2 1639 virtual int columns(void);
WiredHome 19:3f82c1161fd2 1640
WiredHome 125:7a0b70f56550 1641
WiredHome 19:3f82c1161fd2 1642 /// get the number of rows based on the currently active font
WiredHome 19:3f82c1161fd2 1643 ///
WiredHome 19:3f82c1161fd2 1644 /// @returns number of rows.
WiredHome 19:3f82c1161fd2 1645 ///
WiredHome 19:3f82c1161fd2 1646 virtual int rows(void);
WiredHome 19:3f82c1161fd2 1647
WiredHome 125:7a0b70f56550 1648
WiredHome 19:3f82c1161fd2 1649 /// get the screen width in pixels
WiredHome 19:3f82c1161fd2 1650 ///
WiredHome 19:3f82c1161fd2 1651 /// @returns screen width in pixels.
WiredHome 19:3f82c1161fd2 1652 ///
WiredHome 38:38d503b4fad6 1653 virtual dim_t width(void);
WiredHome 19:3f82c1161fd2 1654
WiredHome 125:7a0b70f56550 1655
WiredHome 19:3f82c1161fd2 1656 /// get the screen height in pixels
WiredHome 19:3f82c1161fd2 1657 ///
WiredHome 19:3f82c1161fd2 1658 /// @returns screen height in pixels.
WiredHome 19:3f82c1161fd2 1659 ///
WiredHome 38:38d503b4fad6 1660 virtual dim_t height(void);
WiredHome 19:3f82c1161fd2 1661
WiredHome 125:7a0b70f56550 1662
WiredHome 43:3becae133285 1663 /// get the color depth in bits per pixel.
WiredHome 43:3becae133285 1664 ///
WiredHome 43:3becae133285 1665 /// @returns 8 or 16 only.
WiredHome 43:3becae133285 1666 ///
WiredHome 43:3becae133285 1667 virtual dim_t color_bpp(void);
WiredHome 43:3becae133285 1668
WiredHome 19:3f82c1161fd2 1669 /// Set cursor position based on the current font size.
WiredHome 19:3f82c1161fd2 1670 ///
WiredHome 72:ecffe56af969 1671 /// @param[in] column is the horizontal position in character positions
WiredHome 72:ecffe56af969 1672 /// @param[in] row is the vertical position in character positions
WiredHome 167:8aa3fb2a5a31 1673 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 1674 ///
WiredHome 37:f19b7e7449dc 1675 virtual RetCode_t locate(textloc_t column, textloc_t row);
WiredHome 19:3f82c1161fd2 1676
WiredHome 125:7a0b70f56550 1677
WiredHome 19:3f82c1161fd2 1678 /// Prepare the controller to write text to the screen by positioning
WiredHome 19:3f82c1161fd2 1679 /// the cursor.
WiredHome 19:3f82c1161fd2 1680 ///
WiredHome 56:7a85d226ad0d 1681 /// @code
WiredHome 56:7a85d226ad0d 1682 /// lcd.SetTextCursor(100, 25);
WiredHome 56:7a85d226ad0d 1683 /// lcd.puts("Hello");
WiredHome 56:7a85d226ad0d 1684 /// @endcode
WiredHome 56:7a85d226ad0d 1685 ///
WiredHome 72:ecffe56af969 1686 /// @param[in] x is the horizontal position in pixels (from the left edge)
WiredHome 72:ecffe56af969 1687 /// @param[in] y is the vertical position in pixels (from the top edge)
WiredHome 167:8aa3fb2a5a31 1688 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 1689 ///
WiredHome 37:f19b7e7449dc 1690 RetCode_t SetTextCursor(loc_t x, loc_t y);
WiredHome 29:422616aa04bd 1691
WiredHome 125:7a0b70f56550 1692
WiredHome 103:7e0464ca6c5c 1693 /// Prepare the controller to write text to the screen by positioning
WiredHome 103:7e0464ca6c5c 1694 /// the cursor.
WiredHome 103:7e0464ca6c5c 1695 ///
WiredHome 103:7e0464ca6c5c 1696 /// @code
WiredHome 103:7e0464ca6c5c 1697 /// point_t point = {100, 25};
WiredHome 103:7e0464ca6c5c 1698 /// lcd.SetTextCursor(point);
WiredHome 103:7e0464ca6c5c 1699 /// lcd.puts("Hello");
WiredHome 103:7e0464ca6c5c 1700 /// @endcode
WiredHome 103:7e0464ca6c5c 1701 ///
WiredHome 103:7e0464ca6c5c 1702 /// @param[in] p is the x:y point in pixels from the top-left.
WiredHome 167:8aa3fb2a5a31 1703 /// @returns @ref RetCode_t value.
WiredHome 103:7e0464ca6c5c 1704 ///
WiredHome 103:7e0464ca6c5c 1705 RetCode_t SetTextCursor(point_t p);
WiredHome 103:7e0464ca6c5c 1706
WiredHome 125:7a0b70f56550 1707
WiredHome 37:f19b7e7449dc 1708 /// Get the current cursor position in pixels.
WiredHome 37:f19b7e7449dc 1709 ///
WiredHome 56:7a85d226ad0d 1710 /// @code
WiredHome 56:7a85d226ad0d 1711 /// point_t point = GetTextCursor();
WiredHome 56:7a85d226ad0d 1712 /// if (point.x > 100 && point.y > 150)
WiredHome 56:7a85d226ad0d 1713 /// //...
WiredHome 56:7a85d226ad0d 1714 /// @endcode
WiredHome 56:7a85d226ad0d 1715 ///
WiredHome 37:f19b7e7449dc 1716 /// @returns cursor position.
WiredHome 37:f19b7e7449dc 1717 ///
WiredHome 37:f19b7e7449dc 1718 point_t GetTextCursor(void);
WiredHome 37:f19b7e7449dc 1719
WiredHome 125:7a0b70f56550 1720
WiredHome 29:422616aa04bd 1721 /// Get the current cursor horizontal position in pixels.
WiredHome 29:422616aa04bd 1722 ///
WiredHome 29:422616aa04bd 1723 /// @returns cursor position horizontal offset.
WiredHome 29:422616aa04bd 1724 ///
WiredHome 37:f19b7e7449dc 1725 loc_t GetTextCursor_X(void);
WiredHome 29:422616aa04bd 1726
WiredHome 125:7a0b70f56550 1727
WiredHome 29:422616aa04bd 1728 /// Get the current cursor vertical position in pixels.
WiredHome 29:422616aa04bd 1729 ///
WiredHome 29:422616aa04bd 1730 /// @returns cursor position vertical offset.
WiredHome 29:422616aa04bd 1731 ///
WiredHome 37:f19b7e7449dc 1732 loc_t GetTextCursor_Y(void);
WiredHome 29:422616aa04bd 1733
WiredHome 125:7a0b70f56550 1734
WiredHome 23:a50ded45dbaf 1735 /// Configure additional Cursor Control settings.
WiredHome 23:a50ded45dbaf 1736 ///
WiredHome 23:a50ded45dbaf 1737 /// This API lets you modify other cursor control settings;
WiredHome 23:a50ded45dbaf 1738 /// Cursor visible/hidden, Cursor blink/normal,
WiredHome 23:a50ded45dbaf 1739 /// Cursor I-Beam/underscore/box.
WiredHome 23:a50ded45dbaf 1740 ///
WiredHome 72:ecffe56af969 1741 /// @param[in] cursor can be set to NOCURSOR (default), IBEAM,
WiredHome 24:8ca861acf12d 1742 /// UNDER, or BLOCK.
WiredHome 72:ecffe56af969 1743 /// @param[in] blink can be set to true or false (default false)
WiredHome 167:8aa3fb2a5a31 1744 /// @returns @ref RetCode_t value.
WiredHome 23:a50ded45dbaf 1745 ///
WiredHome 24:8ca861acf12d 1746 RetCode_t SetTextCursorControl(cursor_t cursor = NOCURSOR, bool blink = false);
WiredHome 125:7a0b70f56550 1747
WiredHome 23:a50ded45dbaf 1748
WiredHome 98:ecebed9b80b2 1749 /// Select the built-in ISO 8859-X font to use next.
WiredHome 19:3f82c1161fd2 1750 ///
WiredHome 19:3f82c1161fd2 1751 /// Supported fonts: ISO 8859-1, -2, -3, -4
WiredHome 19:3f82c1161fd2 1752 ///
WiredHome 125:7a0b70f56550 1753 /// @note This only modifies the choice of font from the RA8875 internal
WiredHome 98:ecebed9b80b2 1754 /// fonts.
WiredHome 98:ecebed9b80b2 1755 ///
WiredHome 72:ecffe56af969 1756 /// @param[in] font selects the font for the subsequent text rendering.
WiredHome 19:3f82c1161fd2 1757 ///
WiredHome 19:3f82c1161fd2 1758 /// @note if either hScale or vScale is outside of its permitted range,
WiredHome 19:3f82c1161fd2 1759 /// the command is not executed.
WiredHome 167:8aa3fb2a5a31 1760 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 1761 ///
WiredHome 19:3f82c1161fd2 1762 RetCode_t SetTextFont(font_t font = ISO8859_1);
WiredHome 19:3f82c1161fd2 1763
WiredHome 125:7a0b70f56550 1764
WiredHome 84:e102021864b5 1765 /// Sets the display orientation.
WiredHome 84:e102021864b5 1766 ///
WiredHome 84:e102021864b5 1767 /// @note This command does not let you "merge" text onto an existing
WiredHome 84:e102021864b5 1768 /// image, since it reuses the memory for the new orientation.
WiredHome 84:e102021864b5 1769 /// Therefore, it is recommended that you issue a cls() prior
WiredHome 84:e102021864b5 1770 /// to sending text to the screen, or you end with a blended
WiredHome 84:e102021864b5 1771 /// image that is probably not as intended.
WiredHome 84:e102021864b5 1772 ///
WiredHome 125:7a0b70f56550 1773 /// @note This command only operates on the RA8875 internal fonts.
WiredHome 98:ecebed9b80b2 1774 ///
WiredHome 84:e102021864b5 1775 /// @code
WiredHome 84:e102021864b5 1776 /// lcd.cls();
WiredHome 84:e102021864b5 1777 /// lcd.SetOrientation(RA8875::normal);
WiredHome 84:e102021864b5 1778 /// lcd.puts(30,30, "Normal Landscape");
WiredHome 84:e102021864b5 1779 /// wait_ms(2500);
WiredHome 84:e102021864b5 1780 ///
WiredHome 84:e102021864b5 1781 /// lcd.cls();
WiredHome 84:e102021864b5 1782 /// lcd.SetOrientation(RA8875::rotate_90);
WiredHome 84:e102021864b5 1783 /// lcd.puts(30,30, "Rotated 90 Text\r\n");
WiredHome 84:e102021864b5 1784 /// wait_ms(2500);
WiredHome 84:e102021864b5 1785 ///
WiredHome 84:e102021864b5 1786 /// lcd.cls();
WiredHome 84:e102021864b5 1787 /// lcd.SetOrientation(RA8875::rotate_180);
WiredHome 84:e102021864b5 1788 /// lcd.puts(30,30, "Rotated 180 Text\r\n");
WiredHome 84:e102021864b5 1789 /// wait_ms(2500);
WiredHome 84:e102021864b5 1790 ///
WiredHome 84:e102021864b5 1791 /// lcd.cls();
WiredHome 84:e102021864b5 1792 /// lcd.SetOrientation(RA8875::rotate_270);
WiredHome 84:e102021864b5 1793 /// lcd.puts(30,30, "Rotated 270 Text\r\n");
WiredHome 84:e102021864b5 1794 /// wait_ms(2500);
WiredHome 84:e102021864b5 1795 /// @endcode
WiredHome 84:e102021864b5 1796 ///
WiredHome 84:e102021864b5 1797 /// @param[in] angle defaults to normal, but can be rotated
WiredHome 84:e102021864b5 1798 /// - normal | rotate_0
WiredHome 84:e102021864b5 1799 /// - rotate_90 (clockwise)
WiredHome 84:e102021864b5 1800 /// - rotate_180
WiredHome 84:e102021864b5 1801 /// - rotate_270 (clockwise)
WiredHome 167:8aa3fb2a5a31 1802 /// @returns @ref RetCode_t value.
WiredHome 84:e102021864b5 1803 ///
WiredHome 84:e102021864b5 1804 RetCode_t SetOrientation(orientation_t angle = normal);
WiredHome 84:e102021864b5 1805
WiredHome 125:7a0b70f56550 1806
WiredHome 19:3f82c1161fd2 1807 /// Control the font behavior.
WiredHome 19:3f82c1161fd2 1808 ///
WiredHome 19:3f82c1161fd2 1809 /// This command lets you make several modifications to any text that
WiredHome 56:7a85d226ad0d 1810 /// will be written to the screen.
WiredHome 19:3f82c1161fd2 1811 ///
WiredHome 125:7a0b70f56550 1812 /// @note This command only operates on the RA8875 internal fonts.
WiredHome 98:ecebed9b80b2 1813 ///
WiredHome 19:3f82c1161fd2 1814 /// Options can be combined:
WiredHome 19:3f82c1161fd2 1815 /// Default:
WiredHome 19:3f82c1161fd2 1816 /// @li Full alignment disabled,
WiredHome 19:3f82c1161fd2 1817 /// @li Font with Background color,
WiredHome 84:e102021864b5 1818 /// @li Font in normal orientiation, or rotated 90, 180, or 270 clockwise,
WiredHome 84:e102021864b5 1819 /// @li Horizontal scale x 1, 2, 3, or 4
WiredHome 84:e102021864b5 1820 /// @li Vertical scale x 1, 2, 3, or 4
WiredHome 84:e102021864b5 1821 ///
WiredHome 84:e102021864b5 1822 /// @note alignment is a special mode for the fonts, when mixing half and
WiredHome 84:e102021864b5 1823 /// full fonts on one presentation. 'align_full' starts each full
WiredHome 84:e102021864b5 1824 /// character on an even alignment. See section 7-4-7 of the RA8875
WiredHome 84:e102021864b5 1825 /// specification.
WiredHome 19:3f82c1161fd2 1826 ///
WiredHome 72:ecffe56af969 1827 /// @param[in] fillit defaults to FILL, but can be NOFILL
WiredHome 72:ecffe56af969 1828 /// @param[in] hScale defaults to 1, but can be 1, 2, 3, or 4,
WiredHome 19:3f82c1161fd2 1829 /// and scales the font size by this amount.
WiredHome 72:ecffe56af969 1830 /// @param[in] vScale defaults to 1, but can be 1, 2, 3, or 4,
WiredHome 19:3f82c1161fd2 1831 /// and scales the font size by this amount.
WiredHome 72:ecffe56af969 1832 /// @param[in] alignment defaults to align_none, but can be
WiredHome 19:3f82c1161fd2 1833 /// align_full.
WiredHome 19:3f82c1161fd2 1834 ///
WiredHome 19:3f82c1161fd2 1835 /// @note if either hScale or vScale is outside of its permitted range,
WiredHome 19:3f82c1161fd2 1836 /// the command is not executed.
WiredHome 167:8aa3fb2a5a31 1837 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 1838 ///
WiredHome 19:3f82c1161fd2 1839 RetCode_t SetTextFontControl(fill_t fillit = FILL,
WiredHome 19:3f82c1161fd2 1840 HorizontalScale hScale = 1,
WiredHome 19:3f82c1161fd2 1841 VerticalScale vScale = 1,
WiredHome 19:3f82c1161fd2 1842 alignment_t alignment = align_none);
WiredHome 19:3f82c1161fd2 1843
WiredHome 125:7a0b70f56550 1844
WiredHome 153:8a85efb3eb71 1845 /// Control the font size of the RA8875 rendered fonts.
WiredHome 19:3f82c1161fd2 1846 ///
WiredHome 19:3f82c1161fd2 1847 /// This command lets you set the font enlargement for both horizontal
WiredHome 19:3f82c1161fd2 1848 /// and vertical, independent of the rotation, background, and
WiredHome 106:c80828f5dea4 1849 /// alignment. See @ref SetTextFontControl.
WiredHome 19:3f82c1161fd2 1850 ///
WiredHome 153:8a85efb3eb71 1851 /// @note This command operates on the RA8875 internal fonts.
WiredHome 153:8a85efb3eb71 1852 /// @note This command also operates on the selected soft font.
WiredHome 98:ecebed9b80b2 1853 ///
WiredHome 72:ecffe56af969 1854 /// @param[in] hScale defaults to 1, but can be 1, 2, 3, or 4,
WiredHome 19:3f82c1161fd2 1855 /// and scales the font size by this amount.
WiredHome 72:ecffe56af969 1856 /// @param[in] vScale is an optional parameter that defaults to the hScale value,
WiredHome 40:04aa280dfa39 1857 /// but can be 1, 2, 3, or 4, and scales the font size by this amount.
WiredHome 40:04aa280dfa39 1858 ///
WiredHome 40:04aa280dfa39 1859 /// @code
WiredHome 40:04aa280dfa39 1860 /// lcd.SetTextFontSize(2); // Set the font to 2x normal size
WiredHome 56:7a85d226ad0d 1861 /// lcd.puts("Two times");
WiredHome 40:04aa280dfa39 1862 /// lcd.SetTextFontSize(2,3); // Set the font to 2x Width and 3x Height
WiredHome 56:7a85d226ad0d 1863 /// lcd.puts("2*2 3*h");
WiredHome 40:04aa280dfa39 1864 /// lcd.SetTextFontSize(); // Restore to normal size in both dimensions
WiredHome 56:7a85d226ad0d 1865 /// lcd.puts("normal");
WiredHome 153:8a85efb3eb71 1866 /// lcd.SelectUserFont(BPG_Arial63x63); // Large user font
WiredHome 153:8a85efb3eb71 1867 /// lcd.puts("B63x63"); // Show a sample
WiredHome 153:8a85efb3eb71 1868 /// lcd.SetTextFontSize(2); // Now twice as big
WiredHome 153:8a85efb3eb71 1869 /// lcd.puts("x2"); // Show a sample
WiredHome 40:04aa280dfa39 1870 /// @endcode
WiredHome 19:3f82c1161fd2 1871 ///
WiredHome 19:3f82c1161fd2 1872 /// @note if either hScale or vScale is outside of its permitted range,
WiredHome 19:3f82c1161fd2 1873 /// the command is not executed.
WiredHome 167:8aa3fb2a5a31 1874 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 1875 ///
WiredHome 40:04aa280dfa39 1876 RetCode_t SetTextFontSize(HorizontalScale hScale = 1, VerticalScale vScale = -1);
WiredHome 127:db7f2c704693 1877
WiredHome 127:db7f2c704693 1878
WiredHome 127:db7f2c704693 1879 /// Get the text font size of the RA8875 internal fonts.
WiredHome 127:db7f2c704693 1880 ///
WiredHome 127:db7f2c704693 1881 /// This command lets you retrieve the current settings for the font
WiredHome 127:db7f2c704693 1882 /// horizontal and vertical scale factors. The return value is
WiredHome 127:db7f2c704693 1883 /// one of the scale factors 1, 2, 3, or 4.
WiredHome 127:db7f2c704693 1884 ///
WiredHome 127:db7f2c704693 1885 /// @param[out] hScale is a pointer to memory where the horizontal scale factor
WiredHome 127:db7f2c704693 1886 /// will be written. If the pointer is null, that item will be ignored.
WiredHome 127:db7f2c704693 1887 /// @param[out] vScale is a pointer to memory where the vertical scale factor
WiredHome 127:db7f2c704693 1888 /// will be written. If the pointer is null, that item will be ignored.
WiredHome 167:8aa3fb2a5a31 1889 /// @returns @ref RetCode_t value.
WiredHome 127:db7f2c704693 1890 ///
WiredHome 127:db7f2c704693 1891 RetCode_t GetTextFontSize(HorizontalScale * hScale, VerticalScale * vScale);
WiredHome 125:7a0b70f56550 1892
WiredHome 19:3f82c1161fd2 1893 /// put a character on the screen.
WiredHome 19:3f82c1161fd2 1894 ///
WiredHome 72:ecffe56af969 1895 /// @param[in] c is the character.
WiredHome 19:3f82c1161fd2 1896 /// @returns the character, or EOF if there is an error.
WiredHome 19:3f82c1161fd2 1897 ///
WiredHome 19:3f82c1161fd2 1898 virtual int _putc(int c);
WiredHome 19:3f82c1161fd2 1899
WiredHome 125:7a0b70f56550 1900
WiredHome 19:3f82c1161fd2 1901 /// Write string of text to the display
WiredHome 19:3f82c1161fd2 1902 ///
WiredHome 56:7a85d226ad0d 1903 /// @code
WiredHome 56:7a85d226ad0d 1904 /// lcd.puts("Test STring");
WiredHome 56:7a85d226ad0d 1905 /// @endcode
WiredHome 56:7a85d226ad0d 1906 ///
WiredHome 72:ecffe56af969 1907 /// @param[in] string is the null terminated string to send to the display.
WiredHome 19:3f82c1161fd2 1908 ///
WiredHome 19:3f82c1161fd2 1909 void puts(const char * string);
WiredHome 125:7a0b70f56550 1910
WiredHome 19:3f82c1161fd2 1911
WiredHome 19:3f82c1161fd2 1912 /// Write string of text to the display at the specified location.
WiredHome 19:3f82c1161fd2 1913 ///
WiredHome 56:7a85d226ad0d 1914 /// @code
WiredHome 56:7a85d226ad0d 1915 /// lcd.puts(10,25, "Test STring");
WiredHome 56:7a85d226ad0d 1916 /// @endcode
WiredHome 56:7a85d226ad0d 1917 ///
WiredHome 72:ecffe56af969 1918 /// @param[in] x is the horizontal position in pixels (from the left edge)
WiredHome 72:ecffe56af969 1919 /// @param[in] y is the vertical position in pixels (from the top edge)
WiredHome 72:ecffe56af969 1920 /// @param[in] string is the null terminated string to send to the display.
WiredHome 19:3f82c1161fd2 1921 ///
WiredHome 37:f19b7e7449dc 1922 void puts(loc_t x, loc_t y, const char * string);
WiredHome 19:3f82c1161fd2 1923
WiredHome 125:7a0b70f56550 1924
WiredHome 19:3f82c1161fd2 1925 /// Prepare the controller to write binary data to the screen by positioning
WiredHome 19:3f82c1161fd2 1926 /// the memory cursor.
WiredHome 19:3f82c1161fd2 1927 ///
WiredHome 72:ecffe56af969 1928 /// @param[in] x is the horizontal position in pixels (from the left edge)
WiredHome 72:ecffe56af969 1929 /// @param[in] y is the vertical position in pixels (from the top edge)
WiredHome 167:8aa3fb2a5a31 1930 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 1931 ///
WiredHome 37:f19b7e7449dc 1932 virtual RetCode_t SetGraphicsCursor(loc_t x, loc_t y);
WiredHome 125:7a0b70f56550 1933
WiredHome 136:224e03d5c31f 1934 /// Prepare the controller to write binary data to the screen by positioning
WiredHome 136:224e03d5c31f 1935 /// the memory cursor.
WiredHome 136:224e03d5c31f 1936 ///
WiredHome 136:224e03d5c31f 1937 /// @param[in] p is the point representing the cursor position to set
WiredHome 167:8aa3fb2a5a31 1938 /// @returns @ref RetCode_t value.
WiredHome 136:224e03d5c31f 1939 ///
WiredHome 136:224e03d5c31f 1940 virtual RetCode_t SetGraphicsCursor(point_t p);
WiredHome 136:224e03d5c31f 1941
WiredHome 136:224e03d5c31f 1942 /// Read the current graphics cursor position as a point.
WiredHome 136:224e03d5c31f 1943 ///
WiredHome 136:224e03d5c31f 1944 /// @returns the graphics cursor as a point.
WiredHome 136:224e03d5c31f 1945 ///
WiredHome 136:224e03d5c31f 1946 virtual point_t GetGraphicsCursor(void);
WiredHome 136:224e03d5c31f 1947
WiredHome 19:3f82c1161fd2 1948
WiredHome 41:2956a0a221e5 1949 /// Prepare the controller to read binary data from the screen by positioning
WiredHome 41:2956a0a221e5 1950 /// the memory read cursor.
WiredHome 41:2956a0a221e5 1951 ///
WiredHome 72:ecffe56af969 1952 /// @param[in] x is the horizontal position in pixels (from the left edge)
WiredHome 72:ecffe56af969 1953 /// @param[in] y is the vertical position in pixels (from the top edge)
WiredHome 167:8aa3fb2a5a31 1954 /// @returns @ref RetCode_t value.
WiredHome 41:2956a0a221e5 1955 ///
WiredHome 41:2956a0a221e5 1956 virtual RetCode_t SetGraphicsCursorRead(loc_t x, loc_t y);
WiredHome 41:2956a0a221e5 1957
WiredHome 125:7a0b70f56550 1958
WiredHome 111:efe436c43aba 1959 /// Set the window, constraining where items are written to the screen.
WiredHome 111:efe436c43aba 1960 ///
WiredHome 111:efe436c43aba 1961 /// After setting the window, text and graphics are constrained to this
WiredHome 111:efe436c43aba 1962 /// window. Text will wrap from the right edge back to the left and down
WiredHome 111:efe436c43aba 1963 /// one row and from the bottom to the top. Graphics drawing will be clipped
WiredHome 111:efe436c43aba 1964 /// at the edge of the window.
WiredHome 111:efe436c43aba 1965 ///
WiredHome 111:efe436c43aba 1966 /// @note If the initial text write is outside the window, it will be shown
WiredHome 111:efe436c43aba 1967 /// where the cursor position it. Once the write hits the right edge of
WiredHome 111:efe436c43aba 1968 /// the defined window, it will then wrap back to the left edge. Once it
WiredHome 111:efe436c43aba 1969 /// hits the bottom, it wraps to the top of the window. For this reason,
WiredHome 111:efe436c43aba 1970 /// it is common to set the text cursor to the window.
WiredHome 19:3f82c1161fd2 1971 ///
WiredHome 111:efe436c43aba 1972 /// @code
WiredHome 111:efe436c43aba 1973 /// rect_t r = {10,10, 90,90};
WiredHome 111:efe436c43aba 1974 /// lcd.window(r);
WiredHome 111:efe436c43aba 1975 /// lcd.SetTextCursor(r.p1.x, r.p1.y);
WiredHome 111:efe436c43aba 1976 /// lcd.puts("012345678901234567890123456789012345678901234567890");
WiredHome 111:efe436c43aba 1977 /// lcd.window(); restore to full screen
WiredHome 111:efe436c43aba 1978 /// @endcode
WiredHome 111:efe436c43aba 1979 ///
WiredHome 111:efe436c43aba 1980 /// @param[in] r is the rect_t used to set the window.
WiredHome 167:8aa3fb2a5a31 1981 /// @returns @ref RetCode_t value.
WiredHome 111:efe436c43aba 1982 ///
WiredHome 111:efe436c43aba 1983 virtual RetCode_t window(rect_t r);
WiredHome 111:efe436c43aba 1984
WiredHome 125:7a0b70f56550 1985
WiredHome 111:efe436c43aba 1986 /// Set the window, constraining where items are written to the screen.
WiredHome 111:efe436c43aba 1987 ///
WiredHome 111:efe436c43aba 1988 /// After setting the window, text and graphics are constrained to this
WiredHome 111:efe436c43aba 1989 /// window. Text will wrap from the right edge back to the left and down
WiredHome 111:efe436c43aba 1990 /// one row and from the bottom to the top. Graphics drawing will be clipped
WiredHome 111:efe436c43aba 1991 /// at the edge of the window.
WiredHome 111:efe436c43aba 1992 ///
WiredHome 114:dbfb996bfbf3 1993 /// @note if no parameters are provided, it restores the window to full screen.
WiredHome 114:dbfb996bfbf3 1994 ///
WiredHome 111:efe436c43aba 1995 /// @note If the initial text write is outside the window, it will be shown
WiredHome 111:efe436c43aba 1996 /// where the cursor position it. Once the write hits the right edge of
WiredHome 111:efe436c43aba 1997 /// the defined window, it will then wrap back to the left edge. Once it
WiredHome 111:efe436c43aba 1998 /// hits the bottom, it wraps to the top of the window. For this reason,
WiredHome 111:efe436c43aba 1999 /// it is common to set the text cursor to the window.
WiredHome 19:3f82c1161fd2 2000 ///
WiredHome 56:7a85d226ad0d 2001 /// @code
WiredHome 56:7a85d226ad0d 2002 /// lcd.window(10,10, 80,80);
WiredHome 111:efe436c43aba 2003 /// lcd.SetTextCursor(10,10);
WiredHome 56:7a85d226ad0d 2004 /// lcd.puts("012345678901234567890123456789012345678901234567890");
WiredHome 111:efe436c43aba 2005 /// lcd.window(); restore to full screen
WiredHome 56:7a85d226ad0d 2006 /// @endcode
WiredHome 56:7a85d226ad0d 2007 ///
WiredHome 72:ecffe56af969 2008 /// @param[in] x is the left edge in pixels.
WiredHome 72:ecffe56af969 2009 /// @param[in] y is the top edge in pixels.
WiredHome 72:ecffe56af969 2010 /// @param[in] width is the window width in pixels.
WiredHome 72:ecffe56af969 2011 /// @param[in] height is the window height in pixels.
WiredHome 167:8aa3fb2a5a31 2012 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2013 ///
WiredHome 111:efe436c43aba 2014 virtual RetCode_t window(loc_t x = 0, loc_t y = 0, dim_t width = (dim_t)-1, dim_t height = (dim_t)-1);
WiredHome 19:3f82c1161fd2 2015
WiredHome 125:7a0b70f56550 2016
WiredHome 61:8f3153bf0baa 2017 /// Clear either the specified layer, or the active layer.
WiredHome 19:3f82c1161fd2 2018 ///
WiredHome 61:8f3153bf0baa 2019 /// The behavior is to clear the whole screen for the specified
WiredHome 61:8f3153bf0baa 2020 /// layer. When not specified, the active drawing layer is cleared.
WiredHome 61:8f3153bf0baa 2021 /// This command can also be used to specifically clear either,
WiredHome 106:c80828f5dea4 2022 /// or both layers. See @ref clsw().
WiredHome 19:3f82c1161fd2 2023 ///
WiredHome 56:7a85d226ad0d 2024 /// @code
WiredHome 56:7a85d226ad0d 2025 /// lcd.cls();
WiredHome 56:7a85d226ad0d 2026 /// @endcode
WiredHome 56:7a85d226ad0d 2027 ///
WiredHome 72:ecffe56af969 2028 /// @param[in] layers is optional. If not provided, the active layer
WiredHome 61:8f3153bf0baa 2029 /// is cleared. If bit 0 is set, layer 0 is cleared, if bit
WiredHome 61:8f3153bf0baa 2030 /// 1 is set, layer 1 is cleared. If both are set, both layers
WiredHome 61:8f3153bf0baa 2031 /// are cleared. Any other value does not cause an action.
WiredHome 61:8f3153bf0baa 2032 ///
WiredHome 167:8aa3fb2a5a31 2033 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2034 ///
WiredHome 61:8f3153bf0baa 2035 virtual RetCode_t cls(uint16_t layers = 0);
WiredHome 125:7a0b70f56550 2036
WiredHome 19:3f82c1161fd2 2037
WiredHome 19:3f82c1161fd2 2038 /// Clear the screen, or clear only the active window.
WiredHome 19:3f82c1161fd2 2039 ///
WiredHome 19:3f82c1161fd2 2040 /// The default behavior is to clear the whole screen. With the optional
WiredHome 19:3f82c1161fd2 2041 /// parameter, the action can be restricted to the active window, which
WiredHome 106:c80828f5dea4 2042 /// can be set with the See @ref window method.
WiredHome 19:3f82c1161fd2 2043 ///
WiredHome 56:7a85d226ad0d 2044 /// @code
WiredHome 56:7a85d226ad0d 2045 /// lcd.window(20,20, 40,10);
WiredHome 56:7a85d226ad0d 2046 /// lcd.clsw();
WiredHome 56:7a85d226ad0d 2047 /// @endcode
WiredHome 56:7a85d226ad0d 2048 ///
WiredHome 72:ecffe56af969 2049 /// @param[in] region is an optional parameter that defaults to FULLWINDOW
WiredHome 19:3f82c1161fd2 2050 /// or may be set to ACTIVEWINDOW.
WiredHome 167:8aa3fb2a5a31 2051 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2052 ///
WiredHome 19:3f82c1161fd2 2053 RetCode_t clsw(RA8875::Region_t region = FULLWINDOW);
WiredHome 19:3f82c1161fd2 2054
WiredHome 125:7a0b70f56550 2055
WiredHome 19:3f82c1161fd2 2056 /// Set the background color.
WiredHome 19:3f82c1161fd2 2057 ///
WiredHome 72:ecffe56af969 2058 /// @param[in] color is expressed in 16-bit format.
WiredHome 167:8aa3fb2a5a31 2059 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2060 ///
WiredHome 19:3f82c1161fd2 2061 virtual RetCode_t background(color_t color);
WiredHome 125:7a0b70f56550 2062
WiredHome 19:3f82c1161fd2 2063
WiredHome 19:3f82c1161fd2 2064 /// Set the background color.
WiredHome 19:3f82c1161fd2 2065 ///
WiredHome 72:ecffe56af969 2066 /// @param[in] r is the red element of the color.
WiredHome 72:ecffe56af969 2067 /// @param[in] g is the green element of the color.
WiredHome 72:ecffe56af969 2068 /// @param[in] b is the blue element of the color.
WiredHome 167:8aa3fb2a5a31 2069 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2070 ///
WiredHome 19:3f82c1161fd2 2071 virtual RetCode_t background(unsigned char r, unsigned char g, unsigned char b);
WiredHome 19:3f82c1161fd2 2072
WiredHome 125:7a0b70f56550 2073
WiredHome 19:3f82c1161fd2 2074 /// Set the foreground color.
WiredHome 19:3f82c1161fd2 2075 ///
WiredHome 72:ecffe56af969 2076 /// @param[in] color is expressed in 16-bit format.
WiredHome 167:8aa3fb2a5a31 2077 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2078 ///
WiredHome 19:3f82c1161fd2 2079 virtual RetCode_t foreground(color_t color);
WiredHome 19:3f82c1161fd2 2080
WiredHome 125:7a0b70f56550 2081
WiredHome 19:3f82c1161fd2 2082 /// Set the foreground color.
WiredHome 19:3f82c1161fd2 2083 ///
WiredHome 72:ecffe56af969 2084 /// @param[in] r is the red element of the color.
WiredHome 72:ecffe56af969 2085 /// @param[in] g is the green element of the color.
WiredHome 72:ecffe56af969 2086 /// @param[in] b is the blue element of the color.
WiredHome 167:8aa3fb2a5a31 2087 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2088 ///
WiredHome 37:f19b7e7449dc 2089 virtual RetCode_t foreground(unsigned char r, unsigned char g, unsigned char b);
WiredHome 19:3f82c1161fd2 2090
WiredHome 125:7a0b70f56550 2091
WiredHome 19:3f82c1161fd2 2092 /// Get the current foreground color value.
WiredHome 19:3f82c1161fd2 2093 ///
WiredHome 167:8aa3fb2a5a31 2094 /// @returns the current foreground color as @ref color_t.
WiredHome 19:3f82c1161fd2 2095 ///
WiredHome 37:f19b7e7449dc 2096 color_t GetForeColor(void);
WiredHome 87:ee2240581aa7 2097
WiredHome 125:7a0b70f56550 2098
WiredHome 87:ee2240581aa7 2099 /// Draw a pixel in the specified color.
WiredHome 87:ee2240581aa7 2100 ///
WiredHome 87:ee2240581aa7 2101 /// @note Unlike many other operations, this does not
WiredHome 87:ee2240581aa7 2102 /// set the forecolor!
WiredHome 87:ee2240581aa7 2103 ///
WiredHome 87:ee2240581aa7 2104 /// @param[in] p is the point_t defining the location.
WiredHome 167:8aa3fb2a5a31 2105 /// @param[in] color is expressed in 16-bit format.
WiredHome 167:8aa3fb2a5a31 2106 /// @returns @ref RetCode_t value.
WiredHome 87:ee2240581aa7 2107 ///
WiredHome 87:ee2240581aa7 2108 virtual RetCode_t pixel(point_t p, color_t color);
WiredHome 87:ee2240581aa7 2109
WiredHome 125:7a0b70f56550 2110
WiredHome 87:ee2240581aa7 2111 /// Draw a pixel in the current foreground color.
WiredHome 87:ee2240581aa7 2112 ///
WiredHome 87:ee2240581aa7 2113 /// @param[in] p is the point_t defining the location.
WiredHome 167:8aa3fb2a5a31 2114 /// @returns @ref RetCode_t value.
WiredHome 87:ee2240581aa7 2115 ///
WiredHome 87:ee2240581aa7 2116 virtual RetCode_t pixel(point_t p);
WiredHome 125:7a0b70f56550 2117
WiredHome 19:3f82c1161fd2 2118
WiredHome 19:3f82c1161fd2 2119 /// Draw a pixel in the specified color.
WiredHome 19:3f82c1161fd2 2120 ///
WiredHome 41:2956a0a221e5 2121 /// @note Unlike many other operations, this does not
WiredHome 41:2956a0a221e5 2122 /// set the forecolor!
WiredHome 19:3f82c1161fd2 2123 ///
WiredHome 72:ecffe56af969 2124 /// @param[in] x is the horizontal offset to this pixel.
WiredHome 72:ecffe56af969 2125 /// @param[in] y is the vertical offset to this pixel.
WiredHome 72:ecffe56af969 2126 /// @param[in] color defines the color for the pixel.
WiredHome 167:8aa3fb2a5a31 2127 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2128 ///
WiredHome 37:f19b7e7449dc 2129 virtual RetCode_t pixel(loc_t x, loc_t y, color_t color);
WiredHome 19:3f82c1161fd2 2130
WiredHome 125:7a0b70f56550 2131
WiredHome 19:3f82c1161fd2 2132 /// Draw a pixel in the current foreground color.
WiredHome 19:3f82c1161fd2 2133 ///
WiredHome 72:ecffe56af969 2134 /// @param[in] x is the horizontal offset to this pixel.
WiredHome 72:ecffe56af969 2135 /// @param[in] y is the veritical offset to this pixel.
WiredHome 167:8aa3fb2a5a31 2136 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2137 ///
WiredHome 37:f19b7e7449dc 2138 virtual RetCode_t pixel(loc_t x, loc_t y);
WiredHome 19:3f82c1161fd2 2139
WiredHome 125:7a0b70f56550 2140
WiredHome 41:2956a0a221e5 2141 /// Get a pixel from the display.
WiredHome 41:2956a0a221e5 2142 ///
WiredHome 72:ecffe56af969 2143 /// @param[in] x is the horizontal offset to this pixel.
WiredHome 72:ecffe56af969 2144 /// @param[in] y is the vertical offset to this pixel.
WiredHome 167:8aa3fb2a5a31 2145 /// @returns the pixel. See @ref color_t
WiredHome 41:2956a0a221e5 2146 ///
WiredHome 41:2956a0a221e5 2147 virtual color_t getPixel(loc_t x, loc_t y);
WiredHome 41:2956a0a221e5 2148
WiredHome 125:7a0b70f56550 2149
WiredHome 136:224e03d5c31f 2150 /// Write an RGB565 stream of pixels to the display.
WiredHome 41:2956a0a221e5 2151 ///
WiredHome 72:ecffe56af969 2152 /// @param[in] p is a pointer to a color_t array to write.
WiredHome 72:ecffe56af969 2153 /// @param[in] count is the number of pixels to write.
WiredHome 72:ecffe56af969 2154 /// @param[in] x is the horizontal position on the display.
WiredHome 72:ecffe56af969 2155 /// @param[in] y is the vertical position on the display.
WiredHome 167:8aa3fb2a5a31 2156 /// @returns @ref RetCode_t value.
WiredHome 41:2956a0a221e5 2157 ///
WiredHome 41:2956a0a221e5 2158 virtual RetCode_t pixelStream(color_t * p, uint32_t count, loc_t x, loc_t y);
WiredHome 41:2956a0a221e5 2159
WiredHome 125:7a0b70f56550 2160
WiredHome 41:2956a0a221e5 2161 /// Get a stream of pixels from the display.
WiredHome 41:2956a0a221e5 2162 ///
WiredHome 72:ecffe56af969 2163 /// @param[in] p is a pointer to a color_t array to accept the stream.
WiredHome 72:ecffe56af969 2164 /// @param[in] count is the number of pixels to read.
WiredHome 72:ecffe56af969 2165 /// @param[in] x is the horizontal offset to this pixel.
WiredHome 72:ecffe56af969 2166 /// @param[in] y is the vertical offset to this pixel.
WiredHome 167:8aa3fb2a5a31 2167 /// @returns @ref RetCode_t value.
WiredHome 41:2956a0a221e5 2168 ///
WiredHome 41:2956a0a221e5 2169 virtual RetCode_t getPixelStream(color_t * p, uint32_t count, loc_t x, loc_t y);
WiredHome 131:5bd6ba2ee4a1 2170
WiredHome 131:5bd6ba2ee4a1 2171
WiredHome 109:7b94f06f085b 2172 /// Write a boolean stream to the display.
WiredHome 109:7b94f06f085b 2173 ///
WiredHome 109:7b94f06f085b 2174 /// This takes a bit stream in memory and using the current color settings
WiredHome 109:7b94f06f085b 2175 /// it will stream it to the display. Along the way, each bit is translated
WiredHome 109:7b94f06f085b 2176 /// to either the foreground or background color value and then that pixel
WiredHome 109:7b94f06f085b 2177 /// is pushed onward.
WiredHome 109:7b94f06f085b 2178 ///
WiredHome 109:7b94f06f085b 2179 /// This is similar, but different, to the @ref pixelStream API, which is
WiredHome 109:7b94f06f085b 2180 /// given a stream of color values.
WiredHome 109:7b94f06f085b 2181 ///
WiredHome 153:8a85efb3eb71 2182 /// This is most often used for Soft Fonts, and for that reason, this method
WiredHome 153:8a85efb3eb71 2183 /// will scale the presentation based on the selected font size.
WiredHome 153:8a85efb3eb71 2184 /// See @ref SetTextFontSize, So, users may want to SetTextFontSize(1) for
WiredHome 153:8a85efb3eb71 2185 /// 1:1 scaling.
WiredHome 153:8a85efb3eb71 2186 ///
WiredHome 109:7b94f06f085b 2187 /// @param[in] x is the horizontal position on the display.
WiredHome 109:7b94f06f085b 2188 /// @param[in] y is the vertical position on the display.
WiredHome 109:7b94f06f085b 2189 /// @param[in] w is the width of the rectangular region to fill.
WiredHome 109:7b94f06f085b 2190 /// @param[in] h is the height of the rectangular region to fill.
WiredHome 109:7b94f06f085b 2191 /// @param[in] boolStream is the inline memory image from which to extract
WiredHome 109:7b94f06f085b 2192 /// the bitstream.
WiredHome 167:8aa3fb2a5a31 2193 /// @returns @ref RetCode_t value.
WiredHome 109:7b94f06f085b 2194 ///
WiredHome 109:7b94f06f085b 2195 virtual RetCode_t booleanStream(loc_t x, loc_t y, dim_t w, dim_t h, const uint8_t * boolStream);
WiredHome 125:7a0b70f56550 2196
WiredHome 109:7b94f06f085b 2197
WiredHome 19:3f82c1161fd2 2198 /// Draw a line in the specified color
WiredHome 19:3f82c1161fd2 2199 ///
WiredHome 19:3f82c1161fd2 2200 /// @note As a side effect, this changes the current
WiredHome 19:3f82c1161fd2 2201 /// foreground color for subsequent operations.
WiredHome 19:3f82c1161fd2 2202 ///
WiredHome 83:7bad0068cca0 2203 /// @param[in] p1 is the point to start the line.
WiredHome 83:7bad0068cca0 2204 /// @param[in] p2 is the point to end the line.
WiredHome 83:7bad0068cca0 2205 /// @param[in] color defines the foreground color.
WiredHome 167:8aa3fb2a5a31 2206 /// @returns @ref RetCode_t value.
WiredHome 83:7bad0068cca0 2207 ///
WiredHome 83:7bad0068cca0 2208 RetCode_t line(point_t p1, point_t p2, color_t color);
WiredHome 83:7bad0068cca0 2209
WiredHome 125:7a0b70f56550 2210
WiredHome 83:7bad0068cca0 2211 /// Draw a line
WiredHome 83:7bad0068cca0 2212 ///
WiredHome 83:7bad0068cca0 2213 /// Draws a line using the foreground color setting.
WiredHome 83:7bad0068cca0 2214 ///
WiredHome 83:7bad0068cca0 2215 /// @param[in] p1 is the point to start the line.
WiredHome 83:7bad0068cca0 2216 /// @param[in] p2 is the point to end the line.
WiredHome 167:8aa3fb2a5a31 2217 /// @returns @ref RetCode_t value.
WiredHome 83:7bad0068cca0 2218 ///
WiredHome 83:7bad0068cca0 2219 RetCode_t line(point_t p1, point_t p2);
WiredHome 125:7a0b70f56550 2220
WiredHome 83:7bad0068cca0 2221
WiredHome 83:7bad0068cca0 2222 /// Draw a line in the specified color
WiredHome 83:7bad0068cca0 2223 ///
WiredHome 83:7bad0068cca0 2224 /// @note As a side effect, this changes the current
WiredHome 83:7bad0068cca0 2225 /// foreground color for subsequent operations.
WiredHome 83:7bad0068cca0 2226 ///
WiredHome 72:ecffe56af969 2227 /// @param[in] x1 is the horizontal start of the line.
WiredHome 72:ecffe56af969 2228 /// @param[in] y1 is the vertical start of the line.
WiredHome 72:ecffe56af969 2229 /// @param[in] x2 is the horizontal end of the line.
WiredHome 72:ecffe56af969 2230 /// @param[in] y2 is the vertical end of the line.
WiredHome 72:ecffe56af969 2231 /// @param[in] color defines the foreground color.
WiredHome 167:8aa3fb2a5a31 2232 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2233 ///
WiredHome 56:7a85d226ad0d 2234 RetCode_t line(loc_t x1, loc_t y1, loc_t x2, loc_t y2, color_t color);
WiredHome 19:3f82c1161fd2 2235
WiredHome 125:7a0b70f56550 2236
WiredHome 19:3f82c1161fd2 2237 /// Draw a line
WiredHome 19:3f82c1161fd2 2238 ///
WiredHome 19:3f82c1161fd2 2239 /// Draws a line using the foreground color setting.
WiredHome 19:3f82c1161fd2 2240 ///
WiredHome 72:ecffe56af969 2241 /// @param[in] x1 is the horizontal start of the line.
WiredHome 72:ecffe56af969 2242 /// @param[in] y1 is the vertical start of the line.
WiredHome 72:ecffe56af969 2243 /// @param[in] x2 is the horizontal end of the line.
WiredHome 72:ecffe56af969 2244 /// @param[in] y2 is the vertical end of the line.
WiredHome 167:8aa3fb2a5a31 2245 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2246 ///
WiredHome 37:f19b7e7449dc 2247 RetCode_t line(loc_t x1, loc_t y1, loc_t x2, loc_t y2);
WiredHome 19:3f82c1161fd2 2248
WiredHome 125:7a0b70f56550 2249
WiredHome 144:ba002c4b21b3 2250 /// Draw a thick line
WiredHome 144:ba002c4b21b3 2251 ///
WiredHome 144:ba002c4b21b3 2252 /// Draw a line of a specified thickness and color.
WiredHome 144:ba002c4b21b3 2253 ///
WiredHome 144:ba002c4b21b3 2254 /// In order to draw a thick line, this draws filled circles using
WiredHome 144:ba002c4b21b3 2255 /// bresenham's algorithm to move the center point of the circle.
WiredHome 144:ba002c4b21b3 2256 /// As a result, this is much slower than drawing a 1-pixel line which
WiredHome 144:ba002c4b21b3 2257 /// uses the hardware line drawing algorithm.
WiredHome 144:ba002c4b21b3 2258 ///
WiredHome 144:ba002c4b21b3 2259 /// Drawing multiple parallel lines to create a thick line is faster,
WiredHome 144:ba002c4b21b3 2260 /// however the line drawing was not guaranteed to fill every pixel
WiredHome 144:ba002c4b21b3 2261 /// on the diagonals.
WiredHome 144:ba002c4b21b3 2262 ///
WiredHome 144:ba002c4b21b3 2263 /// @param[in] p1 is the point to start the line.
WiredHome 144:ba002c4b21b3 2264 /// @param[in] p2 is the point to end the line.
WiredHome 144:ba002c4b21b3 2265 /// @param[in] thickness is the line thickness.
WiredHome 144:ba002c4b21b3 2266 /// @param[in] color defines the foreground color.
WiredHome 167:8aa3fb2a5a31 2267 /// @returns @ref RetCode_t value.
WiredHome 144:ba002c4b21b3 2268 ///
WiredHome 144:ba002c4b21b3 2269 RetCode_t ThickLine(point_t p1, point_t p2, dim_t thickness, color_t color);
WiredHome 144:ba002c4b21b3 2270
WiredHome 144:ba002c4b21b3 2271
WiredHome 19:3f82c1161fd2 2272 /// Draw a rectangle in the specified color
WiredHome 19:3f82c1161fd2 2273 ///
WiredHome 19:3f82c1161fd2 2274 /// @note As a side effect, this changes the current
WiredHome 19:3f82c1161fd2 2275 /// foreground color for subsequent operations.
WiredHome 19:3f82c1161fd2 2276 ///
WiredHome 81:01da2e34283d 2277 /// @param[in] rect defines the rectangle.
WiredHome 81:01da2e34283d 2278 /// @param[in] color defines the foreground color.
WiredHome 81:01da2e34283d 2279 /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL.
WiredHome 167:8aa3fb2a5a31 2280 /// @returns @ref RetCode_t value.
WiredHome 81:01da2e34283d 2281 ///
WiredHome 82:f7d300f26540 2282 RetCode_t rect(rect_t rect, color_t color, fill_t fillit = NOFILL);
WiredHome 81:01da2e34283d 2283
WiredHome 125:7a0b70f56550 2284
WiredHome 125:7a0b70f56550 2285 /// Draw a filled rectangle in the specified color
WiredHome 81:01da2e34283d 2286 ///
WiredHome 81:01da2e34283d 2287 /// @note As a side effect, this changes the current
WiredHome 81:01da2e34283d 2288 /// foreground color for subsequent operations.
WiredHome 81:01da2e34283d 2289 ///
WiredHome 81:01da2e34283d 2290 /// @param[in] rect defines the rectangle.
WiredHome 81:01da2e34283d 2291 /// @param[in] color defines the foreground color.
WiredHome 81:01da2e34283d 2292 /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL.
WiredHome 167:8aa3fb2a5a31 2293 /// @returns @ref RetCode_t value.
WiredHome 81:01da2e34283d 2294 ///
WiredHome 81:01da2e34283d 2295 RetCode_t fillrect(rect_t rect, color_t color, fill_t fillit = FILL);
WiredHome 81:01da2e34283d 2296
WiredHome 125:7a0b70f56550 2297
WiredHome 81:01da2e34283d 2298 /// Draw a rectangle in the specified color
WiredHome 81:01da2e34283d 2299 ///
WiredHome 81:01da2e34283d 2300 /// @note As a side effect, this changes the current
WiredHome 81:01da2e34283d 2301 /// foreground color for subsequent operations.
WiredHome 81:01da2e34283d 2302 ///
WiredHome 72:ecffe56af969 2303 /// @param[in] x1 is the horizontal start of the line.
WiredHome 72:ecffe56af969 2304 /// @param[in] y1 is the vertical start of the line.
WiredHome 72:ecffe56af969 2305 /// @param[in] x2 is the horizontal end of the line.
WiredHome 72:ecffe56af969 2306 /// @param[in] y2 is the vertical end of the line.
WiredHome 72:ecffe56af969 2307 /// @param[in] color defines the foreground color.
WiredHome 81:01da2e34283d 2308 /// @param[in] fillit is optional to FILL the rectangle. default is FILL.
WiredHome 167:8aa3fb2a5a31 2309 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2310 ///
WiredHome 37:f19b7e7449dc 2311 RetCode_t rect(loc_t x1, loc_t y1, loc_t x2, loc_t y2,
WiredHome 19:3f82c1161fd2 2312 color_t color, fill_t fillit = NOFILL);
WiredHome 19:3f82c1161fd2 2313
WiredHome 125:7a0b70f56550 2314
WiredHome 19:3f82c1161fd2 2315 /// Draw a filled rectangle in the specified color
WiredHome 19:3f82c1161fd2 2316 ///
WiredHome 19:3f82c1161fd2 2317 /// @note As a side effect, this changes the current
WiredHome 19:3f82c1161fd2 2318 /// foreground color for subsequent operations.
WiredHome 19:3f82c1161fd2 2319 ///
WiredHome 72:ecffe56af969 2320 /// @param[in] x1 is the horizontal start of the line.
WiredHome 72:ecffe56af969 2321 /// @param[in] y1 is the vertical start of the line.
WiredHome 72:ecffe56af969 2322 /// @param[in] x2 is the horizontal end of the line.
WiredHome 72:ecffe56af969 2323 /// @param[in] y2 is the vertical end of the line.
WiredHome 72:ecffe56af969 2324 /// @param[in] color defines the foreground color.
WiredHome 72:ecffe56af969 2325 /// @param[in] fillit is optional to NOFILL the rectangle. default is FILL.
WiredHome 167:8aa3fb2a5a31 2326 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2327 ///
WiredHome 37:f19b7e7449dc 2328 virtual RetCode_t fillrect(loc_t x1, loc_t y1, loc_t x2, loc_t y2,
WiredHome 19:3f82c1161fd2 2329 color_t color, fill_t fillit = FILL);
WiredHome 19:3f82c1161fd2 2330
WiredHome 125:7a0b70f56550 2331
WiredHome 19:3f82c1161fd2 2332 /// Draw a rectangle
WiredHome 19:3f82c1161fd2 2333 ///
WiredHome 19:3f82c1161fd2 2334 /// Draws a rectangle using the foreground color setting.
WiredHome 19:3f82c1161fd2 2335 ///
WiredHome 72:ecffe56af969 2336 /// @param[in] x1 is the horizontal start of the line.
WiredHome 72:ecffe56af969 2337 /// @param[in] y1 is the vertical start of the line.
WiredHome 72:ecffe56af969 2338 /// @param[in] x2 is the horizontal end of the line.
WiredHome 72:ecffe56af969 2339 /// @param[in] y2 is the vertical end of the line.
WiredHome 72:ecffe56af969 2340 /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL.
WiredHome 167:8aa3fb2a5a31 2341 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2342 ///
WiredHome 37:f19b7e7449dc 2343 RetCode_t rect(loc_t x1, loc_t y1, loc_t x2, loc_t y2,
WiredHome 19:3f82c1161fd2 2344 fill_t fillit = NOFILL);
WiredHome 19:3f82c1161fd2 2345
WiredHome 125:7a0b70f56550 2346
WiredHome 19:3f82c1161fd2 2347 /// Draw a filled rectangle with rounded corners using the specified color.
WiredHome 19:3f82c1161fd2 2348 ///
WiredHome 21:3c1efb192927 2349 /// This draws a rounded rectangle. A numbers of checks are made on the values,
WiredHome 21:3c1efb192927 2350 /// and it could reduce this to drawing a line (if either x1 == x2, or y1 == y2),
WiredHome 21:3c1efb192927 2351 /// or a single point (x1 == x2 && y1 == y2). If the radius parameters are
WiredHome 21:3c1efb192927 2352 /// > 1/2 the length of that side (width or height), an error value is returned.
WiredHome 21:3c1efb192927 2353 ///
WiredHome 19:3f82c1161fd2 2354 /// @note As a side effect, this changes the current
WiredHome 19:3f82c1161fd2 2355 /// foreground color for subsequent operations.
WiredHome 19:3f82c1161fd2 2356 ///
WiredHome 72:ecffe56af969 2357 /// @param[in] x1 is the horizontal start of the line and must be <= x2.
WiredHome 72:ecffe56af969 2358 /// @param[in] y1 is the vertical start of the line and must be <= y2.
WiredHome 72:ecffe56af969 2359 /// @param[in] x2 is the horizontal end of the line and must be >= x1.
WiredHome 72:ecffe56af969 2360 /// @param[in] y2 is the vertical end of the line and must be >= y1.
WiredHome 72:ecffe56af969 2361 /// @param[in] radius1 defines the horizontal radius of the curved corner. Take care
WiredHome 21:3c1efb192927 2362 /// that this value < 1/2 the width of the rectangle, or bad_parameter
WiredHome 21:3c1efb192927 2363 /// is returned.
WiredHome 72:ecffe56af969 2364 /// @param[in] radius2 defines the vertical radius of the curved corner. Take care
WiredHome 21:3c1efb192927 2365 /// that this value < 1/2 the height of the rectangle, or bad_parameter
WiredHome 21:3c1efb192927 2366 /// is returned.
WiredHome 72:ecffe56af969 2367 /// @param[in] color defines the foreground color.
WiredHome 72:ecffe56af969 2368 /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL.
WiredHome 167:8aa3fb2a5a31 2369 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2370 ///
WiredHome 37:f19b7e7449dc 2371 RetCode_t fillroundrect(loc_t x1, loc_t y1, loc_t x2, loc_t y2,
WiredHome 37:f19b7e7449dc 2372 dim_t radius1, dim_t radius2, color_t color, fill_t fillit = FILL);
WiredHome 19:3f82c1161fd2 2373
WiredHome 125:7a0b70f56550 2374
WiredHome 107:f9ccffcb84f1 2375 /// Draw a filled rectangle with rounded corners using the specified color.
WiredHome 107:f9ccffcb84f1 2376 ///
WiredHome 107:f9ccffcb84f1 2377 /// This draws a rounded rectangle. A numbers of checks are made on the values,
WiredHome 107:f9ccffcb84f1 2378 /// and it could reduce this to drawing a line (if either x1 == x2, or y1 == y2),
WiredHome 107:f9ccffcb84f1 2379 /// or a single point (x1 == x2 && y1 == y2). If the radius parameters are
WiredHome 107:f9ccffcb84f1 2380 /// > 1/2 the length of that side (width or height), an error value is returned.
WiredHome 107:f9ccffcb84f1 2381 ///
WiredHome 107:f9ccffcb84f1 2382 /// @note As a side effect, this changes the current
WiredHome 107:f9ccffcb84f1 2383 /// foreground color for subsequent operations.
WiredHome 107:f9ccffcb84f1 2384 ///
WiredHome 107:f9ccffcb84f1 2385 /// @param[in] r is the rectangle to draw.
WiredHome 107:f9ccffcb84f1 2386 /// @param[in] radius1 defines the horizontal radius of the curved corner. Take care
WiredHome 107:f9ccffcb84f1 2387 /// that this value < 1/2 the width of the rectangle, or bad_parameter
WiredHome 107:f9ccffcb84f1 2388 /// is returned.
WiredHome 107:f9ccffcb84f1 2389 /// @param[in] radius2 defines the vertical radius of the curved corner. Take care
WiredHome 107:f9ccffcb84f1 2390 /// that this value < 1/2 the height of the rectangle, or bad_parameter
WiredHome 107:f9ccffcb84f1 2391 /// is returned.
WiredHome 107:f9ccffcb84f1 2392 /// @param[in] color defines the foreground color.
WiredHome 107:f9ccffcb84f1 2393 /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL.
WiredHome 167:8aa3fb2a5a31 2394 /// @returns @ref RetCode_t value.
WiredHome 107:f9ccffcb84f1 2395 ///
WiredHome 107:f9ccffcb84f1 2396 RetCode_t fillroundrect(rect_t r,
WiredHome 107:f9ccffcb84f1 2397 dim_t radius1, dim_t radius2, color_t color, fill_t fillit = FILL);
WiredHome 107:f9ccffcb84f1 2398
WiredHome 125:7a0b70f56550 2399
WiredHome 107:f9ccffcb84f1 2400 /// Draw a rectangle with rounded corners using the specified color.
WiredHome 107:f9ccffcb84f1 2401 ///
WiredHome 107:f9ccffcb84f1 2402 /// This draws a rounded rectangle. A numbers of checks are made on the values,
WiredHome 107:f9ccffcb84f1 2403 /// and it could reduce this to drawing a line (if either x1 == x2, or y1 == y2),
WiredHome 107:f9ccffcb84f1 2404 /// or a single point (x1 == x2 && y1 == y2). If the radius parameters are
WiredHome 107:f9ccffcb84f1 2405 /// > 1/2 the length of that side (width or height), an error value is returned.
WiredHome 107:f9ccffcb84f1 2406 ///
WiredHome 107:f9ccffcb84f1 2407 /// @note As a side effect, this changes the current
WiredHome 107:f9ccffcb84f1 2408 /// foreground color for subsequent operations.
WiredHome 107:f9ccffcb84f1 2409 ///
WiredHome 107:f9ccffcb84f1 2410 /// @param[in] r is the rectangle to draw.
WiredHome 107:f9ccffcb84f1 2411 /// @param[in] radius1 defines the horizontal radius of the curved corner. Take care
WiredHome 107:f9ccffcb84f1 2412 /// that this value < 1/2 the width of the rectangle, or bad_parameter
WiredHome 107:f9ccffcb84f1 2413 /// is returned.
WiredHome 107:f9ccffcb84f1 2414 /// @param[in] radius2 defines the vertical radius of the curved corner. Take care
WiredHome 107:f9ccffcb84f1 2415 /// that this value < 1/2 the height of the rectangle, or bad_parameter
WiredHome 107:f9ccffcb84f1 2416 /// is returned.
WiredHome 107:f9ccffcb84f1 2417 /// @param[in] color defines the foreground color.
WiredHome 107:f9ccffcb84f1 2418 /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL.
WiredHome 167:8aa3fb2a5a31 2419 /// @returns @ref RetCode_t value.
WiredHome 107:f9ccffcb84f1 2420 ///
WiredHome 107:f9ccffcb84f1 2421 RetCode_t roundrect(rect_t r,
WiredHome 107:f9ccffcb84f1 2422 dim_t radius1, dim_t radius2, color_t color, fill_t fillit = NOFILL);
WiredHome 107:f9ccffcb84f1 2423
WiredHome 125:7a0b70f56550 2424
WiredHome 19:3f82c1161fd2 2425 /// Draw a rectangle with rounded corners using the specified color.
WiredHome 19:3f82c1161fd2 2426 ///
WiredHome 21:3c1efb192927 2427 /// This draws a rounded rectangle. A numbers of checks are made on the values,
WiredHome 21:3c1efb192927 2428 /// and it could reduce this to drawing a line (if either x1 == x2, or y1 == y2),
WiredHome 21:3c1efb192927 2429 /// or a single point (x1 == x2 && y1 == y2). If the radius parameters are
WiredHome 21:3c1efb192927 2430 /// > 1/2 the length of that side (width or height), an error value is returned.
WiredHome 21:3c1efb192927 2431 ///
WiredHome 19:3f82c1161fd2 2432 /// @note As a side effect, this changes the current
WiredHome 19:3f82c1161fd2 2433 /// foreground color for subsequent operations.
WiredHome 19:3f82c1161fd2 2434 ///
WiredHome 72:ecffe56af969 2435 /// @param[in] x1 is the horizontal start of the line and must be <= x2.
WiredHome 72:ecffe56af969 2436 /// @param[in] y1 is the vertical start of the line and must be <= y2.
WiredHome 72:ecffe56af969 2437 /// @param[in] x2 is the horizontal end of the line and must be >= x1.
WiredHome 72:ecffe56af969 2438 /// @param[in] y2 is the vertical end of the line and must be >= y1.
WiredHome 72:ecffe56af969 2439 /// @param[in] radius1 defines the horizontal radius of the curved corner. Take care
WiredHome 21:3c1efb192927 2440 /// that this value < 1/2 the width of the rectangle, or bad_parameter
WiredHome 21:3c1efb192927 2441 /// is returned.
WiredHome 72:ecffe56af969 2442 /// @param[in] radius2 defines the vertical radius of the curved corner. Take care
WiredHome 21:3c1efb192927 2443 /// that this value < 1/2 the height of the rectangle, or bad_parameter
WiredHome 21:3c1efb192927 2444 /// is returned.
WiredHome 72:ecffe56af969 2445 /// @param[in] color defines the foreground color.
WiredHome 72:ecffe56af969 2446 /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL.
WiredHome 167:8aa3fb2a5a31 2447 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2448 ///
WiredHome 37:f19b7e7449dc 2449 RetCode_t roundrect(loc_t x1, loc_t y1, loc_t x2, loc_t y2,
WiredHome 37:f19b7e7449dc 2450 dim_t radius1, dim_t radius2, color_t color, fill_t fillit = NOFILL);
WiredHome 19:3f82c1161fd2 2451
WiredHome 125:7a0b70f56550 2452
WiredHome 19:3f82c1161fd2 2453 /// Draw a rectangle with rounded corners.
WiredHome 19:3f82c1161fd2 2454 ///
WiredHome 21:3c1efb192927 2455 /// This draws a rounded rectangle. A numbers of checks are made on the values,
WiredHome 21:3c1efb192927 2456 /// and it could reduce this to drawing a line (if either x1 == x2, or y1 == y2),
WiredHome 21:3c1efb192927 2457 /// or a single point (x1 == x2 && y1 == y2). If the radius parameters are
WiredHome 21:3c1efb192927 2458 /// > 1/2 the length of that side (width or height), an error value is returned.
WiredHome 19:3f82c1161fd2 2459 ///
WiredHome 72:ecffe56af969 2460 /// @param[in] x1 is the horizontal start of the line and must be <= x2.
WiredHome 72:ecffe56af969 2461 /// @param[in] y1 is the vertical start of the line and must be <= y2.
WiredHome 72:ecffe56af969 2462 /// @param[in] x2 is the horizontal end of the line and must be >= x1.
WiredHome 72:ecffe56af969 2463 /// @param[in] y2 is the vertical end of the line and must be >= y1.
WiredHome 72:ecffe56af969 2464 /// @param[in] radius1 defines the horizontal radius of the curved corner. Take care
WiredHome 21:3c1efb192927 2465 /// that this value < 1/2 the width of the rectangle, or bad_parameter
WiredHome 21:3c1efb192927 2466 /// is returned.
WiredHome 72:ecffe56af969 2467 /// @param[in] radius2 defines the vertical radius of the curved corner. Take care
WiredHome 21:3c1efb192927 2468 /// that this value < 1/2 the height of the rectangle, or bad_parameter
WiredHome 21:3c1efb192927 2469 /// is returned.
WiredHome 72:ecffe56af969 2470 /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL.
WiredHome 167:8aa3fb2a5a31 2471 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2472 ///
WiredHome 37:f19b7e7449dc 2473 RetCode_t roundrect(loc_t x1, loc_t y1, loc_t x2, loc_t y2,
WiredHome 37:f19b7e7449dc 2474 dim_t radius1, dim_t radius2, fill_t fillit = NOFILL);
WiredHome 19:3f82c1161fd2 2475
WiredHome 125:7a0b70f56550 2476
WiredHome 19:3f82c1161fd2 2477 /// Draw a triangle in the specified color.
WiredHome 19:3f82c1161fd2 2478 ///
WiredHome 19:3f82c1161fd2 2479 /// @note As a side effect, this changes the current
WiredHome 19:3f82c1161fd2 2480 /// foreground color for subsequent operations.
WiredHome 19:3f82c1161fd2 2481 ///
WiredHome 178:ae472eb22740 2482 /// @param[in] p1 is point 1.
WiredHome 178:ae472eb22740 2483 /// @param[in] p2 is point 2.
WiredHome 178:ae472eb22740 2484 /// @param[in] p3 is point 3.
WiredHome 178:ae472eb22740 2485 /// @param[in] color defines the foreground color.
WiredHome 178:ae472eb22740 2486 /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL.
WiredHome 178:ae472eb22740 2487 /// @returns @ref RetCode_t value.
WiredHome 178:ae472eb22740 2488 ///
WiredHome 178:ae472eb22740 2489 RetCode_t filltriangle(point_t p1, point_t p2, point_t p3, color_t color, fill_t fillit = FILL);
WiredHome 178:ae472eb22740 2490
WiredHome 178:ae472eb22740 2491 /// Draw a triangle in the specified color.
WiredHome 178:ae472eb22740 2492 ///
WiredHome 178:ae472eb22740 2493 /// @note As a side effect, this changes the current
WiredHome 178:ae472eb22740 2494 /// foreground color for subsequent operations.
WiredHome 178:ae472eb22740 2495 ///
WiredHome 178:ae472eb22740 2496 /// @param[in] p1 is point 1.
WiredHome 178:ae472eb22740 2497 /// @param[in] p2 is point 2.
WiredHome 178:ae472eb22740 2498 /// @param[in] p3 is point 3.
WiredHome 178:ae472eb22740 2499 /// @param[in] color defines the foreground color.
WiredHome 178:ae472eb22740 2500 /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL.
WiredHome 178:ae472eb22740 2501 /// @returns @ref RetCode_t value.
WiredHome 178:ae472eb22740 2502 ///
WiredHome 178:ae472eb22740 2503 RetCode_t triangle(point_t p1, point_t p2, point_t p3, color_t color, fill_t fillit = NOFILL);
WiredHome 178:ae472eb22740 2504
WiredHome 178:ae472eb22740 2505 /// Draw a triangle in the specified color.
WiredHome 178:ae472eb22740 2506 ///
WiredHome 178:ae472eb22740 2507 /// @note As a side effect, this changes the current
WiredHome 178:ae472eb22740 2508 /// foreground color for subsequent operations.
WiredHome 178:ae472eb22740 2509 ///
WiredHome 72:ecffe56af969 2510 /// @param[in] x1 is the horizontal for point 1.
WiredHome 72:ecffe56af969 2511 /// @param[in] y1 is the vertical for point 1.
WiredHome 72:ecffe56af969 2512 /// @param[in] x2 is the horizontal for point 2.
WiredHome 72:ecffe56af969 2513 /// @param[in] y2 is the vertical for point 2.
WiredHome 72:ecffe56af969 2514 /// @param[in] x3 is the horizontal for point 3.
WiredHome 72:ecffe56af969 2515 /// @param[in] y3 is the vertical for point 3.
WiredHome 72:ecffe56af969 2516 /// @param[in] color defines the foreground color.
WiredHome 72:ecffe56af969 2517 /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL.
WiredHome 167:8aa3fb2a5a31 2518 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2519 ///
WiredHome 37:f19b7e7449dc 2520 RetCode_t triangle(loc_t x1, loc_t y1, loc_t x2, loc_t y2,
WiredHome 37:f19b7e7449dc 2521 loc_t x3, loc_t y3, color_t color, fill_t fillit = NOFILL);
WiredHome 19:3f82c1161fd2 2522
WiredHome 125:7a0b70f56550 2523
WiredHome 19:3f82c1161fd2 2524 /// Draw a filled triangle in the specified color.
WiredHome 19:3f82c1161fd2 2525 ///
WiredHome 19:3f82c1161fd2 2526 /// @note As a side effect, this changes the current
WiredHome 19:3f82c1161fd2 2527 /// foreground color for subsequent operations.
WiredHome 19:3f82c1161fd2 2528 ///
WiredHome 72:ecffe56af969 2529 /// @param[in] x1 is the horizontal for point 1.
WiredHome 72:ecffe56af969 2530 /// @param[in] y1 is the vertical for point 1.
WiredHome 72:ecffe56af969 2531 /// @param[in] x2 is the horizontal for point 2.
WiredHome 72:ecffe56af969 2532 /// @param[in] y2 is the vertical for point 2.
WiredHome 72:ecffe56af969 2533 /// @param[in] x3 is the horizontal for point 3.
WiredHome 72:ecffe56af969 2534 /// @param[in] y3 is the vertical for point 3.
WiredHome 72:ecffe56af969 2535 /// @param[in] color defines the foreground color.
WiredHome 72:ecffe56af969 2536 /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL.
WiredHome 167:8aa3fb2a5a31 2537 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2538 ///
WiredHome 37:f19b7e7449dc 2539 RetCode_t filltriangle(loc_t x1, loc_t y1, loc_t x2, loc_t y2,
WiredHome 37:f19b7e7449dc 2540 loc_t x3, loc_t y3, color_t color, fill_t fillit = FILL);
WiredHome 19:3f82c1161fd2 2541
WiredHome 125:7a0b70f56550 2542
WiredHome 19:3f82c1161fd2 2543 /// Draw a triangle
WiredHome 19:3f82c1161fd2 2544 ///
WiredHome 19:3f82c1161fd2 2545 /// Draws a triangle using the foreground color setting.
WiredHome 19:3f82c1161fd2 2546 ///
WiredHome 72:ecffe56af969 2547 /// @param[in] x1 is the horizontal for point 1.
WiredHome 72:ecffe56af969 2548 /// @param[in] y1 is the vertical for point 1.
WiredHome 72:ecffe56af969 2549 /// @param[in] x2 is the horizontal for point 2.
WiredHome 72:ecffe56af969 2550 /// @param[in] y2 is the vertical for point 2.
WiredHome 72:ecffe56af969 2551 /// @param[in] x3 is the horizontal for point 3.
WiredHome 72:ecffe56af969 2552 /// @param[in] y3 is the vertical for point 3.
WiredHome 72:ecffe56af969 2553 /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL.
WiredHome 167:8aa3fb2a5a31 2554 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2555 ///
WiredHome 37:f19b7e7449dc 2556 RetCode_t triangle(loc_t x1, loc_t y1, loc_t x2, loc_t y2,
WiredHome 37:f19b7e7449dc 2557 loc_t x3, loc_t y3, fill_t fillit = NOFILL);
WiredHome 19:3f82c1161fd2 2558
WiredHome 83:7bad0068cca0 2559
WiredHome 83:7bad0068cca0 2560 /// Draw a circle using the specified color.
WiredHome 83:7bad0068cca0 2561 ///
WiredHome 83:7bad0068cca0 2562 /// @note As a side effect, this changes the current
WiredHome 83:7bad0068cca0 2563 /// foreground color for subsequent operations.
WiredHome 83:7bad0068cca0 2564 ///
WiredHome 83:7bad0068cca0 2565 /// @param[in] p defines the center of the circle.
WiredHome 83:7bad0068cca0 2566 /// @param[in] radius defines the size of the circle.
WiredHome 83:7bad0068cca0 2567 /// @param[in] color defines the foreground color.
WiredHome 125:7a0b70f56550 2568 /// @param[in] fillit is optional to FILL the circle. default is NOFILL.
WiredHome 167:8aa3fb2a5a31 2569 /// @returns @ref RetCode_t value.
WiredHome 83:7bad0068cca0 2570 ///
WiredHome 83:7bad0068cca0 2571 RetCode_t circle(point_t p, dim_t radius, color_t color, fill_t fillit = NOFILL);
WiredHome 83:7bad0068cca0 2572
WiredHome 125:7a0b70f56550 2573
WiredHome 83:7bad0068cca0 2574 /// Draw a filled circle using the specified color.
WiredHome 83:7bad0068cca0 2575 ///
WiredHome 83:7bad0068cca0 2576 /// @note As a side effect, this changes the current
WiredHome 83:7bad0068cca0 2577 /// foreground color for subsequent operations.
WiredHome 83:7bad0068cca0 2578 ///
WiredHome 83:7bad0068cca0 2579 /// @param[in] p defines the center of the circle.
WiredHome 83:7bad0068cca0 2580 /// @param[in] radius defines the size of the circle.
WiredHome 83:7bad0068cca0 2581 /// @param[in] color defines the foreground color.
WiredHome 125:7a0b70f56550 2582 /// @param[in] fillit is optional to FILL the circle. default is FILL.
WiredHome 167:8aa3fb2a5a31 2583 /// @returns @ref RetCode_t value.
WiredHome 83:7bad0068cca0 2584 ///
WiredHome 83:7bad0068cca0 2585 RetCode_t fillcircle(point_t p, dim_t radius, color_t color, fill_t fillit = FILL);
WiredHome 83:7bad0068cca0 2586
WiredHome 125:7a0b70f56550 2587
WiredHome 83:7bad0068cca0 2588 /// Draw a circle.
WiredHome 83:7bad0068cca0 2589 ///
WiredHome 83:7bad0068cca0 2590 /// Draws a circle using the foreground color setting.
WiredHome 83:7bad0068cca0 2591 ///
WiredHome 83:7bad0068cca0 2592 /// @param[in] p defines the center of the circle.
WiredHome 83:7bad0068cca0 2593 /// @param[in] radius defines the size of the circle.
WiredHome 125:7a0b70f56550 2594 /// @param[in] fillit is optional to FILL the circle. default is NOFILL.
WiredHome 167:8aa3fb2a5a31 2595 /// @returns @ref RetCode_t value.
WiredHome 83:7bad0068cca0 2596 ///
WiredHome 83:7bad0068cca0 2597 RetCode_t circle(point_t p, dim_t radius, fill_t fillit = NOFILL);
WiredHome 83:7bad0068cca0 2598
WiredHome 125:7a0b70f56550 2599
WiredHome 19:3f82c1161fd2 2600 /// Draw a circle using the specified color.
WiredHome 19:3f82c1161fd2 2601 ///
WiredHome 19:3f82c1161fd2 2602 /// @note As a side effect, this changes the current
WiredHome 19:3f82c1161fd2 2603 /// foreground color for subsequent operations.
WiredHome 19:3f82c1161fd2 2604 ///
WiredHome 72:ecffe56af969 2605 /// @param[in] x is the horizontal center of the circle.
WiredHome 72:ecffe56af969 2606 /// @param[in] y is the vertical center of the circle.
WiredHome 72:ecffe56af969 2607 /// @param[in] radius defines the size of the circle.
WiredHome 72:ecffe56af969 2608 /// @param[in] color defines the foreground color.
WiredHome 125:7a0b70f56550 2609 /// @param[in] fillit is optional to FILL the circle. default is NOFILL.
WiredHome 167:8aa3fb2a5a31 2610 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2611 ///
WiredHome 37:f19b7e7449dc 2612 RetCode_t circle(loc_t x, loc_t y, dim_t radius, color_t color, fill_t fillit = NOFILL);
WiredHome 19:3f82c1161fd2 2613
WiredHome 125:7a0b70f56550 2614
WiredHome 19:3f82c1161fd2 2615 /// Draw a filled circle using the specified color.
WiredHome 19:3f82c1161fd2 2616 ///
WiredHome 19:3f82c1161fd2 2617 /// @note As a side effect, this changes the current
WiredHome 19:3f82c1161fd2 2618 /// foreground color for subsequent operations.
WiredHome 19:3f82c1161fd2 2619 ///
WiredHome 72:ecffe56af969 2620 /// @param[in] x is the horizontal center of the circle.
WiredHome 72:ecffe56af969 2621 /// @param[in] y is the vertical center of the circle.
WiredHome 72:ecffe56af969 2622 /// @param[in] radius defines the size of the circle.
WiredHome 72:ecffe56af969 2623 /// @param[in] color defines the foreground color.
WiredHome 125:7a0b70f56550 2624 /// @param[in] fillit is optional to FILL the circle. default is FILL.
WiredHome 167:8aa3fb2a5a31 2625 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2626 ///
WiredHome 37:f19b7e7449dc 2627 RetCode_t fillcircle(loc_t x, loc_t y, dim_t radius, color_t color, fill_t fillit = FILL);
WiredHome 19:3f82c1161fd2 2628
WiredHome 125:7a0b70f56550 2629
WiredHome 19:3f82c1161fd2 2630 /// Draw a circle.
WiredHome 19:3f82c1161fd2 2631 ///
WiredHome 19:3f82c1161fd2 2632 /// Draws a circle using the foreground color setting.
WiredHome 19:3f82c1161fd2 2633 ///
WiredHome 72:ecffe56af969 2634 /// @param[in] x is the horizontal center of the circle.
WiredHome 72:ecffe56af969 2635 /// @param[in] y is the vertical center of the circle.
WiredHome 72:ecffe56af969 2636 /// @param[in] radius defines the size of the circle.
WiredHome 125:7a0b70f56550 2637 /// @param[in] fillit is optional to FILL the circle. default is NOFILL.
WiredHome 167:8aa3fb2a5a31 2638 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2639 ///
WiredHome 37:f19b7e7449dc 2640 RetCode_t circle(loc_t x, loc_t y, dim_t radius, fill_t fillit = NOFILL);
WiredHome 19:3f82c1161fd2 2641
WiredHome 19:3f82c1161fd2 2642 /// Draw an Ellipse using the specified color
WiredHome 19:3f82c1161fd2 2643 ///
WiredHome 19:3f82c1161fd2 2644 /// @note As a side effect, this changes the current
WiredHome 19:3f82c1161fd2 2645 /// foreground color for subsequent operations.
WiredHome 19:3f82c1161fd2 2646 ///
WiredHome 72:ecffe56af969 2647 /// @param[in] x is the horizontal center of the ellipse.
WiredHome 72:ecffe56af969 2648 /// @param[in] y is the vertical center of the ellipse.
WiredHome 72:ecffe56af969 2649 /// @param[in] radius1 defines the horizontal radius of the ellipse.
WiredHome 72:ecffe56af969 2650 /// @param[in] radius2 defines the vertical radius of the ellipse.
WiredHome 72:ecffe56af969 2651 /// @param[in] color defines the foreground color.
WiredHome 72:ecffe56af969 2652 /// @param[in] fillit defines whether the circle is filled or not.
WiredHome 167:8aa3fb2a5a31 2653 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2654 ///
WiredHome 37:f19b7e7449dc 2655 RetCode_t ellipse(loc_t x, loc_t y, dim_t radius1, dim_t radius2,
WiredHome 19:3f82c1161fd2 2656 color_t color, fill_t fillit = NOFILL);
WiredHome 19:3f82c1161fd2 2657
WiredHome 125:7a0b70f56550 2658
WiredHome 25:9556a3a9b7cc 2659 /// Draw a filled Ellipse using the specified color
WiredHome 25:9556a3a9b7cc 2660 ///
WiredHome 25:9556a3a9b7cc 2661 /// @note As a side effect, this changes the current
WiredHome 25:9556a3a9b7cc 2662 /// foreground color for subsequent operations.
WiredHome 25:9556a3a9b7cc 2663 ///
WiredHome 72:ecffe56af969 2664 /// @param[in] x is the horizontal center of the ellipse.
WiredHome 72:ecffe56af969 2665 /// @param[in] y is the vertical center of the ellipse.
WiredHome 72:ecffe56af969 2666 /// @param[in] radius1 defines the horizontal radius of the ellipse.
WiredHome 72:ecffe56af969 2667 /// @param[in] radius2 defines the vertical radius of the ellipse.
WiredHome 72:ecffe56af969 2668 /// @param[in] color defines the foreground color.
WiredHome 72:ecffe56af969 2669 /// @param[in] fillit defines whether the circle is filled or not.
WiredHome 167:8aa3fb2a5a31 2670 /// @returns @ref RetCode_t value.
WiredHome 25:9556a3a9b7cc 2671 ///
WiredHome 37:f19b7e7449dc 2672 RetCode_t fillellipse(loc_t x, loc_t y, dim_t radius1, dim_t radius2,
WiredHome 25:9556a3a9b7cc 2673 color_t color, fill_t fillit = FILL);
WiredHome 25:9556a3a9b7cc 2674
WiredHome 125:7a0b70f56550 2675
WiredHome 19:3f82c1161fd2 2676 /// Draw an Ellipse
WiredHome 19:3f82c1161fd2 2677 ///
WiredHome 19:3f82c1161fd2 2678 /// Draws it using the foreground color setting.
WiredHome 19:3f82c1161fd2 2679 ///
WiredHome 72:ecffe56af969 2680 /// @param[in] x is the horizontal center of the ellipse.
WiredHome 72:ecffe56af969 2681 /// @param[in] y is the vertical center of the ellipse.
WiredHome 72:ecffe56af969 2682 /// @param[in] radius1 defines the horizontal radius of the ellipse.
WiredHome 72:ecffe56af969 2683 /// @param[in] radius2 defines the vertical radius of the ellipse.
WiredHome 72:ecffe56af969 2684 /// @param[in] fillit defines whether the circle is filled or not.
WiredHome 167:8aa3fb2a5a31 2685 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2686 ///
WiredHome 37:f19b7e7449dc 2687 RetCode_t ellipse(loc_t x, loc_t y, dim_t radius1, dim_t radius2, fill_t fillit = NOFILL);
WiredHome 19:3f82c1161fd2 2688
WiredHome 125:7a0b70f56550 2689
WiredHome 131:5bd6ba2ee4a1 2690
WiredHome 131:5bd6ba2ee4a1 2691 /// Block Move
WiredHome 131:5bd6ba2ee4a1 2692 ///
WiredHome 131:5bd6ba2ee4a1 2693 /// The Block Move API activates the RA8875 Block Transfer Engine. Due to the complex
WiredHome 131:5bd6ba2ee4a1 2694 /// set of possible operations, the user should read the related sections of the
WiredHome 131:5bd6ba2ee4a1 2695 /// RA8875 user manual.
WiredHome 131:5bd6ba2ee4a1 2696 ///
WiredHome 131:5bd6ba2ee4a1 2697 /// Some operations may require that other registers are configured, such as the
WiredHome 131:5bd6ba2ee4a1 2698 /// foreground and background color registers, and others. Those must be set
WiredHome 131:5bd6ba2ee4a1 2699 /// outside of this API.
WiredHome 131:5bd6ba2ee4a1 2700 ///
WiredHome 138:61e93bed397e 2701 /// @code
WiredHome 167:8aa3fb2a5a31 2702 /// // Block Move Demo
WiredHome 167:8aa3fb2a5a31 2703 ///
WiredHome 154:ad2450fc3dc3 2704 /// // Calibrate the resistive touch screen, and store the data on the
WiredHome 154:ad2450fc3dc3 2705 /// // local file system.
WiredHome 154:ad2450fc3dc3 2706 /// //
WiredHome 154:ad2450fc3dc3 2707 /// void CalibrateTS(void)
WiredHome 154:ad2450fc3dc3 2708 /// {
WiredHome 154:ad2450fc3dc3 2709 /// FILE * fh;
WiredHome 154:ad2450fc3dc3 2710 /// tpMatrix_t matrix;
WiredHome 154:ad2450fc3dc3 2711 /// RetCode_t r;
WiredHome 154:ad2450fc3dc3 2712 /// Timer testperiod;
WiredHome 154:ad2450fc3dc3 2713 ///
WiredHome 154:ad2450fc3dc3 2714 /// r = lcd.TouchPanelCalibrate("Calibrate the touch panel", &matrix);
WiredHome 154:ad2450fc3dc3 2715 /// if (r == noerror) {
WiredHome 154:ad2450fc3dc3 2716 /// fh = fopen("/local/tpcal.cfg", "wb");
WiredHome 154:ad2450fc3dc3 2717 /// if (fh) {
WiredHome 154:ad2450fc3dc3 2718 /// fwrite(&matrix, sizeof(tpMatrix_t), 1, fh);
WiredHome 154:ad2450fc3dc3 2719 /// fclose(fh);
WiredHome 154:ad2450fc3dc3 2720 /// printf(" tp cal written.\r\n");
WiredHome 154:ad2450fc3dc3 2721 /// lcd.cls();
WiredHome 154:ad2450fc3dc3 2722 /// } else {
WiredHome 154:ad2450fc3dc3 2723 /// printf(" couldn't open tpcal file.\r\n");
WiredHome 154:ad2450fc3dc3 2724 /// }
WiredHome 154:ad2450fc3dc3 2725 /// } else {
WiredHome 154:ad2450fc3dc3 2726 /// printf("error return: %d\r\n", r);
WiredHome 154:ad2450fc3dc3 2727 /// }
WiredHome 154:ad2450fc3dc3 2728 /// lcd.cls();
WiredHome 154:ad2450fc3dc3 2729 /// }
WiredHome 154:ad2450fc3dc3 2730 ///
WiredHome 154:ad2450fc3dc3 2731 /// // Try to load a previous resistive touch screen calibration from storage. If it
WiredHome 154:ad2450fc3dc3 2732 /// // doesn't exist, activate the touch screen calibration process.
WiredHome 154:ad2450fc3dc3 2733 /// //
WiredHome 154:ad2450fc3dc3 2734 /// void InitTS(void)
WiredHome 154:ad2450fc3dc3 2735 /// {
WiredHome 154:ad2450fc3dc3 2736 /// FILE * fh;
WiredHome 154:ad2450fc3dc3 2737 /// tpMatrix_t matrix;
WiredHome 154:ad2450fc3dc3 2738 ///
WiredHome 154:ad2450fc3dc3 2739 /// fh = fopen("/local/tpcal.cfg", "rb");
WiredHome 154:ad2450fc3dc3 2740 /// if (fh) {
WiredHome 154:ad2450fc3dc3 2741 /// fread(&matrix, sizeof(tpMatrix_t), 1, fh);
WiredHome 154:ad2450fc3dc3 2742 /// fclose(fh);
WiredHome 154:ad2450fc3dc3 2743 /// lcd.TouchPanelSetMatrix(&matrix);
WiredHome 154:ad2450fc3dc3 2744 /// printf(" tp cal loaded.\r\n");
WiredHome 154:ad2450fc3dc3 2745 /// } else {
WiredHome 154:ad2450fc3dc3 2746 /// CalibrateTS();
WiredHome 154:ad2450fc3dc3 2747 /// }
WiredHome 154:ad2450fc3dc3 2748 /// }
WiredHome 154:ad2450fc3dc3 2749 ///
WiredHome 138:61e93bed397e 2750 /// int main()
WiredHome 138:61e93bed397e 2751 /// {
WiredHome 138:61e93bed397e 2752 /// point_t src;
WiredHome 138:61e93bed397e 2753 /// point_t dst;
WiredHome 138:61e93bed397e 2754 /// TouchCode_t touch;
WiredHome 138:61e93bed397e 2755 /// const dim_t RECT_W = 100;
WiredHome 138:61e93bed397e 2756 /// const dim_t RECT_H = 100;
WiredHome 138:61e93bed397e 2757 ///
WiredHome 138:61e93bed397e 2758 /// pc.baud(460800); //I like a snappy terminal, so crank it up!
WiredHome 138:61e93bed397e 2759 /// pc.printf("\r\nRA8875 BTE Move Test - Build " __DATE__ " " __TIME__ "\r\n");
WiredHome 138:61e93bed397e 2760 /// lcd.init(LCD_W,LCD_H,LCD_C, BL_NORM);
WiredHome 138:61e93bed397e 2761 /// lcd.TouchPanelInit();
WiredHome 138:61e93bed397e 2762 /// #ifndef CAP_TOUCH
WiredHome 138:61e93bed397e 2763 /// InitTS(); // Calibration for resistive touch panel
WiredHome 138:61e93bed397e 2764 /// #endif
WiredHome 138:61e93bed397e 2765 ///
WiredHome 138:61e93bed397e 2766 /// RetCode_t r = lcd.RenderImageFile(0,0,"/local/fullscrn.jpg");
WiredHome 138:61e93bed397e 2767 /// if (r) pc.printf(" Error: %d; %s\r\n", r, lcd.GetErrorMessage(r));
WiredHome 138:61e93bed397e 2768 /// while (1) {
WiredHome 138:61e93bed397e 2769 /// touch = lcd.TouchPanelReadable();
WiredHome 138:61e93bed397e 2770 /// if (touch) {
WiredHome 138:61e93bed397e 2771 /// point_t xy = lcd.TouchCoordinates();
WiredHome 138:61e93bed397e 2772 /// TouchCode_t t = lcd.TouchCode();
WiredHome 138:61e93bed397e 2773 ///
WiredHome 138:61e93bed397e 2774 /// if (t == touch) {
WiredHome 138:61e93bed397e 2775 /// src = ComputeTopLeftOfRect(xy, RECT_W/2, RECT_H/2, LCD_W, LCD_H);
WiredHome 138:61e93bed397e 2776 /// } else if (t == release) {
WiredHome 138:61e93bed397e 2777 /// dst = ComputeTopLeftOfRect(xy, RECT_W/2, RECT_H/2, LCD_W, LCD_H);
WiredHome 138:61e93bed397e 2778 /// r = lcd.BlockMove(0,0,dst, 0,0,src, RECT_W,RECT_H, 0x2, 0xC);
WiredHome 138:61e93bed397e 2779 /// }
WiredHome 138:61e93bed397e 2780 /// }
WiredHome 138:61e93bed397e 2781 /// }
WiredHome 138:61e93bed397e 2782 /// }
WiredHome 138:61e93bed397e 2783 /// @endcode
WiredHome 138:61e93bed397e 2784 ///
WiredHome 139:99ec74e3273f 2785 /// @param[in] dstLayer layer [5B.7]. layer value is 0 or 1 representing layer 1 and 2.
WiredHome 131:5bd6ba2ee4a1 2786 /// @param[in] dstDataSelect [50.5] defines the destination data type 0: block, 1: linear.
WiredHome 131:5bd6ba2ee4a1 2787 /// @param[in] dstPoint [58-5B] is a point_t defining the destination coordinate.
WiredHome 139:99ec74e3273f 2788 /// @param[in] srcLayer layer [57.7]. layer value is 0 or 1 representing layer 1 and 2.
WiredHome 131:5bd6ba2ee4a1 2789 /// @param[in] srcDataSelect [50.6] defines the source data type 0: block, 1: linear.
WiredHome 131:5bd6ba2ee4a1 2790 /// @param[in] srcPoint [54-57] is a point_t defining the source coordinate.
WiredHome 131:5bd6ba2ee4a1 2791 /// @param[in] bte_width [5C-5D]. operation width.
WiredHome 131:5bd6ba2ee4a1 2792 /// @param[in] bte_height [5E-5F]. operation height.
WiredHome 131:5bd6ba2ee4a1 2793 /// @param[in] bte_op_code [51.3-0] defines the raster operation function
WiredHome 131:5bd6ba2ee4a1 2794 /// (write/read/move/...)
WiredHome 131:5bd6ba2ee4a1 2795 /// @param[in] bte_rop_code [51.7-4] defines what type of BTE operation to perform
WiredHome 131:5bd6ba2ee4a1 2796 /// (what is placed at the destination)
WiredHome 167:8aa3fb2a5a31 2797 /// @returns @ref RetCode_t value.
WiredHome 131:5bd6ba2ee4a1 2798 ///
WiredHome 131:5bd6ba2ee4a1 2799 RetCode_t BlockMove(uint8_t dstLayer, uint8_t dstDataSelect, point_t dstPoint,
WiredHome 131:5bd6ba2ee4a1 2800 uint8_t srcLayer, uint8_t srcDataSelect, point_t srcPoint,
WiredHome 137:9e09f6081ef1 2801 dim_t bte_width, dim_t bte_height,
WiredHome 131:5bd6ba2ee4a1 2802 uint8_t bte_op_code, uint8_t bte_rop_code);
WiredHome 131:5bd6ba2ee4a1 2803
WiredHome 131:5bd6ba2ee4a1 2804
WiredHome 19:3f82c1161fd2 2805 /// Control display power
WiredHome 19:3f82c1161fd2 2806 ///
WiredHome 72:ecffe56af969 2807 /// @param[in] on when set to true will turn on the display, when false it is turned off.
WiredHome 167:8aa3fb2a5a31 2808 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2809 ///
WiredHome 19:3f82c1161fd2 2810 RetCode_t Power(bool on);
WiredHome 19:3f82c1161fd2 2811
WiredHome 125:7a0b70f56550 2812
WiredHome 19:3f82c1161fd2 2813 /// Reset the display controller via the Software Reset interface.
WiredHome 19:3f82c1161fd2 2814 ///
WiredHome 167:8aa3fb2a5a31 2815 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2816 ///
WiredHome 19:3f82c1161fd2 2817 RetCode_t Reset(void);
WiredHome 19:3f82c1161fd2 2818
WiredHome 125:7a0b70f56550 2819
WiredHome 19:3f82c1161fd2 2820 /// Set backlight brightness.
WiredHome 19:3f82c1161fd2 2821 ///
WiredHome 19:3f82c1161fd2 2822 /// When the built-in PWM is used to control the backlight, this
WiredHome 19:3f82c1161fd2 2823 /// API can be used to set the brightness.
WiredHome 19:3f82c1161fd2 2824 ///
WiredHome 72:ecffe56af969 2825 /// @param[in] brightness ranges from 0 (off) to 255 (full on)
WiredHome 167:8aa3fb2a5a31 2826 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2827 ///
WiredHome 131:5bd6ba2ee4a1 2828 RetCode_t Backlight_u8(uint8_t brightness);
WiredHome 125:7a0b70f56550 2829
WiredHome 19:3f82c1161fd2 2830
WiredHome 86:e86b355940f4 2831 /// Get backlight brightness.
WiredHome 86:e86b355940f4 2832 ///
WiredHome 86:e86b355940f4 2833 /// @returns backlight setting from 0 (off) to 255 (full on).
WiredHome 86:e86b355940f4 2834 ///
WiredHome 86:e86b355940f4 2835 uint8_t GetBacklight_u8(void);
WiredHome 86:e86b355940f4 2836
WiredHome 19:3f82c1161fd2 2837 /// Set backlight brightness.
WiredHome 19:3f82c1161fd2 2838 ///
WiredHome 19:3f82c1161fd2 2839 /// When the built-in PWM is used to control the backlight, this
WiredHome 19:3f82c1161fd2 2840 /// API can be used to set the brightness.
WiredHome 19:3f82c1161fd2 2841 ///
WiredHome 72:ecffe56af969 2842 /// @param[in] brightness ranges from 0.0 (off) to 1.0 (full on)
WiredHome 167:8aa3fb2a5a31 2843 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 2844 ///
WiredHome 19:3f82c1161fd2 2845 RetCode_t Backlight(float brightness);
WiredHome 19:3f82c1161fd2 2846
WiredHome 125:7a0b70f56550 2847
WiredHome 86:e86b355940f4 2848 /// Get backlight brightness.
WiredHome 86:e86b355940f4 2849 ///
WiredHome 86:e86b355940f4 2850 /// @returns backlight setting from 0 (off) to 1.0 (full on).
WiredHome 86:e86b355940f4 2851 ///
WiredHome 86:e86b355940f4 2852 float GetBacklight(void);
WiredHome 86:e86b355940f4 2853
WiredHome 125:7a0b70f56550 2854
WiredHome 98:ecebed9b80b2 2855 /// Select a User Font for all subsequent text.
WiredHome 98:ecebed9b80b2 2856 ///
WiredHome 98:ecebed9b80b2 2857 /// @note Tool to create the fonts is accessible from its creator
WiredHome 98:ecebed9b80b2 2858 /// available at http://www.mikroe.com.
WiredHome 98:ecebed9b80b2 2859 /// For version 1.2.0.0, choose the "Export for TFT and new GLCD"
WiredHome 98:ecebed9b80b2 2860 /// format.
WiredHome 98:ecebed9b80b2 2861 ///
WiredHome 98:ecebed9b80b2 2862 /// @param[in] font is a pointer to a specially formed font resource.
WiredHome 167:8aa3fb2a5a31 2863 /// @returns @ref RetCode_t value.
WiredHome 98:ecebed9b80b2 2864 ///
WiredHome 98:ecebed9b80b2 2865 virtual RetCode_t SelectUserFont(const uint8_t * font = NULL);
WiredHome 98:ecebed9b80b2 2866
WiredHome 127:db7f2c704693 2867 /// Get the currently selected user font.
WiredHome 127:db7f2c704693 2868 ///
WiredHome 127:db7f2c704693 2869 /// @returns a pointer to the font, or null, if no user font is selected.
WiredHome 127:db7f2c704693 2870 ///
WiredHome 127:db7f2c704693 2871 virtual const uint8_t * GetUserFont(void) { return font; }
WiredHome 19:3f82c1161fd2 2872
WiredHome 167:8aa3fb2a5a31 2873 /// Get the @ref color_t value from a DOS color index.
WiredHome 167:8aa3fb2a5a31 2874 ///
WiredHome 167:8aa3fb2a5a31 2875 /// See @ref PredefinedColors, @ref color_t.
WiredHome 167:8aa3fb2a5a31 2876 ///
WiredHome 125:7a0b70f56550 2877 /// @code
WiredHome 125:7a0b70f56550 2878 /// color_t color = DOSColor(12);
WiredHome 125:7a0b70f56550 2879 /// @endcode
WiredHome 125:7a0b70f56550 2880 ///
WiredHome 167:8aa3fb2a5a31 2881 /// @param[in] i is the color index, in the range 0 to 15;
WiredHome 167:8aa3fb2a5a31 2882 /// @returns the @ref color_t value of the selected index,
WiredHome 167:8aa3fb2a5a31 2883 /// or 0 (@ref Black) if the index is out of bounds.
WiredHome 19:3f82c1161fd2 2884 ///
WiredHome 19:3f82c1161fd2 2885 color_t DOSColor(int i);
WiredHome 19:3f82c1161fd2 2886
WiredHome 125:7a0b70f56550 2887
WiredHome 167:8aa3fb2a5a31 2888 /// Get the color name (string) from a DOS color index.
WiredHome 167:8aa3fb2a5a31 2889 ///
WiredHome 167:8aa3fb2a5a31 2890 /// See @ref PredefinedColors, @ref color_t.
WiredHome 167:8aa3fb2a5a31 2891 ///
WiredHome 125:7a0b70f56550 2892 /// @code
WiredHome 125:7a0b70f56550 2893 /// printf("color is %s\n", DOSColorNames(12));
WiredHome 125:7a0b70f56550 2894 /// @endcode
WiredHome 125:7a0b70f56550 2895 ///
WiredHome 167:8aa3fb2a5a31 2896 /// @param[in] i is the color index, in the range 0 to 15;
WiredHome 19:3f82c1161fd2 2897 /// @returns a pointer to a string with the color name,
WiredHome 19:3f82c1161fd2 2898 /// or NULL if the index is out of bounds.
WiredHome 19:3f82c1161fd2 2899 ///
WiredHome 19:3f82c1161fd2 2900 const char * DOSColorNames(int i);
WiredHome 19:3f82c1161fd2 2901
WiredHome 125:7a0b70f56550 2902
WiredHome 55:dfbabef7003e 2903 /// Advanced method indicating the start of a graphics stream.
WiredHome 55:dfbabef7003e 2904 ///
WiredHome 55:dfbabef7003e 2905 /// This is called prior to a stream of pixel data being sent.
WiredHome 55:dfbabef7003e 2906 /// This may cause register configuration changes in the derived
WiredHome 55:dfbabef7003e 2907 /// class in order to prepare the hardware to accept the streaming
WiredHome 55:dfbabef7003e 2908 /// data.
WiredHome 55:dfbabef7003e 2909 ///
WiredHome 106:c80828f5dea4 2910 /// Following this command, a series of See @ref _putp() commands can
WiredHome 55:dfbabef7003e 2911 /// be used to send individual pixels to the screen.
WiredHome 55:dfbabef7003e 2912 ///
WiredHome 106:c80828f5dea4 2913 /// To conclude the graphics stream, See @ref _EndGraphicsStream should
WiredHome 167:8aa3fb2a5a31 2914 /// be called.
WiredHome 167:8aa3fb2a5a31 2915 ///
WiredHome 167:8aa3fb2a5a31 2916 /// @returns @ref RetCode_t value.
WiredHome 55:dfbabef7003e 2917 ///
WiredHome 55:dfbabef7003e 2918 virtual RetCode_t _StartGraphicsStream(void);
WiredHome 125:7a0b70f56550 2919
WiredHome 55:dfbabef7003e 2920
WiredHome 55:dfbabef7003e 2921 /// Advanced method to put a single color pixel to the screen.
WiredHome 55:dfbabef7003e 2922 ///
WiredHome 55:dfbabef7003e 2923 /// This method may be called as many times as necessary after
WiredHome 106:c80828f5dea4 2924 /// See @ref _StartGraphicsStream() is called, and it should be followed
WiredHome 55:dfbabef7003e 2925 /// by _EndGraphicsStream.
WiredHome 55:dfbabef7003e 2926 ///
WiredHome 125:7a0b70f56550 2927 /// @code
WiredHome 125:7a0b70f56550 2928 /// _putp(DOSColor(12));
WiredHome 125:7a0b70f56550 2929 /// @endcode
WiredHome 125:7a0b70f56550 2930 ///
WiredHome 72:ecffe56af969 2931 /// @param[in] pixel is a color value to be put on the screen.
WiredHome 167:8aa3fb2a5a31 2932 /// @returns @ref RetCode_t value.
WiredHome 55:dfbabef7003e 2933 ///
WiredHome 55:dfbabef7003e 2934 virtual RetCode_t _putp(color_t pixel);
WiredHome 125:7a0b70f56550 2935
WiredHome 55:dfbabef7003e 2936
WiredHome 55:dfbabef7003e 2937 /// Advanced method indicating the end of a graphics stream.
WiredHome 55:dfbabef7003e 2938 ///
WiredHome 55:dfbabef7003e 2939 /// This is called to conclude a stream of pixel data that was sent.
WiredHome 55:dfbabef7003e 2940 /// This may cause register configuration changes in the derived
WiredHome 55:dfbabef7003e 2941 /// class in order to stop the hardware from accept the streaming
WiredHome 55:dfbabef7003e 2942 /// data.
WiredHome 55:dfbabef7003e 2943 ///
WiredHome 167:8aa3fb2a5a31 2944 /// @returns @ref RetCode_t value.
WiredHome 55:dfbabef7003e 2945 ///
WiredHome 55:dfbabef7003e 2946 virtual RetCode_t _EndGraphicsStream(void);
WiredHome 19:3f82c1161fd2 2947
WiredHome 125:7a0b70f56550 2948
WiredHome 57:bd53a9e165a1 2949 /// Set the SPI port frequency (in Hz).
WiredHome 57:bd53a9e165a1 2950 ///
WiredHome 66:468a11f05580 2951 /// This uses the mbed SPI driver, and is therefore dependent on
WiredHome 66:468a11f05580 2952 /// its capabilities. The RA8875 can accept writes via SPI faster
WiredHome 66:468a11f05580 2953 /// than a read can be performed. The frequency set by this API
WiredHome 66:468a11f05580 2954 /// is for the SPI writes. It will automatically reduce the SPI
WiredHome 66:468a11f05580 2955 /// clock rate when a read is performed, and restore it for the
WiredHome 68:ab08efabfc88 2956 /// next write. Alternately, the 2nd parameters permits setting
WiredHome 68:ab08efabfc88 2957 /// the read speed rather than letting it compute it automatically.
WiredHome 57:bd53a9e165a1 2958 ///
WiredHome 66:468a11f05580 2959 /// @note The primary effect of this is to recover more CPU cycles
WiredHome 66:468a11f05580 2960 /// for your application code. Keep in mind that when more than
WiredHome 66:468a11f05580 2961 /// one command is sent to the display controller, that it
WiredHome 66:468a11f05580 2962 /// will wait for the controller to finish the prior command.
WiredHome 66:468a11f05580 2963 /// In this case, the performance is limited by the RA8875.
WiredHome 57:bd53a9e165a1 2964 ///
WiredHome 72:ecffe56af969 2965 /// @param[in] Hz is the frequency in Hz, tested range includes the
WiredHome 66:468a11f05580 2966 /// range from 1,000,000 (1MHz) to 10,000,000 (10 MHz). Values
WiredHome 66:468a11f05580 2967 /// outside this range will be accepted, but operation may
WiredHome 76:c981284eb513 2968 /// be unreliable. This depends partially on your hardware design
WiredHome 76:c981284eb513 2969 /// and the wires connecting the display module.
WiredHome 76:c981284eb513 2970 /// The default value is 5,000,000, which should work for most
WiredHome 76:c981284eb513 2971 /// applications as a starting point.
WiredHome 72:ecffe56af969 2972 /// @param[in] Hz2 is an optional parameter and will set the read
WiredHome 68:ab08efabfc88 2973 /// speed independently of the write speed.
WiredHome 167:8aa3fb2a5a31 2974 /// @returns @ref RetCode_t value.
WiredHome 57:bd53a9e165a1 2975 ///
WiredHome 68:ab08efabfc88 2976 RetCode_t frequency(unsigned long Hz = RA8875_DEFAULT_SPI_FREQ, unsigned long Hz2 = 0);
WiredHome 125:7a0b70f56550 2977
WiredHome 125:7a0b70f56550 2978
WiredHome 72:ecffe56af969 2979 /// This method captures the specified area as a 24-bit bitmap file.
WiredHome 72:ecffe56af969 2980 ///
WiredHome 72:ecffe56af969 2981 /// Even though this is a 16-bit display, the stored image is in
WiredHome 72:ecffe56af969 2982 /// 24-bit format.
WiredHome 72:ecffe56af969 2983 ///
WiredHome 73:f22a18707b5e 2984 /// This method will interrogate the current display setting and
WiredHome 73:f22a18707b5e 2985 /// create a bitmap based on those settings. For instance, if
WiredHome 73:f22a18707b5e 2986 /// only layer 1 is visible, then the bitmap is only layer 1. However,
WiredHome 73:f22a18707b5e 2987 /// if there is some other operation in effect (transparent mode).
WiredHome 73:f22a18707b5e 2988 ///
WiredHome 149:c62c4b2d6a15 2989 /// If the idle callback is registered, it will be activated passing
WiredHome 149:c62c4b2d6a15 2990 /// a parameter indicating the percent complete, which may be of value.
WiredHome 149:c62c4b2d6a15 2991 ///
WiredHome 72:ecffe56af969 2992 /// @param[in] x is the left edge of the region to capture
WiredHome 72:ecffe56af969 2993 /// @param[in] y is the top edge of the region to capture
WiredHome 72:ecffe56af969 2994 /// @param[in] w is the width of the region to capture
WiredHome 72:ecffe56af969 2995 /// @param[in] h is the height of the region to capture.
WiredHome 163:17526689a3ed 2996 /// @param[in] Name_BMP is the filename to write the image to.
WiredHome 163:17526689a3ed 2997 /// @param[in] bitsPerPixel is optional, defaults to 24, and only
WiredHome 163:17526689a3ed 2998 /// accepts the values 24, 8
WiredHome 164:76edd7d9cb68 2999 /// NOTE: The downscaling is CPU intensive, and the operation
WiredHome 164:76edd7d9cb68 3000 /// takes longer.
WiredHome 167:8aa3fb2a5a31 3001 /// @returns @ref RetCode_t value.
WiredHome 72:ecffe56af969 3002 ///
WiredHome 163:17526689a3ed 3003 RetCode_t PrintScreen(loc_t x, loc_t y, dim_t w, dim_t h, const char *Name_BMP, uint8_t bitsPerPixel = 24);
WiredHome 125:7a0b70f56550 3004
WiredHome 72:ecffe56af969 3005
WiredHome 96:40b74dd3695b 3006 /// This method captures the specified area as a 24-bit bitmap file
WiredHome 96:40b74dd3695b 3007 /// and delivers it to the previously attached callback.
WiredHome 96:40b74dd3695b 3008 ///
WiredHome 96:40b74dd3695b 3009 /// Even though this is a 16-bit display, the stored image is in
WiredHome 96:40b74dd3695b 3010 /// 24-bit format.
WiredHome 96:40b74dd3695b 3011 ///
WiredHome 96:40b74dd3695b 3012 /// This method will interrogate the current display setting and
WiredHome 96:40b74dd3695b 3013 /// create a bitmap based on those settings. For instance, if
WiredHome 96:40b74dd3695b 3014 /// only layer 1 is visible, then the bitmap is only layer 1. However,
WiredHome 96:40b74dd3695b 3015 /// if there is some other operation in effect (transparent mode), it
WiredHome 96:40b74dd3695b 3016 /// will return the blended image.
WiredHome 96:40b74dd3695b 3017 ///
WiredHome 149:c62c4b2d6a15 3018 /// If the idle callback is registered, it will be activated passing
WiredHome 149:c62c4b2d6a15 3019 /// a parameter indicating the percent complete, which may be of value.
WiredHome 149:c62c4b2d6a15 3020 ///
WiredHome 96:40b74dd3695b 3021 /// @param[in] x is the left edge of the region to capture
WiredHome 96:40b74dd3695b 3022 /// @param[in] y is the top edge of the region to capture
WiredHome 96:40b74dd3695b 3023 /// @param[in] w is the width of the region to capture
WiredHome 96:40b74dd3695b 3024 /// @param[in] h is the height of the region to capture.
WiredHome 164:76edd7d9cb68 3025 /// @param[in] bitsPerPixel is optional, defaults to 24, and only
WiredHome 164:76edd7d9cb68 3026 /// accepts the values 24, 8
WiredHome 164:76edd7d9cb68 3027 /// NOTE: The downscaling is CPU intensive, and the operation
WiredHome 164:76edd7d9cb68 3028 /// takes longer.
WiredHome 167:8aa3fb2a5a31 3029 /// @returns @ref RetCode_t value.
WiredHome 96:40b74dd3695b 3030 ///
WiredHome 164:76edd7d9cb68 3031 RetCode_t PrintScreen(loc_t x, loc_t y, dim_t w, dim_t h, uint8_t bitsPerPixel = 24);
WiredHome 125:7a0b70f56550 3032
WiredHome 96:40b74dd3695b 3033
WiredHome 96:40b74dd3695b 3034 /// PrintScreen callback registration.
WiredHome 96:40b74dd3695b 3035 ///
WiredHome 96:40b74dd3695b 3036 /// This method attaches a simple c-compatible callback of type PrintCallback_T.
WiredHome 96:40b74dd3695b 3037 /// Then, the PrintScreen(x,y,w,h) method is called. Each chunk of data in the
WiredHome 96:40b74dd3695b 3038 /// BMP file to be created is passed to this callback.
WiredHome 96:40b74dd3695b 3039 ///
WiredHome 123:2f45e80fec5f 3040 /// @param callback is the optional callback function. Without a callback function
WiredHome 123:2f45e80fec5f 3041 /// it will unregister the handler.
WiredHome 96:40b74dd3695b 3042 ///
WiredHome 123:2f45e80fec5f 3043 void AttachPrintHandler(PrintCallback_T callback = NULL) { c_callback = callback; }
WiredHome 96:40b74dd3695b 3044
WiredHome 125:7a0b70f56550 3045
WiredHome 96:40b74dd3695b 3046 /// PrintScreen callback registration.
WiredHome 96:40b74dd3695b 3047 ///
WiredHome 96:40b74dd3695b 3048 /// This method attaches a c++ class method as a callback of type PrintCallback_T.
WiredHome 96:40b74dd3695b 3049 /// Then, the PrintScreen(x,y,w,h) method is called. Each chunk of data in the
WiredHome 96:40b74dd3695b 3050 /// BMP file to be created is passed to this callback.
WiredHome 96:40b74dd3695b 3051 ///
WiredHome 96:40b74dd3695b 3052 /// @param object is the class hosting the callback function.
WiredHome 102:fc60bfa0199f 3053 /// @param method is the callback method in the object to activate.
WiredHome 96:40b74dd3695b 3054 ///
WiredHome 96:40b74dd3695b 3055 template <class T>
WiredHome 102:fc60bfa0199f 3056 void AttachPrintHandler(T *object, RetCode_t (T::*method)(void)) {
WiredHome 102:fc60bfa0199f 3057 obj_callback = (FPointerDummy *)object;
WiredHome 108:7415c405ee08 3058 method_callback = (uint32_t (FPointerDummy::*)(uint32_t, uint8_t *, uint16_t))method;
WiredHome 96:40b74dd3695b 3059 }
WiredHome 96:40b74dd3695b 3060
WiredHome 125:7a0b70f56550 3061
WiredHome 72:ecffe56af969 3062 /// This method captures the specified area as a 24-bit bitmap file,
WiredHome 72:ecffe56af969 3063 /// including the option of layer selection.
WiredHome 72:ecffe56af969 3064 ///
WiredHome 125:7a0b70f56550 3065 /// @note This method is deprecated as the alternate PrintScreen API
WiredHome 74:686faa218914 3066 /// automatically examines the display layer configuration.
WiredHome 74:686faa218914 3067 /// Therefore, calls to this API will ignore the layer parameter
WiredHome 74:686faa218914 3068 /// and automatically execute the other method.
WiredHome 74:686faa218914 3069 ///
WiredHome 72:ecffe56af969 3070 /// Even though this is a 16-bit display, the stored image is in
WiredHome 72:ecffe56af969 3071 /// 24-bit format.
WiredHome 72:ecffe56af969 3072 ///
WiredHome 72:ecffe56af969 3073 /// @param[in] layer is 0 or 1 to select the layer to extract.
WiredHome 72:ecffe56af969 3074 /// @param[in] x is the left edge of the region to capture
WiredHome 72:ecffe56af969 3075 /// @param[in] y is the top edge of the region to capture
WiredHome 72:ecffe56af969 3076 /// @param[in] w is the width of the region to capture
WiredHome 72:ecffe56af969 3077 /// @param[in] h is the height of the region to capture.
WiredHome 72:ecffe56af969 3078 /// @param[out] Name_BMP is the filename to write the image to.
WiredHome 167:8aa3fb2a5a31 3079 /// @returns @ref RetCode_t value.
WiredHome 72:ecffe56af969 3080 ///
WiredHome 72:ecffe56af969 3081 RetCode_t PrintScreen(uint16_t layer, loc_t x, loc_t y, dim_t w, dim_t h, const char *Name_BMP);
WiredHome 125:7a0b70f56550 3082
WiredHome 72:ecffe56af969 3083
WiredHome 123:2f45e80fec5f 3084 /// idle callback registration.
WiredHome 123:2f45e80fec5f 3085 ///
WiredHome 125:7a0b70f56550 3086 /// This method attaches a simple c-compatible callback of type IdleCallback_T.
WiredHome 123:2f45e80fec5f 3087 /// Then, at any time when the display driver is waiting, it will call the
WiredHome 123:2f45e80fec5f 3088 /// registered function. This is probably most useful if you want to service
WiredHome 123:2f45e80fec5f 3089 /// a watchdog, when you may have called an API that will "hang" waiting
WiredHome 123:2f45e80fec5f 3090 /// on the user.
WiredHome 123:2f45e80fec5f 3091 ///
WiredHome 149:c62c4b2d6a15 3092 /// @code
WiredHome 149:c62c4b2d6a15 3093 /// RetCode_t myIdle_handler(RA8875::IdleReason_T reason, uint16_t param)
WiredHome 149:c62c4b2d6a15 3094 /// {
WiredHome 149:c62c4b2d6a15 3095 /// static uint16_t lastProgress = 0xFFFF;
WiredHome 149:c62c4b2d6a15 3096 ///
WiredHome 149:c62c4b2d6a15 3097 /// if (reason == RA8875::progress && param != lastProgress) {
WiredHome 149:c62c4b2d6a15 3098 /// printf("Progress %3d%%\r\n", param);
WiredHome 149:c62c4b2d6a15 3099 /// lastProgress = progress;
WiredHome 149:c62c4b2d6a15 3100 /// }
WiredHome 149:c62c4b2d6a15 3101 /// return noerror;
WiredHome 149:c62c4b2d6a15 3102 /// }
WiredHome 149:c62c4b2d6a15 3103 ///
WiredHome 149:c62c4b2d6a15 3104 /// ...
WiredHome 149:c62c4b2d6a15 3105 /// lcd.AttachIdleHandler(myIdle_handler);
WiredHome 149:c62c4b2d6a15 3106 /// ...
WiredHome 149:c62c4b2d6a15 3107 /// RetCode_t r = lcd.PrintScreen(0,0,LCD_W,LCD_H,"/local/print.bmp");
WiredHome 149:c62c4b2d6a15 3108 /// if (r ...)
WiredHome 149:c62c4b2d6a15 3109 /// @endcode
WiredHome 149:c62c4b2d6a15 3110 ///
WiredHome 149:c62c4b2d6a15 3111 ///
WiredHome 123:2f45e80fec5f 3112 /// @param callback is the idle callback function. Without a callback function
WiredHome 123:2f45e80fec5f 3113 /// it will unregister the handler.
WiredHome 123:2f45e80fec5f 3114 ///
WiredHome 123:2f45e80fec5f 3115 void AttachIdleHandler(IdleCallback_T callback = NULL) { idle_callback = callback; }
WiredHome 57:bd53a9e165a1 3116
WiredHome 133:e36dcfc2d756 3117
WiredHome 19:3f82c1161fd2 3118 #ifdef PERF_METRICS
WiredHome 19:3f82c1161fd2 3119 /// Clear the performance metrics to zero.
WiredHome 19:3f82c1161fd2 3120 void ClearPerformance();
WiredHome 19:3f82c1161fd2 3121
WiredHome 66:468a11f05580 3122 /// Count idle time.
WiredHome 66:468a11f05580 3123 ///
WiredHome 72:ecffe56af969 3124 /// @param[in] t is the amount of idle time to accumulate.
WiredHome 66:468a11f05580 3125 ///
WiredHome 66:468a11f05580 3126 void CountIdleTime(uint32_t t);
WiredHome 66:468a11f05580 3127
WiredHome 19:3f82c1161fd2 3128 /// Report the performance metrics for drawing functions using
WiredHome 41:2956a0a221e5 3129 /// the available serial channel.
WiredHome 41:2956a0a221e5 3130 ///
WiredHome 72:ecffe56af969 3131 /// @param[in,out] pc is the serial channel to write to.
WiredHome 41:2956a0a221e5 3132 ///
WiredHome 41:2956a0a221e5 3133 void ReportPerformance(Serial & pc);
WiredHome 19:3f82c1161fd2 3134 #endif
WiredHome 19:3f82c1161fd2 3135
hexley 54:e117ad10fba6 3136
WiredHome 19:3f82c1161fd2 3137 private:
WiredHome 182:8832d03a2a29 3138 void InitAllMemberVars();
WiredHome 182:8832d03a2a29 3139
WiredHome 124:1690a7ae871c 3140 /// Touch panel parameters - common to both resistive and capacitive
WiredHome 124:1690a7ae871c 3141
WiredHome 124:1690a7ae871c 3142 /// Data type to indicate which TP, if any, is in use.
WiredHome 124:1690a7ae871c 3143 typedef enum {
WiredHome 124:1690a7ae871c 3144 TP_NONE, ///< no touch panel in use
WiredHome 124:1690a7ae871c 3145 TP_RES, ///< resistive touch panel using RA8875
WiredHome 165:695c24cc5197 3146 TP_FT5206, ///< Capacitive touch panel using FT5206
WiredHome 165:695c24cc5197 3147 TP_CAP=TP_FT5206, ///< DEPRECATED: used TP_CAP5206 for that chip-set
WiredHome 165:695c24cc5197 3148 TP_GSL1680, ///< Capacitive touch panel using GSL1680 chip
WiredHome 124:1690a7ae871c 3149 } WhichTP_T;
WiredHome 124:1690a7ae871c 3150
WiredHome 124:1690a7ae871c 3151 /// boolean flag set true when using Capacitive touch panel, and false
WiredHome 124:1690a7ae871c 3152 /// for resistive.
WiredHome 124:1690a7ae871c 3153 WhichTP_T useTouchPanel; ///< Indicates which TP is selected for use.
WiredHome 124:1690a7ae871c 3154
WiredHome 124:1690a7ae871c 3155 /// Touch State used by TouchPanelReadable. See @ref TouchCode_t.
WiredHome 124:1690a7ae871c 3156 TouchCode_t touchState;
WiredHome 124:1690a7ae871c 3157
WiredHome 124:1690a7ae871c 3158 ////////////////// Start of Capacitive Touch Panel parameters
WiredHome 124:1690a7ae871c 3159
WiredHome 162:a2d7f1988711 3160 int RoundUp(int value, int roundTo);
WiredHome 165:695c24cc5197 3161 uint8_t FT5206_TouchPositions(void);
WiredHome 165:695c24cc5197 3162 uint8_t FT5206_ReadRegU8(uint8_t reg);
WiredHome 165:695c24cc5197 3163 uint8_t GSL1680_TouchPositions(void);
WiredHome 165:695c24cc5197 3164 uint8_t GSL1680_ReadRegU8(uint8_t reg, uint8_t * buf, int count);
WiredHome 165:695c24cc5197 3165 RetCode_t FT5206_Init();
WiredHome 165:695c24cc5197 3166 RetCode_t GSL1680_Init();
WiredHome 165:695c24cc5197 3167
WiredHome 124:1690a7ae871c 3168 void TouchPanelISR(void);
WiredHome 124:1690a7ae871c 3169 uint16_t numberOfTouchPoints;
WiredHome 165:695c24cc5197 3170 uint8_t gesture; ///< Holds the reported gesture information (which doesn't work well for the FT5206)
WiredHome 124:1690a7ae871c 3171
WiredHome 124:1690a7ae871c 3172 /// Touch Information data structure
WiredHome 124:1690a7ae871c 3173 typedef struct {
WiredHome 124:1690a7ae871c 3174 uint8_t touchID; ///< Contains the touch ID, which is the "order" of touch, from 0 to n-1
WiredHome 124:1690a7ae871c 3175 TouchCode_t touchCode; ///< Contains the touch code; no_touch, touch, held, release
WiredHome 124:1690a7ae871c 3176 point_t coordinates; ///< Contains the X,Y coordinate of the touch
WiredHome 124:1690a7ae871c 3177 } touchInfo_T;
WiredHome 124:1690a7ae871c 3178
WiredHome 166:53fd4a876dac 3179 touchInfo_T * touchInfo; /// Storage allocated by the constructor to contains the touch information
WiredHome 124:1690a7ae871c 3180
WiredHome 155:b3f225ae572c 3181 #if MBED_VERSION >= MBED_ENCODE_VERSION(5,8,0)
WiredHome 155:b3f225ae572c 3182 Thread eventThread;
WiredHome 155:b3f225ae572c 3183 EventQueue queue;
WiredHome 155:b3f225ae572c 3184 #endif
WiredHome 124:1690a7ae871c 3185 InterruptIn * m_irq;
WiredHome 124:1690a7ae871c 3186 I2C * m_i2c;
WiredHome 165:695c24cc5197 3187 int m_addr; /// I2C Address of the Cap Touch Controller
WiredHome 165:695c24cc5197 3188 //uint8_t data[2]; /// Transfer data for the I2C interface
WiredHome 124:1690a7ae871c 3189
WiredHome 124:1690a7ae871c 3190 bool panelTouched;
WiredHome 124:1690a7ae871c 3191
WiredHome 124:1690a7ae871c 3192 ////////////////// Start of Resistive Touch Panel parameters
WiredHome 124:1690a7ae871c 3193
WiredHome 124:1690a7ae871c 3194 /// Resistive Touch Panel register name definitions
WiredHome 77:9206c13aa527 3195 #define TPCR0 0x70
WiredHome 77:9206c13aa527 3196 #define TPCR1 0x71
WiredHome 77:9206c13aa527 3197 #define TPXH 0x72
WiredHome 77:9206c13aa527 3198 #define TPYH 0x73
WiredHome 77:9206c13aa527 3199 #define TPXYL 0x74
WiredHome 77:9206c13aa527 3200 #define INTC1 0xF0
WiredHome 77:9206c13aa527 3201 #define INTC2 0xF1
hexley 54:e117ad10fba6 3202
hexley 54:e117ad10fba6 3203 /// Specify the default settings for the Touch Panel, where different from the chip defaults
WiredHome 77:9206c13aa527 3204 #define TP_MODE_DEFAULT TP_MODE_AUTO
WiredHome 77:9206c13aa527 3205 #define TP_DEBOUNCE_DEFAULT TP_DEBOUNCE_ON
WiredHome 77:9206c13aa527 3206 #define TP_ADC_CLKDIV_DEFAULT TP_ADC_CLKDIV_8
hexley 54:e117ad10fba6 3207
WiredHome 77:9206c13aa527 3208 #define TP_ADC_SAMPLE_DEFAULT_CLKS TP_ADC_SAMPLE_8192_CLKS
hexley 54:e117ad10fba6 3209
hexley 54:e117ad10fba6 3210 /// Other Touch Panel params
WiredHome 77:9206c13aa527 3211 #define TPBUFSIZE 16 // Depth of the averaging buffers for x and y data
hexley 54:e117ad10fba6 3212
WiredHome 83:7bad0068cca0 3213 // Needs both a ticker and a timer. (could have created a timer from the ticker, but this is easier).
WiredHome 83:7bad0068cca0 3214 // on a touch, the timer is reset.
WiredHome 83:7bad0068cca0 3215 // the ticker monitors the timer to see if it has been a long time since
WiredHome 83:7bad0068cca0 3216 // a touch, and if so, it then clears the sample counter so it doesn't get partial old
WiredHome 83:7bad0068cca0 3217 // and partial new.
WiredHome 83:7bad0068cca0 3218
WiredHome 83:7bad0068cca0 3219 /// Touch Panel ticker
WiredHome 165:695c24cc5197 3220 /// This it bound to a timer to call the _TouchTicker() function periodically.
WiredHome 165:695c24cc5197 3221 ///
WiredHome 83:7bad0068cca0 3222 Ticker touchTicker;
WiredHome 83:7bad0068cca0 3223
WiredHome 83:7bad0068cca0 3224 /// Touch Panel timer
WiredHome 165:695c24cc5197 3225 /// Reset on a touch, to expire on a non-touch
WiredHome 165:695c24cc5197 3226 ///
WiredHome 165:695c24cc5197 3227 Timer timeSinceTouch;
WiredHome 83:7bad0068cca0 3228
WiredHome 83:7bad0068cca0 3229 /// keeps track of which sample we're collecting to filter out the noise.
WiredHome 83:7bad0068cca0 3230 int touchSample;
WiredHome 83:7bad0068cca0 3231
WiredHome 83:7bad0068cca0 3232 /// Private function for touch ticker callback.
WiredHome 83:7bad0068cca0 3233 void _TouchTicker(void);
WiredHome 83:7bad0068cca0 3234
WiredHome 77:9206c13aa527 3235 /// Touch Panel calibration matrix.
WiredHome 77:9206c13aa527 3236 tpMatrix_t tpMatrix;
hexley 54:e117ad10fba6 3237
WiredHome 157:1565f38ca44b 3238 /// RESISTIVE TP: The fully qualified filename for the RESISTIVE touch panel configuration settings.
WiredHome 157:1565f38ca44b 3239 const char * tpFQFN;
WiredHome 157:1565f38ca44b 3240
WiredHome 157:1565f38ca44b 3241 /// RESISTIVE TP: The text message shown to the user during the calibration process.
WiredHome 157:1565f38ca44b 3242 const char * tpCalMessage;
WiredHome 157:1565f38ca44b 3243
WiredHome 157:1565f38ca44b 3244 /// Internal method that performs the TS Cal when the user has so-configured it
WiredHome 157:1565f38ca44b 3245 RetCode_t _internal_ts_cal();
WiredHome 157:1565f38ca44b 3246
WiredHome 157:1565f38ca44b 3247
WiredHome 124:1690a7ae871c 3248 ////////////////// End of Touch Panel parameters
WiredHome 124:1690a7ae871c 3249
WiredHome 124:1690a7ae871c 3250
WiredHome 29:422616aa04bd 3251 /// Internal function to put a character using the built-in (internal) font engine
WiredHome 29:422616aa04bd 3252 ///
WiredHome 101:e0aad446094a 3253 /// @param[in] c is the character to put to the screen.
WiredHome 29:422616aa04bd 3254 /// @returns the character put.
WiredHome 29:422616aa04bd 3255 ///
WiredHome 29:422616aa04bd 3256 int _internal_putc(int c);
WiredHome 29:422616aa04bd 3257
WiredHome 29:422616aa04bd 3258 /// Internal function to put a character using the external font engine
WiredHome 29:422616aa04bd 3259 ///
WiredHome 101:e0aad446094a 3260 /// @param[in] c is the character to put to the screen.
WiredHome 29:422616aa04bd 3261 /// @returns the character put.
WiredHome 29:422616aa04bd 3262 ///
WiredHome 29:422616aa04bd 3263 int _external_putc(int c);
WiredHome 29:422616aa04bd 3264
WiredHome 101:e0aad446094a 3265 /// Internal function to get the actual width of a character when using the external font engine
WiredHome 101:e0aad446094a 3266 ///
WiredHome 101:e0aad446094a 3267 /// @param[in] c is the character to get the width.
WiredHome 101:e0aad446094a 3268 /// @returns the width in pixels of the character. zero if not found.
WiredHome 101:e0aad446094a 3269 ///
WiredHome 101:e0aad446094a 3270 int _external_getCharWidth(int c);
WiredHome 101:e0aad446094a 3271
WiredHome 133:e36dcfc2d756 3272 /// Write color to an RGB register set
WiredHome 133:e36dcfc2d756 3273 ///
WiredHome 133:e36dcfc2d756 3274 /// This API takes a color value, and writes it into the specified
WiredHome 133:e36dcfc2d756 3275 /// color registers, which are a trio of 3 registers. The actual
WiredHome 133:e36dcfc2d756 3276 /// trio write is performed based on whether the display is configured
WiredHome 133:e36dcfc2d756 3277 /// for 8 or 16 bits per pixel.
WiredHome 133:e36dcfc2d756 3278 ///
WiredHome 133:e36dcfc2d756 3279 /// @param[in] regAddr is the register address starting the trio
WiredHome 133:e36dcfc2d756 3280 /// @param[in] color is the color to write
WiredHome 167:8aa3fb2a5a31 3281 /// @returns @ref RetCode_t value.
WiredHome 133:e36dcfc2d756 3282 ///
WiredHome 133:e36dcfc2d756 3283 RetCode_t _writeColorTrio(uint8_t regAddr, color_t color);
WiredHome 133:e36dcfc2d756 3284
WiredHome 133:e36dcfc2d756 3285 /// Read color from an RGB register set
WiredHome 133:e36dcfc2d756 3286 ///
WiredHome 133:e36dcfc2d756 3287 /// This API reads a color value from a trio of registers. The actual
WiredHome 133:e36dcfc2d756 3288 /// trio write is performed based on whether the display is configured
WiredHome 133:e36dcfc2d756 3289 /// for 8 or 16 bits per pixel.
WiredHome 133:e36dcfc2d756 3290 ///
WiredHome 133:e36dcfc2d756 3291 /// @param[in] regAddr is the register address starting the trio
WiredHome 133:e36dcfc2d756 3292 /// @returns color_t value
WiredHome 133:e36dcfc2d756 3293 ///
WiredHome 133:e36dcfc2d756 3294 color_t _readColorTrio(uint8_t regAddr);
WiredHome 133:e36dcfc2d756 3295
WiredHome 133:e36dcfc2d756 3296
WiredHome 105:4f116006ba1f 3297 /// Convert a 16-bit color value to an 8-bit value
WiredHome 105:4f116006ba1f 3298 ///
WiredHome 105:4f116006ba1f 3299 /// @param[in] c16 is the 16-bit color value to convert.
WiredHome 105:4f116006ba1f 3300 /// @returns 8-bit color value.
WiredHome 105:4f116006ba1f 3301 ///
WiredHome 105:4f116006ba1f 3302 uint8_t _cvt16to8(color_t c16);
WiredHome 105:4f116006ba1f 3303
WiredHome 105:4f116006ba1f 3304 /// Convert an 8-bit color value to a 16-bit value
WiredHome 105:4f116006ba1f 3305 ///
WiredHome 105:4f116006ba1f 3306 /// @param[in] c8 is the 8-bit color value to convert.
WiredHome 105:4f116006ba1f 3307 /// @returns 16-bit color value.
WiredHome 105:4f116006ba1f 3308 ///
WiredHome 105:4f116006ba1f 3309 color_t _cvt8to16(uint8_t c8);
WiredHome 105:4f116006ba1f 3310
WiredHome 19:3f82c1161fd2 3311 /// Select the peripheral to use it.
WiredHome 19:3f82c1161fd2 3312 ///
WiredHome 72:ecffe56af969 3313 /// @param[in] chipsel when true will select the peripheral, and when false
WiredHome 19:3f82c1161fd2 3314 /// will deselect the chip. This is the logical selection, and
WiredHome 19:3f82c1161fd2 3315 /// the pin selection is the invert of this.
WiredHome 167:8aa3fb2a5a31 3316 /// @returns @ref RetCode_t value.
WiredHome 19:3f82c1161fd2 3317 ///
WiredHome 79:544eb4964795 3318 RetCode_t _select(bool chipsel);
WiredHome 19:3f82c1161fd2 3319
WiredHome 66:468a11f05580 3320 /// Wait while the status register indicates the controller is busy.
WiredHome 66:468a11f05580 3321 ///
WiredHome 72:ecffe56af969 3322 /// @param[in] mask is the mask of bits to monitor.
WiredHome 66:468a11f05580 3323 /// @returns true if a normal exit.
WiredHome 66:468a11f05580 3324 /// @returns false if a timeout exit.
WiredHome 66:468a11f05580 3325 ///
WiredHome 66:468a11f05580 3326 bool _WaitWhileBusy(uint8_t mask);
WiredHome 66:468a11f05580 3327
WiredHome 66:468a11f05580 3328 /// Wait while the the register anded with the mask is true.
WiredHome 66:468a11f05580 3329 ///
WiredHome 72:ecffe56af969 3330 /// @param[in] reg is the register to monitor
WiredHome 72:ecffe56af969 3331 /// @param[in] mask is the bit mask to monitor
WiredHome 66:468a11f05580 3332 /// @returns true if it was a normal exit
WiredHome 66:468a11f05580 3333 /// @returns false if it was a timeout that caused the exit.
WiredHome 66:468a11f05580 3334 ///
WiredHome 66:468a11f05580 3335 bool _WaitWhileReg(uint8_t reg, uint8_t mask);
WiredHome 66:468a11f05580 3336
WiredHome 68:ab08efabfc88 3337 /// set the spi port to either the write or the read speed.
WiredHome 68:ab08efabfc88 3338 ///
WiredHome 68:ab08efabfc88 3339 /// This is a private API used to toggle between the write
WiredHome 68:ab08efabfc88 3340 /// and the read speed for the SPI port to the RA8875, since
WiredHome 68:ab08efabfc88 3341 /// it can accept writes faster than reads.
WiredHome 68:ab08efabfc88 3342 ///
WiredHome 72:ecffe56af969 3343 /// @param[in] writeSpeed when true selects the write frequency,
WiredHome 68:ab08efabfc88 3344 /// and when false it selects the read frequency.
WiredHome 68:ab08efabfc88 3345 ///
WiredHome 68:ab08efabfc88 3346 void _setWriteSpeed(bool writeSpeed);
WiredHome 68:ab08efabfc88 3347
WiredHome 19:3f82c1161fd2 3348 /// The most primitive - to write a data value to the SPI interface.
WiredHome 19:3f82c1161fd2 3349 ///
WiredHome 72:ecffe56af969 3350 /// @param[in] data is the value to write.
WiredHome 19:3f82c1161fd2 3351 /// @returns a value read from the port, since SPI is often shift
WiredHome 19:3f82c1161fd2 3352 /// in while shifting out.
WiredHome 19:3f82c1161fd2 3353 ///
WiredHome 79:544eb4964795 3354 unsigned char _spiwrite(unsigned char data);
WiredHome 19:3f82c1161fd2 3355
WiredHome 19:3f82c1161fd2 3356 /// The most primitive - to read a data value to the SPI interface.
WiredHome 19:3f82c1161fd2 3357 ///
WiredHome 19:3f82c1161fd2 3358 /// This is really just a specialcase of the write command, where
WiredHome 19:3f82c1161fd2 3359 /// the value zero is written in order to read.
WiredHome 19:3f82c1161fd2 3360 ///
WiredHome 19:3f82c1161fd2 3361 /// @returns a value read from the port, since SPI is often shift
WiredHome 19:3f82c1161fd2 3362 /// in while shifting out.
WiredHome 19:3f82c1161fd2 3363 ///
WiredHome 79:544eb4964795 3364 unsigned char _spiread();
WiredHome 19:3f82c1161fd2 3365
WiredHome 75:ca78388cfd77 3366 const uint8_t * pKeyMap;
WiredHome 75:ca78388cfd77 3367
WiredHome 19:3f82c1161fd2 3368 SPI spi; ///< spi port
WiredHome 68:ab08efabfc88 3369 bool spiWriteSpeed; ///< indicates if the current mode is write or read
WiredHome 68:ab08efabfc88 3370 unsigned long spiwritefreq; ///< saved write freq
WiredHome 66:468a11f05580 3371 unsigned long spireadfreq; ///< saved read freq
WiredHome 165:695c24cc5197 3372 DigitalOut cs; ///< RA8875 chip select pin, assumed active low
WiredHome 165:695c24cc5197 3373 DigitalOut res; ///< RA8875 reset pin, assumed active low
WiredHome 165:695c24cc5197 3374 DigitalOut * m_wake; ///< GSL1680 wake pin
WiredHome 90:d113d71ae4f0 3375
WiredHome 105:4f116006ba1f 3376 // display metrics to avoid lengthy spi read queries
WiredHome 105:4f116006ba1f 3377 uint8_t screenbpp; ///< configured bits per pixel
WiredHome 90:d113d71ae4f0 3378 dim_t screenwidth; ///< configured screen width
WiredHome 90:d113d71ae4f0 3379 dim_t screenheight; ///< configured screen height
WiredHome 111:efe436c43aba 3380 rect_t windowrect; ///< window commands are held here for speed of access
WiredHome 90:d113d71ae4f0 3381 bool portraitmode; ///< set true when in portrait mode (w,h are reversed)
WiredHome 90:d113d71ae4f0 3382
WiredHome 19:3f82c1161fd2 3383 const unsigned char * font; ///< reference to an external font somewhere in memory
WiredHome 98:ecebed9b80b2 3384 uint8_t extFontHeight; ///< computed from the font table when the user sets the font
WiredHome 98:ecebed9b80b2 3385 uint8_t extFontWidth; ///< computed from the font table when the user sets the font
WiredHome 98:ecebed9b80b2 3386
WiredHome 90:d113d71ae4f0 3387 loc_t cursor_x, cursor_y; ///< used for external fonts only
WiredHome 19:3f82c1161fd2 3388
WiredHome 19:3f82c1161fd2 3389 #ifdef PERF_METRICS
WiredHome 19:3f82c1161fd2 3390 typedef enum
WiredHome 19:3f82c1161fd2 3391 {
WiredHome 19:3f82c1161fd2 3392 PRF_CLS,
WiredHome 41:2956a0a221e5 3393 PRF_DRAWPIXEL,
WiredHome 41:2956a0a221e5 3394 PRF_PIXELSTREAM,
WiredHome 109:7b94f06f085b 3395 PRF_BOOLSTREAM,
WiredHome 41:2956a0a221e5 3396 PRF_READPIXEL,
WiredHome 41:2956a0a221e5 3397 PRF_READPIXELSTREAM,
WiredHome 19:3f82c1161fd2 3398 PRF_DRAWLINE,
WiredHome 19:3f82c1161fd2 3399 PRF_DRAWRECTANGLE,
WiredHome 19:3f82c1161fd2 3400 PRF_DRAWROUNDEDRECTANGLE,
WiredHome 19:3f82c1161fd2 3401 PRF_DRAWTRIANGLE,
WiredHome 19:3f82c1161fd2 3402 PRF_DRAWCIRCLE,
WiredHome 19:3f82c1161fd2 3403 PRF_DRAWELLIPSE,
WiredHome 131:5bd6ba2ee4a1 3404 PRF_BLOCKMOVE,
WiredHome 182:8832d03a2a29 3405 METRICCOUNT = PRF_BLOCKMOVE
WiredHome 19:3f82c1161fd2 3406 } method_e;
WiredHome 19:3f82c1161fd2 3407 unsigned long metrics[METRICCOUNT];
WiredHome 75:ca78388cfd77 3408 unsigned long idletime_usec;
WiredHome 19:3f82c1161fd2 3409 void RegisterPerformance(method_e method);
WiredHome 19:3f82c1161fd2 3410 Timer performance;
WiredHome 19:3f82c1161fd2 3411 #endif
WiredHome 96:40b74dd3695b 3412
WiredHome 96:40b74dd3695b 3413 RetCode_t _printCallback(RA8875::filecmd_t cmd, uint8_t * buffer, uint16_t size);
WiredHome 96:40b74dd3695b 3414
WiredHome 96:40b74dd3695b 3415 FILE * _printFH; ///< PrintScreen file handle
WiredHome 96:40b74dd3695b 3416
WiredHome 96:40b74dd3695b 3417 RetCode_t privateCallback(filecmd_t cmd, uint8_t * buffer, uint16_t size) {
WiredHome 96:40b74dd3695b 3418 if (c_callback != NULL) {
WiredHome 96:40b74dd3695b 3419 return (*c_callback)(cmd, buffer, size);
WiredHome 96:40b74dd3695b 3420 }
WiredHome 96:40b74dd3695b 3421 else {
WiredHome 96:40b74dd3695b 3422 if (obj_callback != NULL && method_callback != NULL) {
WiredHome 96:40b74dd3695b 3423 return (obj_callback->*method_callback)(cmd, buffer, size);
WiredHome 96:40b74dd3695b 3424 }
WiredHome 96:40b74dd3695b 3425 }
WiredHome 96:40b74dd3695b 3426 return noerror;
WiredHome 96:40b74dd3695b 3427 }
WiredHome 96:40b74dd3695b 3428
WiredHome 96:40b74dd3695b 3429 RetCode_t (* c_callback)(filecmd_t cmd, uint8_t * buffer, uint16_t size);
WiredHome 96:40b74dd3695b 3430 FPointerDummy *obj_callback;
WiredHome 96:40b74dd3695b 3431 RetCode_t (FPointerDummy::*method_callback)(filecmd_t cmd, uint8_t * buffer, uint16_t size);
WiredHome 149:c62c4b2d6a15 3432 RetCode_t (* idle_callback)(IdleReason_T reason, uint16_t param);
WiredHome 181:0032d1b8f5d4 3433
WiredHome 181:0032d1b8f5d4 3434 orientation_t screen_orientation;
WiredHome 181:0032d1b8f5d4 3435 point_t TranslateOrientation(point_t rawPoint);
WiredHome 19:3f82c1161fd2 3436 };
WiredHome 19:3f82c1161fd2 3437
WiredHome 96:40b74dd3695b 3438
WiredHome 19:3f82c1161fd2 3439 //} // namespace
WiredHome 19:3f82c1161fd2 3440
WiredHome 19:3f82c1161fd2 3441 //using namespace SW_graphics;
WiredHome 19:3f82c1161fd2 3442
WiredHome 23:a50ded45dbaf 3443
WiredHome 23:a50ded45dbaf 3444 #ifdef TESTENABLE
WiredHome 23:a50ded45dbaf 3445 // ______________ ______________ ______________ _______________
WiredHome 23:a50ded45dbaf 3446 // /_____ _____/ / ___________/ / ___________/ /_____ ______/
WiredHome 23:a50ded45dbaf 3447 // / / / / / / / /
WiredHome 23:a50ded45dbaf 3448 // / / / /___ / /__________ / /
WiredHome 23:a50ded45dbaf 3449 // / / / ____/ /__________ / / /
WiredHome 23:a50ded45dbaf 3450 // / / / / / / / /
WiredHome 23:a50ded45dbaf 3451 // / / / /__________ ___________/ / / /
WiredHome 23:a50ded45dbaf 3452 // /__/ /_____________/ /_____________/ /__/
WiredHome 23:a50ded45dbaf 3453
WiredHome 23:a50ded45dbaf 3454 #include "WebColors.h"
WiredHome 23:a50ded45dbaf 3455 #include <algorithm>
WiredHome 23:a50ded45dbaf 3456
WiredHome 23:a50ded45dbaf 3457 extern "C" void mbed_reset();
WiredHome 23:a50ded45dbaf 3458
WiredHome 23:a50ded45dbaf 3459 /// This activates a small set of tests for the graphics library.
WiredHome 23:a50ded45dbaf 3460 ///
WiredHome 23:a50ded45dbaf 3461 /// Call this API and pass it the reference to the display class.
WiredHome 23:a50ded45dbaf 3462 /// It will then run a series of tests. It accepts interaction via
WiredHome 23:a50ded45dbaf 3463 /// stdin to switch from automatic test mode to manual, run a specific
WiredHome 23:a50ded45dbaf 3464 /// test, or to exit the test mode.
WiredHome 23:a50ded45dbaf 3465 ///
WiredHome 72:ecffe56af969 3466 /// @param[in] lcd is a reference to the display class.
WiredHome 72:ecffe56af969 3467 /// @param[in] pc is a reference to a serial interface, typically the USB to PC.
WiredHome 23:a50ded45dbaf 3468 ///
WiredHome 23:a50ded45dbaf 3469 void RunTestSet(RA8875 & lcd, Serial & pc);
WiredHome 23:a50ded45dbaf 3470
WiredHome 23:a50ded45dbaf 3471
WiredHome 23:a50ded45dbaf 3472 // To enable the test code, uncomment this section, or copy the
WiredHome 23:a50ded45dbaf 3473 // necessary pieces to your "main()".
WiredHome 23:a50ded45dbaf 3474 //
WiredHome 23:a50ded45dbaf 3475 // #include "mbed.h"
WiredHome 23:a50ded45dbaf 3476 // #include "RA8875.h"
WiredHome 23:a50ded45dbaf 3477 // RA8875 lcd(p5, p6, p7, p12, NC, "tft"); // MOSI, MISO, SCK, /ChipSelect, /reset, name
WiredHome 23:a50ded45dbaf 3478 // Serial pc(USBTX, USBRX);
WiredHome 23:a50ded45dbaf 3479 // extern "C" void mbed_reset();
WiredHome 23:a50ded45dbaf 3480 // int main()
WiredHome 23:a50ded45dbaf 3481 // {
WiredHome 23:a50ded45dbaf 3482 // pc.baud(460800); // I like a snappy terminal, so crank it up!
WiredHome 23:a50ded45dbaf 3483 // pc.printf("\r\nRA8875 Test - Build " __DATE__ " " __TIME__ "\r\n");
WiredHome 23:a50ded45dbaf 3484 //
WiredHome 23:a50ded45dbaf 3485 // pc.printf("Turning on display\r\n");
WiredHome 101:e0aad446094a 3486 // lcd.init();
WiredHome 23:a50ded45dbaf 3487 // lcd.Reset();
WiredHome 23:a50ded45dbaf 3488 // lcd.Power(true); // display power is on, but the backlight is independent
WiredHome 23:a50ded45dbaf 3489 // lcd.Backlight(0.5);
WiredHome 23:a50ded45dbaf 3490 // RunTestSet(lcd, pc);
WiredHome 23:a50ded45dbaf 3491 // }
WiredHome 23:a50ded45dbaf 3492
WiredHome 23:a50ded45dbaf 3493 #endif // TESTENABLE
WiredHome 23:a50ded45dbaf 3494
WiredHome 56:7a85d226ad0d 3495 #endif