This is a port of Henning Kralsen's UTFT library for Arduino/chipKIT to mbed, refactored to make full use of C++ inheritance and access control, in order to reduce work when implementing new drivers and at the same time make the code more readable and easier to maintain. As of now supported are SSD1289 (16-bit interface), HX8340-B (serial interface) and ST7735 (serial interface). Drivers for other controllers will be added as time and resources to acquire the displays to test the code permit.

Dependents:   test SDCard capstone_display capstone_display_2 ... more

TFTLCD Library

NOTE (2013-03-25) Tested with both mbed LPC1768 and Freedom KL25Z. -todor

A TFT LCD driver library, which at the moment provides support for the following display controllers: HX8340-B (serial interface), SSD1289 (16-bit interface), ST7735-R (serial interface), ILI9325/ILI9328 (16-bit interface).

As I am acquiring and testing out new displays, I decided to combine all ported drivers into one library as with the original work done by Henning. However I also had as a goal to make the code maintenance and readability easier/better, so the code has been heavily refactored to make full use of C++ facilities as inheritance and access control. I extracted the common pieces of code into a base class, which every driver inherits and only the controller-specific side is provided in the actual driver - things like initialization, addressing, data transfer, etc.

Another nice extension is that the display's backlight can now be controlled through the driver. Either a simple on/off method of control could be selected, or the brightness can be set through use of PWM (the latter placing some restrictions on which pins can be used for this, as mbed offers hardware PWM on only 6 pins).

I also plan to add support for touch screens as part of the library. The goal is to grow this piece of software into a lightweight graphics widgets library, which can be used to construct control screens with buttons or menus in a speedy and intuitive way.

Changes

2013-07-21

  • Fixed the sleep/wake-up functions of the ILI9328 driver.

2013-06-15

  • Added driver for ILI9328 (works with ILI9325) controller, 16-bit data bus. Screen rotation works as usual with the TFTLCD library, but for now only RGB565 color depth is working and you can use both 65K and 262K color space with this driver. But for some reason the sleep function is not behaving as expected; I am working on this.
  • This is only on my to-do list for now - haven't really had the time yet - but I am going to refactor the library a bit to allow use of GPIO ports for data transfers instead of DigitalOut: faster and cleaner that way. For those who are using it already in a working design and cannot repurpose the pins anymore, the current way it's working will still be available; I am hoping not to tear up the public interfaces of the library (... too much). Anyway, since I am at it, I will also try to add support for multiple bus interfaces to drivers that support it (i.e. both 8bit and 16bit use of ILI932x or SSD1289). Thought this might be a good place to give you guys the heads-up.

2013-01-25

  • Replaced all existing fonts from the UTFT library with the free Terminus font. Two different sizes are provided: 8x12 pixels and 16x28 pixels. I found the old fonts not so good looking and then they supported only the ASCII codes in the range 30 (space) to 126 (the tilde ). The 7segment font didn't even implement anything else than the numbers from 0 to 9 - so it was unusable for anything (one couldn't even display the time or date as it lacked the colon [:] or the period [.] or the slash [/] or the space [ ] characters). So I completely revamped the fonts and added Terminus as the new default with its 2 sizes. Further more I added in both sizes most of the characters up to ASCII code 255. For any code not in there, the space character is substituted. In the case, when you already have provided your own fonts, please have a look at the API changes in the files <terminus.h> and <terminus.cpp>: I promise you whatever time you spent designing your own font, it is not wasted; you merely need to add a second array, which describes which ASCII codes are available in your font, and their byte offset in the original character bitmap array; and a struct to tie all parts together and describe the character size. I am sorry for breaking the old API, but you will like the change and new options it brings you. Now you can insert any char above 127 up to code 255 (if available, of course) with its hex representation, e.g displaying the current temperature would look something like 85\xB0 F or 26\xB0 C (the space in between degree and F or C is needed because both F and C are used in hex numbers, so \xB0F is interpreted as ASCII code 2831 instead of ASCII code 176, followed by the temperature scale denomination; if you insist on avoiding the space, you could write 85\xB0\x46 which will be displayed correctly as 85°F). You can either look up the ASCII code you need on Google or Bing, or just look at what's available - how it looks and its hex value - in the comments in <terminus.cpp>.
  • Added PWM backlight control. If you intend to use this, please make sure that control pin is either one of p21, p22, p23, p24, p25, or p26, as only they support hardware PWM. Please be aware that the mbed pins do not have much juice behind them, so if your display's backlight requires a lot of current, you are better off interfacing through as small signal transistor or a MOSFET. For the rest please consult the updated Doxygen documentation. NOTE The addition of PWM-controlled backlight will not break your existing code, the new options have default values, which initialize the used driver to behave as prior to PWM. Only if you want to use the new feature, some changes need to be made. The PWM is configured to be 120Hz (period of 8.33 milliseconds), in order to avoid noticeable flicker in the backlight. If in your opinion this value is too fine, then you can reduce the frequency in the LCD constructor in <lcd_base.cpp> by increasing the period value. My recommendation is to avoid frequencies lower than 60Hz.

2012-12-21

  • Internal-only changes in the way drivers transmit colors - done to simplify the bitmap drawing routines; client API remains unchanged.

2012-12-12

  • Added the driver for the ST7735 display controller.
  • Added the RGB18 color mode: choose between 16-bit (65K distinct colors) and 18-bit (262K distinct colors) color space [supported by all drivers]. NOTE This feature requires the image drawing functions to be changed, in order to account for differences between configured display color depth and the color depth of the image. Please review the API docs, in particular the new type bitmap_t and the DrawBitmap functions.
  • Changed display rotation to be achieved through the correspondent settings in the respective controller registers: no more software translation between width and height in different display orientations.
  • Extended the orientation options: PORTRAIT (top line to 12 o'clock/upright) and LANDSCAPE (top line to 9 o'clock) positions are the old options, PORTRAIT_REV (top line to 6 o'clock/upside-down) and LANDSCAPE_REV (top line to 3 o'clock) are the new orientations.
  • Added more pre-defined colors: available now are COLOR_BLACK, COLOR_WHITE, COLOR_RED, COLOR_GREEN, COLOR_BLUE, COLOR_CYAN, COLOR_MAGENTA and COLOR_YELLOW.

TODO

  • Finish implementing PWM-controlled backlight (current-sink configuration).
  • Add a driver for the HX8352-A controller (ITDB02-3.2WD 16:9 240x400 pixel resolution display).

How to Use

The code is documented, so please review the API docs. There is a simple example to get you started...

Committer:
ttodorov
Date:
Fri Dec 21 06:05:15 2012 +0000
Revision:
20:4bdca8d8dadc
Parent:
19:eb27effb8c07
Child:
21:e5c1e8ffada1
- changed internals of SetPixelColor to allow more general and simple implementation of the bitmap drawing functions

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ttodorov 0:881ff0b71102 1 /** \file lcd_base.h
ttodorov 0:881ff0b71102 2 * \brief Base class for all LCD controller implementations.
ttodorov 0:881ff0b71102 3 * \copyright GNU Public License, v2. or later
ttodorov 0:881ff0b71102 4 *
ttodorov 0:881ff0b71102 5 * Generic object painting and screen control.
ttodorov 0:881ff0b71102 6 *
ttodorov 0:881ff0b71102 7 * This library is based on the Arduino/chipKIT UTFT library by Henning
ttodorov 0:881ff0b71102 8 * Karlsen, http://henningkarlsen.com/electronics/library.php?id=52
ttodorov 0:881ff0b71102 9 *
ttodorov 0:881ff0b71102 10 * Copyright (C)2010-2012 Henning Karlsen. All right reserved.
ttodorov 5:09b6d228ceea 11 *
ttodorov 0:881ff0b71102 12 * Copyright (C)2012 Todor Todorov.
ttodorov 0:881ff0b71102 13 *
ttodorov 0:881ff0b71102 14 * This library is free software; you can redistribute it and/or
ttodorov 0:881ff0b71102 15 * modify it under the terms of the GNU Lesser General Public
ttodorov 0:881ff0b71102 16 * License as published by the Free Software Foundation; either
ttodorov 0:881ff0b71102 17 * version 2.1 of the License, or (at your option) any later version.
ttodorov 0:881ff0b71102 18 *
ttodorov 0:881ff0b71102 19 * This library is distributed in the hope that it will be useful,
ttodorov 0:881ff0b71102 20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ttodorov 0:881ff0b71102 21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
ttodorov 0:881ff0b71102 22 * Lesser General Public License for more details.
ttodorov 0:881ff0b71102 23 *
ttodorov 0:881ff0b71102 24 * You should have received a copy of the GNU Lesser General Public
ttodorov 0:881ff0b71102 25 * License along with this library; if not, write to:
ttodorov 0:881ff0b71102 26 *
ttodorov 0:881ff0b71102 27 * Free Software Foundation, Inc.
ttodorov 0:881ff0b71102 28 * 51 Franklin St, 5th Floor, Boston, MA 02110-1301, USA
ttodorov 0:881ff0b71102 29 *
ttodorov 0:881ff0b71102 30 *********************************************************************/
ttodorov 3:64a5b67d5b51 31 #ifndef TFTLCD_BASE_H
ttodorov 3:64a5b67d5b51 32 #define TFTLCD_BASE_H
ttodorov 0:881ff0b71102 33
ttodorov 0:881ff0b71102 34 #include "mbed.h"
ttodorov 0:881ff0b71102 35 #include "fonts.h"
ttodorov 0:881ff0b71102 36
ttodorov 6:059ca1648211 37 #ifdef __cplusplus
ttodorov 6:059ca1648211 38 extern "C" {
ttodorov 6:059ca1648211 39 #endif
ttodorov 6:059ca1648211 40
ttodorov 0:881ff0b71102 41 /** \def RGB(r,g,b)
ttodorov 12:d0978272a340 42 * \brief Creates a RGB color from distinct bytes for the red, green and blue components.
ttodorov 0:881ff0b71102 43 *
ttodorov 0:881ff0b71102 44 * Displays which use 16 bits to assign colors to a specific pixel, use
ttodorov 0:881ff0b71102 45 * 5 bits for the red component, 6 bits for the green component and 5
ttodorov 12:d0978272a340 46 * bits for the blue component. Displays which have 18-bit color depth
ttodorov 12:d0978272a340 47 * use 6 bits for red, 6 bits for green and 6 bits for blue component.
ttodorov 12:d0978272a340 48 * This macro preserves the full 24-bit color depth, but it is the responsibility
ttodorov 12:d0978272a340 49 * of the respective driver to convert the color value to the correct format.
ttodorov 0:881ff0b71102 50 */
ttodorov 12:d0978272a340 51 #define RGB( r, g, b ) ( ( r ) << 16 ) | ( ( g ) << 8 ) | ( b )
ttodorov 0:881ff0b71102 52 /** \def COLOR_BLACK
ttodorov 0:881ff0b71102 53 * \brief Shorthand for RGB( 0, 0, 0 ).
ttodorov 0:881ff0b71102 54 */
ttodorov 0:881ff0b71102 55 #define COLOR_BLACK RGB( 0x00, 0x00, 0x00 )
ttodorov 0:881ff0b71102 56 /** \def COLOR_WHITE
ttodorov 0:881ff0b71102 57 * \brief Shorthand for RGB( 255, 255, 255 ).
ttodorov 0:881ff0b71102 58 */
ttodorov 0:881ff0b71102 59 #define COLOR_WHITE RGB( 0xFF, 0xFF, 0xFF )
ttodorov 0:881ff0b71102 60 /** \def COLOR_RED
ttodorov 0:881ff0b71102 61 * \brief Shorthand for RGB( 255, 0, 0 ).
ttodorov 0:881ff0b71102 62 */
ttodorov 0:881ff0b71102 63 #define COLOR_RED RGB( 0xFF, 0x00, 0x00 )
ttodorov 0:881ff0b71102 64 /** \def COLOR_GREEN
ttodorov 0:881ff0b71102 65 * \brief Shorthand for RGB( 0, 255, 0 ).
ttodorov 0:881ff0b71102 66 */
ttodorov 0:881ff0b71102 67 #define COLOR_GREEN RGB( 0x00, 0xFF, 0x00 )
ttodorov 0:881ff0b71102 68 /** \def COLOR_BLUE
ttodorov 0:881ff0b71102 69 * \brief Shorthand for RGB( 0, 0, 255 ).
ttodorov 0:881ff0b71102 70 */
ttodorov 0:881ff0b71102 71 #define COLOR_BLUE RGB( 0x00, 0x00, 0xFF )
ttodorov 19:eb27effb8c07 72 /** \def COLOR_CYAN
ttodorov 19:eb27effb8c07 73 * \brief Shorthand for RGB( 0, 255, 255 )
ttodorov 19:eb27effb8c07 74 */
ttodorov 19:eb27effb8c07 75 #define COLOR_CYAN RGB( 0x00, 0xFF, 0xFF )
ttodorov 19:eb27effb8c07 76 /** \def COLOR_MAGENTA
ttodorov 19:eb27effb8c07 77 * \brief Shorthand for RGB( 255, 0, 255 )
ttodorov 19:eb27effb8c07 78 */
ttodorov 19:eb27effb8c07 79 #define COLOR_MAGENTA RGB( 0xFF, 0x00, 0xFF )
ttodorov 19:eb27effb8c07 80 /** \def COLOR_YELLOW
ttodorov 19:eb27effb8c07 81 * \brief Shorthand for RGB( 255, 255, 0 )
ttodorov 19:eb27effb8c07 82 */
ttodorov 19:eb27effb8c07 83 #define COLOR_YELLOW RGB( 0xFF, 0xFF, 0x00 )
ttodorov 19:eb27effb8c07 84
ttodorov 0:881ff0b71102 85
ttodorov 10:69571adcfad5 86 /** \enum Orientation_enum
ttodorov 0:881ff0b71102 87 * \brief Display orientation.
ttodorov 0:881ff0b71102 88 */
ttodorov 10:69571adcfad5 89 enum Orientation_enum
ttodorov 0:881ff0b71102 90 {
ttodorov 19:eb27effb8c07 91 PORTRAIT = 0, /**< Top row of the screen is at 12 o'clock. */
ttodorov 19:eb27effb8c07 92 LANDSCAPE = 1, /**< Top row of the screen is at 9 o'clock. */
ttodorov 19:eb27effb8c07 93 PORTRAIT_REV = 2, /**< Top row of the screen is at 6 o'clock. */
ttodorov 19:eb27effb8c07 94 LANDSCAPE_REV = 3, /**< Top row of the screen is at 3 o'clock. */
ttodorov 10:69571adcfad5 95 };
ttodorov 10:69571adcfad5 96 /** \typedef orientation_t
ttodorov 10:69571adcfad5 97 * \brief Convenience shortcut for display orientation.
ttodorov 10:69571adcfad5 98 */
ttodorov 10:69571adcfad5 99 typedef enum Orientation_enum orientation_t;
ttodorov 0:881ff0b71102 100
ttodorov 10:69571adcfad5 101 /** \enum ColorDepth_enum
ttodorov 10:69571adcfad5 102 * \brief Color depth
ttodorov 10:69571adcfad5 103 */
ttodorov 10:69571adcfad5 104 enum ColorDepth_enum
ttodorov 10:69571adcfad5 105 {
ttodorov 20:4bdca8d8dadc 106 RGB16, /**< 16-bit colors, pixels can have 65K+ distinct color values */
ttodorov 20:4bdca8d8dadc 107 RGB18, /**< 18-bit colors, pixels can have 262K+ distinct color values */
ttodorov 20:4bdca8d8dadc 108 RGB24, /**< 24-bit colors, full 8 bits per component, 16M+ distinct color values */
ttodorov 10:69571adcfad5 109 };
ttodorov 10:69571adcfad5 110 /** \typedef colordepth_t
ttodorov 10:69571adcfad5 111 * \brief Convenience shortcut for display color depth.
ttodorov 10:69571adcfad5 112 */
ttodorov 10:69571adcfad5 113 typedef enum ColorDepth_enum colordepth_t;
ttodorov 10:69571adcfad5 114
ttodorov 10:69571adcfad5 115 /** \enum Alignment_enum
ttodorov 0:881ff0b71102 116 * \brief Horizontal text alignment on the line.
ttodorov 0:881ff0b71102 117 */
ttodorov 10:69571adcfad5 118 enum Alignment_enum
ttodorov 0:881ff0b71102 119 {
ttodorov 0:881ff0b71102 120 LEFT = 0, /**< Left-oriented, naturally gravitate closer to the left edge of the screen. */
ttodorov 0:881ff0b71102 121 CENTER = 9998, /**< Center-oriented, try to fit in the middle of the available space with equal free space to the left and right of the text. */
ttodorov 0:881ff0b71102 122 RIGHT = 9999, /**< Right-oriented, naturally gravitate closer to the right edge of the screen, leaving any remaining free space to the left of the text. */
ttodorov 10:69571adcfad5 123 };
ttodorov 10:69571adcfad5 124 /** \typedef align_t
ttodorov 10:69571adcfad5 125 * \brief Convenience shortcut for text alignment.
ttodorov 10:69571adcfad5 126 */
ttodorov 10:69571adcfad5 127 typedef enum Alignment_enum align_t;
ttodorov 0:881ff0b71102 128
ttodorov 10:69571adcfad5 129 /** \struct Font_struct
ttodorov 0:881ff0b71102 130 * \brief Describes fonts and their properties.
ttodorov 0:881ff0b71102 131 * \sa Comments in fonts.h
ttodorov 0:881ff0b71102 132 */
ttodorov 10:69571adcfad5 133 struct Font_struct
ttodorov 0:881ff0b71102 134 {
ttodorov 0:881ff0b71102 135 const char* font; /**< A pointer to the first byte in the font. */
ttodorov 0:881ff0b71102 136 unsigned char width; /**< The width of each character, in pixels. */
ttodorov 0:881ff0b71102 137 unsigned char height; /**< Height of each character, in pixels. */
ttodorov 0:881ff0b71102 138 unsigned char offset; /**< Offset of the first character in the font. */
ttodorov 0:881ff0b71102 139 unsigned char numchars; /**< Count of the available characters in the font. */
ttodorov 10:69571adcfad5 140 };
ttodorov 10:69571adcfad5 141 /** \typedef font_metrics_t
ttodorov 10:69571adcfad5 142 * \brief Convenience shortcut for fonts properties.
ttodorov 10:69571adcfad5 143 */
ttodorov 10:69571adcfad5 144 typedef struct Font_struct font_metrics_t;
ttodorov 0:881ff0b71102 145
ttodorov 12:d0978272a340 146 /** \struct Bitmap_struct
ttodorov 12:d0978272a340 147 * \brief Describes an image.
ttodorov 12:d0978272a340 148 */
ttodorov 12:d0978272a340 149 struct Bitmap_struct
ttodorov 12:d0978272a340 150 {
ttodorov 12:d0978272a340 151 colordepth_t Format; /**< Color depth of the image. */
ttodorov 12:d0978272a340 152 unsigned short Width; /**< Width of the image in pixels. */
ttodorov 12:d0978272a340 153 unsigned short Height; /**< Height of the image in pixels. */
ttodorov 12:d0978272a340 154 const void* PixelData; /**< Image pixel data. */
ttodorov 12:d0978272a340 155 };
ttodorov 12:d0978272a340 156 /** \typedef bitmap_t
ttodorov 12:d0978272a340 157 * \brief Convenience shortcut bitmap type.
ttodorov 12:d0978272a340 158 */
ttodorov 12:d0978272a340 159 typedef struct Bitmap_struct bitmap_t;
ttodorov 12:d0978272a340 160
ttodorov 11:aeceefc5f9f2 161
ttodorov 0:881ff0b71102 162 /** Base class for LCD implementations.
ttodorov 0:881ff0b71102 163 *
ttodorov 0:881ff0b71102 164 * All separate LCD controller implementations have to subclass this one.
ttodorov 0:881ff0b71102 165 *
ttodorov 0:881ff0b71102 166 * \version 0.1
ttodorov 0:881ff0b71102 167 * \author Todor Todorov
ttodorov 0:881ff0b71102 168 */
ttodorov 0:881ff0b71102 169 class LCD
ttodorov 0:881ff0b71102 170 {
ttodorov 0:881ff0b71102 171 public:
ttodorov 0:881ff0b71102 172
ttodorov 0:881ff0b71102 173 /** Initialize display.
ttodorov 0:881ff0b71102 174 *
ttodorov 0:881ff0b71102 175 * Wakes up the display from sleep, initializes power parameters.
ttodorov 0:881ff0b71102 176 * This function must be called first, befor any painting on the
ttodorov 0:881ff0b71102 177 * display is done, otherwise the positioning of graphical elements
ttodorov 0:881ff0b71102 178 * will not work properly and any paynt operation will not be visible
ttodorov 0:881ff0b71102 179 * or produce garbage.
ttodorov 0:881ff0b71102 180 *
ttodorov 0:881ff0b71102 181 * This function is controller-specific and needs to be implemented
ttodorov 4:3ac4239f6c9c 182 * separately for each available display.
ttodorov 0:881ff0b71102 183 * \param oritentation The display orientation, landscape is default.
ttodorov 12:d0978272a340 184 * \param colors The correct color depth to use for the pixel data.
ttodorov 0:881ff0b71102 185 */
ttodorov 12:d0978272a340 186 virtual void Initialize( orientation_t orientation, colordepth_t colors ) = 0;
ttodorov 0:881ff0b71102 187
ttodorov 4:3ac4239f6c9c 188 /** Puts the display to sleep.
ttodorov 4:3ac4239f6c9c 189 *
ttodorov 4:3ac4239f6c9c 190 * When the display is in sleep mode, its power consumption is
ttodorov 4:3ac4239f6c9c 191 * minimized. Before new pixel data can be written to the display
ttodorov 4:3ac4239f6c9c 192 * memory, the controller needs to be brought out of sleep mode.
ttodorov 4:3ac4239f6c9c 193 * \sa #WakeUp( void );
ttodorov 4:3ac4239f6c9c 194 * \remarks The result of this operation might not be exactly as
ttodorov 4:3ac4239f6c9c 195 * expected. Putting the display to sleep will cause the
ttodorov 4:3ac4239f6c9c 196 * controller to switch to the standard color of the LCD,
ttodorov 4:3ac4239f6c9c 197 * so depending on whether the display is normally white,
ttodorov 4:3ac4239f6c9c 198 * or normally dark, the screen might or might not go
ttodorov 4:3ac4239f6c9c 199 * dark. Additional power saving can be achieved, if
ttodorov 4:3ac4239f6c9c 200 * the backlight of the used display is not hardwired on
ttodorov 4:3ac4239f6c9c 201 * the PCB and can be controlled via the BL pin.
ttodorov 4:3ac4239f6c9c 202 * \remarks This function is controller-specific and needs to be
ttodorov 4:3ac4239f6c9c 203 * implemented separately for each available display.
ttodorov 4:3ac4239f6c9c 204 */
ttodorov 4:3ac4239f6c9c 205 virtual void Sleep( void ) = 0;
ttodorov 4:3ac4239f6c9c 206
ttodorov 4:3ac4239f6c9c 207 /** Wakes up the display from sleep mode.
ttodorov 4:3ac4239f6c9c 208 *
ttodorov 4:3ac4239f6c9c 209 * This function needs to be called before any other, when the
ttodorov 4:3ac4239f6c9c 210 * display has been put into sleep mode by a previois call to
ttodorov 4:3ac4239f6c9c 211 * #Sleep( void ).
ttodorov 4:3ac4239f6c9c 212 * \remarks This function is controller-specific and needs to be
ttodorov 4:3ac4239f6c9c 213 * implemented separately for each available display.
ttodorov 4:3ac4239f6c9c 214 */
ttodorov 4:3ac4239f6c9c 215 virtual void WakeUp( void ) = 0;
ttodorov 4:3ac4239f6c9c 216
ttodorov 0:881ff0b71102 217 /** Set the foreground color for painting.
ttodorov 0:881ff0b71102 218 *
ttodorov 0:881ff0b71102 219 * This is the default foreground color to be used in painting operations.
ttodorov 0:881ff0b71102 220 * If a specific output function allows for a different color to be specified
ttodorov 0:881ff0b71102 221 * in place, the new setting will be used for that single operation only and
ttodorov 0:881ff0b71102 222 * will not change this value.
ttodorov 0:881ff0b71102 223 *
ttodorov 12:d0978272a340 224 * \param color The color to be used (24-bit color depth).
ttodorov 0:881ff0b71102 225 * \sa #RGB(r,g,b)
ttodorov 0:881ff0b71102 226 */
ttodorov 12:d0978272a340 227 virtual void SetForeground( unsigned int color = COLOR_WHITE );
ttodorov 0:881ff0b71102 228
ttodorov 0:881ff0b71102 229 /** Set the background color for painting.
ttodorov 0:881ff0b71102 230 *
ttodorov 0:881ff0b71102 231 * This is the default color to be used for "empty" pixels while painting.
ttodorov 0:881ff0b71102 232 * If a particular function allows for a different value to be specified
ttodorov 0:881ff0b71102 233 * when the function is called, the new value will be used only for this
ttodorov 0:881ff0b71102 234 * single call and will not change this setting.
ttodorov 0:881ff0b71102 235 *
ttodorov 12:d0978272a340 236 * \param color The background color (24-bit color depth).
ttodorov 0:881ff0b71102 237 * \sa #RGB(r,g,b)
ttodorov 0:881ff0b71102 238 */
ttodorov 12:d0978272a340 239 virtual void SetBackground( unsigned int color = COLOR_BLACK );
ttodorov 0:881ff0b71102 240
ttodorov 0:881ff0b71102 241 /** Sets the font to be used for painting of text on the screen.
ttodorov 0:881ff0b71102 242 * \param font A pointer to the font data.
ttodorov 0:881ff0b71102 243 * \sa Comments in file fonts.h
ttodorov 0:881ff0b71102 244 */
ttodorov 0:881ff0b71102 245 virtual void SetFont( const char* font );
ttodorov 0:881ff0b71102 246
ttodorov 0:881ff0b71102 247 /** Gets the display width.
ttodorov 0:881ff0b71102 248 * \return Display width in pixels.
ttodorov 0:881ff0b71102 249 */
ttodorov 0:881ff0b71102 250 unsigned short GetWidth( void );
ttodorov 0:881ff0b71102 251
ttodorov 0:881ff0b71102 252 /** Gets the display height.
ttodorov 0:881ff0b71102 253 * \return Display height in pixels.
ttodorov 0:881ff0b71102 254 */
ttodorov 0:881ff0b71102 255 unsigned short GetHeight( void );
ttodorov 0:881ff0b71102 256
ttodorov 0:881ff0b71102 257 /** Fills the whole screen with a single color.
ttodorov 9:58b328831d0a 258 * \param color The color to be used. The value must be in RGB-565 format.
ttodorov 9:58b328831d0a 259 * \remarks The special values -1 and -2 signify the preset background and foreground colors, respectively.
ttodorov 9:58b328831d0a 260 * The backround color is the default.
ttodorov 0:881ff0b71102 261 */
ttodorov 0:881ff0b71102 262 virtual void FillScreen( int color = -1 );
ttodorov 0:881ff0b71102 263
ttodorov 0:881ff0b71102 264 /** Clears the screen.
ttodorov 0:881ff0b71102 265 *
ttodorov 0:881ff0b71102 266 * This is the same as calling #FillScreen() or #FillScreen( -1 ) to use the background color.
ttodorov 0:881ff0b71102 267 */
ttodorov 0:881ff0b71102 268 virtual void ClearScreen( void );
ttodorov 0:881ff0b71102 269
ttodorov 0:881ff0b71102 270 /** Draws a pixel at the specified location.
ttodorov 0:881ff0b71102 271 *
ttodorov 0:881ff0b71102 272 * By default the function will use the preset foreground color, but the background
ttodorov 0:881ff0b71102 273 * or a custom color could be used as well.
ttodorov 0:881ff0b71102 274 *
ttodorov 0:881ff0b71102 275 * \param x The horizontal offset of the pixel from the upper left corner of the screen.
ttodorov 0:881ff0b71102 276 * \param y The vertical offset of the pixel from the upper left corner of the screen.
ttodorov 12:d0978272a340 277 * \param color The color to be used. Use a custom color, or -1 for background and -2 for foreground color.
ttodorov 0:881ff0b71102 278 */
ttodorov 0:881ff0b71102 279 virtual void DrawPixel( unsigned short x, unsigned short y, int color = -2 );
ttodorov 0:881ff0b71102 280
ttodorov 0:881ff0b71102 281 /** Draws a line.
ttodorov 0:881ff0b71102 282 *
ttodorov 0:881ff0b71102 283 * \param x1 Horizontal offset of the beginning point of the line.
ttodorov 0:881ff0b71102 284 * \param y1 Vertical offset of the beginning point of the line.
ttodorov 0:881ff0b71102 285 * \param x2 Horizontal offset of the end point of the line.
ttodorov 0:881ff0b71102 286 * \param y2 Verical offset of the end point of the line.
ttodorov 12:d0978272a340 287 * \param color The color to use for painting, or -1 for background, or -2 for foreground.
ttodorov 0:881ff0b71102 288 */
ttodorov 0:881ff0b71102 289 virtual void DrawLine( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, int color = -2 );
ttodorov 0:881ff0b71102 290
ttodorov 0:881ff0b71102 291 /** Paints a rectangle.
ttodorov 0:881ff0b71102 292 *
ttodorov 0:881ff0b71102 293 * \param x1 The horizontal offset of the beginning point of one of the rectangle's diagonals.
ttodorov 0:881ff0b71102 294 * \param y1 The vertical offset of the beginning point of one of the rectangle's diagonals.
ttodorov 0:881ff0b71102 295 * \param x2 The horizontal offset of the end point of the same of the rectangle's diagonals.
ttodorov 0:881ff0b71102 296 * \param y2 The vertical offset of the end point of the same of the rectangle's diagonals.
ttodorov 12:d0978272a340 297 * \param color The color to use for painting. -1 indicated background, -2 foreground, or custom color.
ttodorov 0:881ff0b71102 298 */
ttodorov 0:881ff0b71102 299 virtual void DrawRect( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, int color = -2 );
ttodorov 0:881ff0b71102 300
ttodorov 0:881ff0b71102 301 /** Paints a rectangle and fills it with the paint color.
ttodorov 0:881ff0b71102 302 *
ttodorov 0:881ff0b71102 303 * \param x1 The horizontal offset of the beginning point of one of the rectangle's diagonals.
ttodorov 0:881ff0b71102 304 * \param y1 The vertical offset of the beginning point of one of the rectangle's diagonals.
ttodorov 0:881ff0b71102 305 * \param x2 The horizontal offset of the end point of the same of the rectangle's diagonals.
ttodorov 0:881ff0b71102 306 * \param y2 The vertical offset of the end point of the same of the rectangle's diagonals.
ttodorov 12:d0978272a340 307 * \param color The color to use for painting. -1 indicated background, -2 foreground, or custom color.
ttodorov 0:881ff0b71102 308 */
ttodorov 0:881ff0b71102 309 virtual void DrawRoundRect( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, int color = -2 );
ttodorov 0:881ff0b71102 310
ttodorov 0:881ff0b71102 311 /** Paints a rectangle with rounded corners.
ttodorov 0:881ff0b71102 312 *
ttodorov 0:881ff0b71102 313 * \param x1 The horizontal offset of the beginning point of one of the rectangle's diagonals.
ttodorov 0:881ff0b71102 314 * \param y1 The vertical offset of the beginning point of one of the rectangle's diagonals.
ttodorov 0:881ff0b71102 315 * \param x2 The horizontal offset of the end point of the same of the rectangle's diagonals.
ttodorov 0:881ff0b71102 316 * \param y2 The vertical offset of the end point of the same of the rectangle's diagonals.
ttodorov 12:d0978272a340 317 * \param color The color to use for painting. -1 indicated background, -2 foreground, or custom color.
ttodorov 0:881ff0b71102 318 */
ttodorov 0:881ff0b71102 319 virtual void FillRect( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, int color = -2 );
ttodorov 0:881ff0b71102 320
ttodorov 0:881ff0b71102 321 /** Paints a rectangle with rounded corners and fills it with the paint color.
ttodorov 0:881ff0b71102 322 *
ttodorov 0:881ff0b71102 323 * \param x1 The horizontal offset of the beginning point of one of the rectangle's diagonals.
ttodorov 0:881ff0b71102 324 * \param y1 The vertical offset of the beginning point of one of the rectangle's diagonals.
ttodorov 0:881ff0b71102 325 * \param x2 The horizontal offset of the end point of the same of the rectangle's diagonals.
ttodorov 0:881ff0b71102 326 * \param y2 The vertical offset of the end point of the same of the rectangle's diagonals.
ttodorov 12:d0978272a340 327 * \param color The color to use for painting. -1 indicated background, -2 foreground, or custom color.
ttodorov 0:881ff0b71102 328 */
ttodorov 0:881ff0b71102 329 virtual void FillRoundRect( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, int color = -2 );
ttodorov 0:881ff0b71102 330
ttodorov 0:881ff0b71102 331 /** Paints a circle.
ttodorov 0:881ff0b71102 332 *
ttodorov 0:881ff0b71102 333 * \param x The offset of the circle's center from the left edge of the screen.
ttodorov 0:881ff0b71102 334 * \param y The offset of the circle's center from the top edge of the screen.
ttodorov 0:881ff0b71102 335 * \param radius The circle's radius.
ttodorov 12:d0978272a340 336 * \param color The color to use for painting. -1 indicated background, -2 foreground, or custom color.
ttodorov 0:881ff0b71102 337 */
ttodorov 0:881ff0b71102 338 virtual void DrawCircle( unsigned short x, unsigned short y, unsigned short radius, int color = -2 );
ttodorov 0:881ff0b71102 339
ttodorov 0:881ff0b71102 340 /** Paints a circle and fills it with the paint color.
ttodorov 0:881ff0b71102 341 *
ttodorov 0:881ff0b71102 342 * \param x The offset of the circle's center from the left edge of the screen.
ttodorov 0:881ff0b71102 343 * \param y The offset of the circle's center from the top edge of the screen.
ttodorov 0:881ff0b71102 344 * \param radius The circle's radius.
ttodorov 12:d0978272a340 345 * \param color The color to use for painting. -1 indicated background, -2 foreground, or custom color.
ttodorov 0:881ff0b71102 346 */
ttodorov 0:881ff0b71102 347 virtual void FillCircle( unsigned short x, unsigned short y, unsigned short radius, int color = -2 );
ttodorov 0:881ff0b71102 348
ttodorov 0:881ff0b71102 349 /** Print a text on the screen.
ttodorov 0:881ff0b71102 350 *
ttodorov 0:881ff0b71102 351 * \param str The text.
ttodorov 0:881ff0b71102 352 * \param x The horizontal offset form the left edge of the screen. The special values LEFT, CENTER,
ttodorov 0:881ff0b71102 353 * or RIGHT can be used instead of pixel offset to indicate the text's horizontal alignment.
ttodorov 0:881ff0b71102 354 * \param y The vertical offset of the text from the top of the screen.
ttodorov 0:881ff0b71102 355 * \param fgColor The foreground to use for painting the text; -1 indicates background color, -2 the foreground setting, or custom color.
ttodorov 0:881ff0b71102 356 * \param bgColor The color to use for painting the empty pixels; -1 indicates the background color, -2 the foreground setting, or custom color.
ttodorov 0:881ff0b71102 357 * \param deg If different than 0, the text will be rotated at an angle this many degrees around its starting point. Default is not to ratate.
ttodorov 0:881ff0b71102 358 */
ttodorov 0:881ff0b71102 359 virtual void Print( const char *str, unsigned short x, unsigned short y, int fgColor = -2, int bgColor = -1, unsigned short deg = 0 );
ttodorov 0:881ff0b71102 360
ttodorov 0:881ff0b71102 361 /** Draw an image on the screen.
ttodorov 0:881ff0b71102 362 *
ttodorov 0:881ff0b71102 363 * The pixels of the picture must be in the RGB-565 format. The data can be provided
ttodorov 0:881ff0b71102 364 * as an array in a source or a header file. To convert an image file to the appropriate
ttodorov 0:881ff0b71102 365 * format, a special utility must be utilized. One such tool is provided by Henning Karlsen,
ttodorov 0:881ff0b71102 366 * the author of the UTFT display liberary and can be downloaded for free from his web site:
ttodorov 0:881ff0b71102 367 * http://henningkarlsen.com/electronics/library.php?id=52
ttodorov 0:881ff0b71102 368 *
ttodorov 0:881ff0b71102 369 * \param x Horizontal offset of the first pixel of the image.
ttodorov 12:d0978272a340 370 * \param y Vertical offset of the first pixel of the image.
ttodorov 12:d0978272a340 371 * \param img Image data pointer.
ttodorov 0:881ff0b71102 372 * \param scale A value of 1 will produce an image with its original size, while a different value will scale the image.
ttodorov 0:881ff0b71102 373 */
ttodorov 12:d0978272a340 374 virtual void DrawBitmap( unsigned short x, unsigned short y, const bitmap_t* img, unsigned char scale = 1 );
ttodorov 0:881ff0b71102 375
ttodorov 0:881ff0b71102 376 /** Draw an image on the screen.
ttodorov 0:881ff0b71102 377 *
ttodorov 0:881ff0b71102 378 * The pixels of the picture must be in the RGB-565 format. The data can be provided
ttodorov 0:881ff0b71102 379 * as an array in a source or a header file. To convert an image file to the appropriate
ttodorov 0:881ff0b71102 380 * format, a special utility must be utilized. One such tool is provided by Henning Karlsen,
ttodorov 0:881ff0b71102 381 * the author of the UTFT display liberary and can be downloaded for free from his web site:
ttodorov 0:881ff0b71102 382 * http://henningkarlsen.com/electronics/library.php?id=52
ttodorov 0:881ff0b71102 383 *
ttodorov 0:881ff0b71102 384 * \param x Horizontal offset of the first pixel of the image.
ttodorov 12:d0978272a340 385 * \param y Vertical offset of the first pixel of the image.
ttodorov 12:d0978272a340 386 * \param img Image data pointer.
ttodorov 0:881ff0b71102 387 * \param deg Angle to rotate the image before painting on screen, in degrees.
ttodorov 0:881ff0b71102 388 * \param rox
ttodorov 0:881ff0b71102 389 * \param roy
ttodorov 0:881ff0b71102 390 */
ttodorov 12:d0978272a340 391 virtual void DrawBitmap( unsigned short x, unsigned short y, const bitmap_t* img, unsigned short deg, unsigned short rox, unsigned short roy );
ttodorov 0:881ff0b71102 392
ttodorov 0:881ff0b71102 393 protected:
ttodorov 0:881ff0b71102 394 /** Creates an instance of the class.
ttodorov 0:881ff0b71102 395 *
ttodorov 0:881ff0b71102 396 * \param width Width of the display in pixels.
ttodorov 0:881ff0b71102 397 * \param height Height of the display in pixels.
ttodorov 0:881ff0b71102 398 * \param CS Pin connected to the CS input of the display.
ttodorov 0:881ff0b71102 399 * \param RS Pin connected to the RS input of the display.
ttodorov 4:3ac4239f6c9c 400 * \param RESET Pin connected to the RESET input of the display.
ttodorov 0:881ff0b71102 401 */
ttodorov 4:3ac4239f6c9c 402 LCD( unsigned short width, unsigned short height ,PinName CS, PinName RS, PinName RESET );
ttodorov 4:3ac4239f6c9c 403
ttodorov 4:3ac4239f6c9c 404 /** Activates the display for command/data transfer.
ttodorov 4:3ac4239f6c9c 405 *
ttodorov 4:3ac4239f6c9c 406 * Usually achieved by pulling the CS pin of the display low.
ttodorov 4:3ac4239f6c9c 407 */
ttodorov 4:3ac4239f6c9c 408 virtual void Activate( void );
ttodorov 4:3ac4239f6c9c 409
ttodorov 4:3ac4239f6c9c 410 /** Deactivates the display after data has been transmitted.
ttodorov 4:3ac4239f6c9c 411 *
ttodorov 4:3ac4239f6c9c 412 * Usually achieved by pulling the CS pin of the display high.
ttodorov 4:3ac4239f6c9c 413 */
ttodorov 4:3ac4239f6c9c 414 virtual void Deactivate( void );
ttodorov 0:881ff0b71102 415
ttodorov 0:881ff0b71102 416 /** Sends a command to the display.
ttodorov 0:881ff0b71102 417 *
ttodorov 0:881ff0b71102 418 * \param cmd The display command.
ttodorov 0:881ff0b71102 419 * \remarks Commands are controller-specific and this function needs to
ttodorov 0:881ff0b71102 420 * be implemented separately for each available controller.
ttodorov 0:881ff0b71102 421 */
ttodorov 2:81ed304b7e9b 422 virtual void WriteCmd( unsigned short cmd ) = 0;
ttodorov 0:881ff0b71102 423
ttodorov 0:881ff0b71102 424 /** Sends pixel data to the display.
ttodorov 0:881ff0b71102 425 *
ttodorov 0:881ff0b71102 426 * \param data The display data.
ttodorov 0:881ff0b71102 427 * \remarks Sendin data is controller-specific and this function needs to
ttodorov 0:881ff0b71102 428 * be implemented separately for each available controller.
ttodorov 0:881ff0b71102 429 */
ttodorov 2:81ed304b7e9b 430 virtual void WriteData( unsigned short data ) = 0;
ttodorov 0:881ff0b71102 431
ttodorov 0:881ff0b71102 432 /** Sends both command and data to the display controller.
ttodorov 0:881ff0b71102 433 *
ttodorov 0:881ff0b71102 434 * This is a helper utility function which combines the 2 functions above
ttodorov 0:881ff0b71102 435 * into one single convenience step.
ttodorov 0:881ff0b71102 436 *
ttodorov 0:881ff0b71102 437 * \param cmd The display command.
ttodorov 0:881ff0b71102 438 * \param data The display pixel data.
ttodorov 0:881ff0b71102 439 */
ttodorov 2:81ed304b7e9b 440 virtual void WriteCmdData( unsigned short cmd, unsigned short data );
ttodorov 0:881ff0b71102 441
ttodorov 0:881ff0b71102 442 /** Assigns a chunk of the display memory to receive data.
ttodorov 0:881ff0b71102 443 *
ttodorov 0:881ff0b71102 444 * When data is sent to the display after this function completes, the opertion will
ttodorov 0:881ff0b71102 445 * start from the begining of the assigned address (pixel position) and the pointer
ttodorov 0:881ff0b71102 446 * will be automatically incremented so that the next data write operation will continue
ttodorov 0:881ff0b71102 447 * with the next pixel from the memory block. If more data is written than available
ttodorov 0:881ff0b71102 448 * pixels, at the end of the block the pointer will jump back to its beginning and
ttodorov 0:881ff0b71102 449 * commence again, until the next address change command is sent to the display.
ttodorov 0:881ff0b71102 450 *
ttodorov 0:881ff0b71102 451 * \param x1 The X coordinate of the pixel at the beginning of the block.
ttodorov 0:881ff0b71102 452 * \param y1 The Y coordinate of the pixel at the beginning of the block.
ttodorov 0:881ff0b71102 453 * \param x2 The X coordinate of the pixel at the end of the block.
ttodorov 0:881ff0b71102 454 * \param y2 The Y coordinate of the pixel at the end of the block.
ttodorov 0:881ff0b71102 455 * \remarks Addressing commands are controller-specific and this function needs to be
ttodorov 0:881ff0b71102 456 * implemented separately for each available controller.
ttodorov 0:881ff0b71102 457 */
ttodorov 20:4bdca8d8dadc 458 virtual void SetXY( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2 ) = 0;
ttodorov 0:881ff0b71102 459
ttodorov 0:881ff0b71102 460 /** Resets the memory address for the next display write operation to the screen origins (0,0).
ttodorov 0:881ff0b71102 461 */
ttodorov 2:81ed304b7e9b 462 virtual void ClearXY( void );
ttodorov 2:81ed304b7e9b 463
ttodorov 10:69571adcfad5 464 /** Sets the color of the pixel at the address pointer of the controller.
ttodorov 10:69571adcfad5 465 *
ttodorov 10:69571adcfad5 466 * This function is to be provided by each implementation separately in
ttodorov 12:d0978272a340 467 * order to account for different color depths used by the controller.
ttodorov 10:69571adcfad5 468 * \param color The color of the pixel.
ttodorov 20:4bdca8d8dadc 469 * \param mode The depth (palette) of the color.
ttodorov 10:69571adcfad5 470 */
ttodorov 20:4bdca8d8dadc 471 virtual void SetPixelColor( unsigned int color, colordepth_t mode = RGB24 ) = 0;
ttodorov 10:69571adcfad5 472
ttodorov 2:81ed304b7e9b 473 /** Draws a horizontal line.
ttodorov 2:81ed304b7e9b 474 *
ttodorov 2:81ed304b7e9b 475 * This is a utility function to draw horizontal-only lines
ttodorov 2:81ed304b7e9b 476 * for reduced code complexity and faster execution.
ttodorov 2:81ed304b7e9b 477 *
ttodorov 2:81ed304b7e9b 478 * \param x X coordinate of the starting point of the line.
ttodorov 2:81ed304b7e9b 479 * \param y Y coordinate of the starting point of the line.
ttodorov 2:81ed304b7e9b 480 * \param len Length of the line.
ttodorov 2:81ed304b7e9b 481 * \param color The color to use to draw the line. By default the global foreground color is used ( -2 ),
ttodorov 12:d0978272a340 482 * -1 switches to the default background color, or any custom color can be used.
ttodorov 2:81ed304b7e9b 483 */
ttodorov 2:81ed304b7e9b 484 virtual void DrawHLine( unsigned short x, unsigned short y, unsigned short len, int color = -2 );
ttodorov 0:881ff0b71102 485
ttodorov 2:81ed304b7e9b 486 /** Draws a vertical line.
ttodorov 2:81ed304b7e9b 487 *
ttodorov 2:81ed304b7e9b 488 * This is a utility function to draw vertical-only lines
ttodorov 2:81ed304b7e9b 489 * for reduced code complexity and faster execution.
ttodorov 2:81ed304b7e9b 490 *
ttodorov 2:81ed304b7e9b 491 * \param x X coordinate of the starting point of the line.
ttodorov 2:81ed304b7e9b 492 * \param y Y coordinate of the starting point of the line.
ttodorov 2:81ed304b7e9b 493 * \param len Height of the line.
ttodorov 2:81ed304b7e9b 494 * \param color The color to use to draw the line. By default the global foreground color is used ( -2 ),
ttodorov 12:d0978272a340 495 * -1 switches to the default background color, or any custom color can be used.
ttodorov 2:81ed304b7e9b 496 */
ttodorov 2:81ed304b7e9b 497 virtual void DrawVLine( unsigned short x, unsigned short y, unsigned short len, int color = -2 );
ttodorov 2:81ed304b7e9b 498
ttodorov 2:81ed304b7e9b 499 /** Prints a character at the given position and using the given color.
ttodorov 2:81ed304b7e9b 500 *
ttodorov 2:81ed304b7e9b 501 * \param c The character.
ttodorov 2:81ed304b7e9b 502 * \param x X coordinate of the character position.
ttodorov 2:81ed304b7e9b 503 * \param y Y coordinate of the character position.
ttodorov 2:81ed304b7e9b 504 * \param fgColor Foreground color for drawing. By default the global foreground color is used ( -2 ),
ttodorov 12:d0978272a340 505 * -1 switches to the default background color, or any custom color can be used.
ttodorov 2:81ed304b7e9b 506 * \param bgColor Background color for drawing. By default the global background color is used ( -1 ),
ttodorov 12:d0978272a340 507 * -2 switches to the default foreground color, or any custom color can be used.
ttodorov 2:81ed304b7e9b 508 */
ttodorov 2:81ed304b7e9b 509 virtual void PrintChar( char c, unsigned short x, unsigned short y, int fgColor = -2, int bgColor = -1 );
ttodorov 2:81ed304b7e9b 510
ttodorov 2:81ed304b7e9b 511 /** Prints a character at the given position and using the given color and with the given rotation.
ttodorov 2:81ed304b7e9b 512 *
ttodorov 2:81ed304b7e9b 513 * \param c The character.
ttodorov 2:81ed304b7e9b 514 * \param x X coordinate of the character position.
ttodorov 2:81ed304b7e9b 515 * \param y Y coordinate of the character position.
ttodorov 2:81ed304b7e9b 516 * \param pos Position of the character in the string from which it originates (used to rotate a whole string).
ttodorov 2:81ed304b7e9b 517 * \param fgColor Foreground color for drawing. By default the global foreground color is used ( -2 ),
ttodorov 12:d0978272a340 518 * -1 switches to the default background color, or any custom color can be used.
ttodorov 2:81ed304b7e9b 519 * \param bgColor Background color for drawing. By default the global background color is used ( -1 ),
ttodorov 12:d0978272a340 520 * -2 switches to the default foreground color, or any custom color can be used.
ttodorov 2:81ed304b7e9b 521 * \param deg The angle at which to rotate.
ttodorov 2:81ed304b7e9b 522 */
ttodorov 2:81ed304b7e9b 523 virtual void RotateChar( char c, unsigned short x, unsigned short y, int pos, int fgColor = -2, int bgColor = -1, unsigned short deg = 0 );
ttodorov 0:881ff0b71102 524
ttodorov 0:881ff0b71102 525 protected:
ttodorov 4:3ac4239f6c9c 526 unsigned short _disp_width, _disp_height;
ttodorov 4:3ac4239f6c9c 527 DigitalOut _lcd_pin_cs, _lcd_pin_rs, _lcd_pin_reset;
ttodorov 4:3ac4239f6c9c 528 orientation_t _orientation;
ttodorov 12:d0978272a340 529 colordepth_t _colorDepth;
ttodorov 12:d0978272a340 530 unsigned int _foreground, _background;
ttodorov 4:3ac4239f6c9c 531 font_metrics_t _font;
ttodorov 0:881ff0b71102 532 };
ttodorov 0:881ff0b71102 533
ttodorov 6:059ca1648211 534 #ifdef __cplusplus
ttodorov 6:059ca1648211 535 }
ttodorov 6:059ca1648211 536 #endif
ttodorov 6:059ca1648211 537
ttodorov 3:64a5b67d5b51 538 #endif /* TFTLCD_BASE_H */