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:
Sat Jan 26 02:55:46 2013 +0000
Revision:
21:e5c1e8ffada1
Parent:
20:4bdca8d8dadc
Child:
22:4c169297f374
- replaced old fonts with the better Terminus font in 8x12 and 16x28 sizes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ttodorov 0:881ff0b71102 1 /*
ttodorov 0:881ff0b71102 2 * Copyright (C)2010-2012 Henning Karlsen. All right reserved.
ttodorov 0:881ff0b71102 3 * Copyright (C)2012 Todor Todorov.
ttodorov 0:881ff0b71102 4 *
ttodorov 0:881ff0b71102 5 * This library is free software; you can redistribute it and/or
ttodorov 0:881ff0b71102 6 * modify it under the terms of the GNU Lesser General Public
ttodorov 0:881ff0b71102 7 * License as published by the Free Software Foundation; either
ttodorov 0:881ff0b71102 8 * version 2.1 of the License, or (at your option) any later version.
ttodorov 0:881ff0b71102 9 *
ttodorov 0:881ff0b71102 10 * This library is distributed in the hope that it will be useful,
ttodorov 0:881ff0b71102 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ttodorov 0:881ff0b71102 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
ttodorov 0:881ff0b71102 13 * Lesser General Public License for more details.
ttodorov 0:881ff0b71102 14 *
ttodorov 0:881ff0b71102 15 * You should have received a copy of the GNU Lesser General Public
ttodorov 0:881ff0b71102 16 * License along with this library; if not, write to:
ttodorov 0:881ff0b71102 17 *
ttodorov 0:881ff0b71102 18 * Free Software Foundation, Inc.
ttodorov 0:881ff0b71102 19 * 51 Franklin St, 5th Floor, Boston, MA 02110-1301, USA
ttodorov 0:881ff0b71102 20 *
ttodorov 0:881ff0b71102 21 *********************************************************************/
ttodorov 0:881ff0b71102 22 #include "lcd_base.h"
ttodorov 3:64a5b67d5b51 23 #include "helpers.h"
ttodorov 0:881ff0b71102 24
ttodorov 4:3ac4239f6c9c 25 LCD::LCD( unsigned short width, unsigned short height ,PinName CS, PinName RS, PinName RESET )
ttodorov 4:3ac4239f6c9c 26 : _disp_width( width ), _disp_height( height ), _lcd_pin_cs( CS ), _lcd_pin_rs( RS ), _lcd_pin_reset( RESET )
ttodorov 4:3ac4239f6c9c 27 {
ttodorov 4:3ac4239f6c9c 28 SetForeground();
ttodorov 4:3ac4239f6c9c 29 SetBackground();
ttodorov 21:e5c1e8ffada1 30 _font = &TerminusFont;
ttodorov 4:3ac4239f6c9c 31 }
ttodorov 0:881ff0b71102 32
ttodorov 0:881ff0b71102 33 inline
ttodorov 12:d0978272a340 34 void LCD::SetForeground( unsigned int color )
ttodorov 0:881ff0b71102 35 {
ttodorov 0:881ff0b71102 36 _foreground = color;
ttodorov 0:881ff0b71102 37 }
ttodorov 0:881ff0b71102 38
ttodorov 0:881ff0b71102 39 inline
ttodorov 12:d0978272a340 40 void LCD::SetBackground( unsigned int color )
ttodorov 0:881ff0b71102 41 {
ttodorov 0:881ff0b71102 42 _background = color;
ttodorov 0:881ff0b71102 43 }
ttodorov 0:881ff0b71102 44
ttodorov 21:e5c1e8ffada1 45 void LCD::SetFont( const font_t *font )
ttodorov 0:881ff0b71102 46 {
ttodorov 21:e5c1e8ffada1 47 _font = font;
ttodorov 0:881ff0b71102 48 }
ttodorov 0:881ff0b71102 49
ttodorov 0:881ff0b71102 50 inline
ttodorov 0:881ff0b71102 51 unsigned short LCD::GetWidth( void )
ttodorov 0:881ff0b71102 52 {
ttodorov 12:d0978272a340 53 if ( _orientation == LANDSCAPE || _orientation == LANDSCAPE_REV ) return _disp_height;
ttodorov 0:881ff0b71102 54 return _disp_width;
ttodorov 0:881ff0b71102 55 }
ttodorov 0:881ff0b71102 56
ttodorov 0:881ff0b71102 57 inline
ttodorov 0:881ff0b71102 58 unsigned short LCD::GetHeight( void )
ttodorov 0:881ff0b71102 59 {
ttodorov 12:d0978272a340 60 if ( _orientation == LANDSCAPE || _orientation == LANDSCAPE_REV ) return _disp_width;
ttodorov 0:881ff0b71102 61 return _disp_height;
ttodorov 0:881ff0b71102 62 }
ttodorov 0:881ff0b71102 63
ttodorov 21:e5c1e8ffada1 64 inline
ttodorov 21:e5c1e8ffada1 65 uint8_t LCD::GetFontWidth( void )
ttodorov 21:e5c1e8ffada1 66 {
ttodorov 21:e5c1e8ffada1 67 if ( _font != 0 ) return _font->Width;
ttodorov 21:e5c1e8ffada1 68 return 0;
ttodorov 21:e5c1e8ffada1 69 }
ttodorov 21:e5c1e8ffada1 70
ttodorov 21:e5c1e8ffada1 71 inline
ttodorov 21:e5c1e8ffada1 72 uint8_t LCD::GetFontHeight( void )
ttodorov 21:e5c1e8ffada1 73 {
ttodorov 21:e5c1e8ffada1 74 if ( _font != 0 ) return _font->Height;
ttodorov 21:e5c1e8ffada1 75 return 0;
ttodorov 21:e5c1e8ffada1 76 }
ttodorov 21:e5c1e8ffada1 77
ttodorov 0:881ff0b71102 78 void LCD::FillScreen( int color )
ttodorov 0:881ff0b71102 79 {
ttodorov 12:d0978272a340 80 unsigned int rgb = color == -1 ? _background : color == -2 ? _foreground : ( unsigned int ) color;
ttodorov 4:3ac4239f6c9c 81 Activate();
ttodorov 2:81ed304b7e9b 82 ClearXY();
ttodorov 1:14bef43daf6f 83 for ( int i = 0; i < ( ( _disp_width ) * ( _disp_height ) ); i++ )
ttodorov 10:69571adcfad5 84 SetPixelColor( rgb );
ttodorov 4:3ac4239f6c9c 85 Deactivate();
ttodorov 0:881ff0b71102 86 }
ttodorov 0:881ff0b71102 87
ttodorov 0:881ff0b71102 88 inline
ttodorov 0:881ff0b71102 89 void LCD::ClearScreen( void )
ttodorov 0:881ff0b71102 90 {
ttodorov 0:881ff0b71102 91 FillScreen( -1 );
ttodorov 0:881ff0b71102 92 }
ttodorov 0:881ff0b71102 93
ttodorov 0:881ff0b71102 94 void LCD::DrawPixel( unsigned short x, unsigned short y, int color )
ttodorov 0:881ff0b71102 95 {
ttodorov 4:3ac4239f6c9c 96 Activate();
ttodorov 2:81ed304b7e9b 97 SetXY( x, y, x, y );
ttodorov 10:69571adcfad5 98 SetPixelColor( color == -1 ? _background :
ttodorov 0:881ff0b71102 99 color == -2 ? _foreground : color );
ttodorov 4:3ac4239f6c9c 100 Deactivate();
ttodorov 0:881ff0b71102 101 }
ttodorov 0:881ff0b71102 102
ttodorov 0:881ff0b71102 103 void LCD::DrawLine( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, int color )
ttodorov 0:881ff0b71102 104 {
ttodorov 0:881ff0b71102 105
ttodorov 0:881ff0b71102 106 double delta, tx, ty;
ttodorov 0:881ff0b71102 107
ttodorov 0:881ff0b71102 108 if ( ( ( x2 - x1 ) < 0 ) )
ttodorov 0:881ff0b71102 109 {
ttodorov 0:881ff0b71102 110 swap( ushort, x1, x2 )
ttodorov 0:881ff0b71102 111 swap( ushort, y1, y2 )
ttodorov 0:881ff0b71102 112 }
ttodorov 0:881ff0b71102 113 if ( ( ( y2 - y1 ) < 0 ) )
ttodorov 0:881ff0b71102 114 {
ttodorov 0:881ff0b71102 115 swap( ushort, x1, x2 )
ttodorov 0:881ff0b71102 116 swap( ushort, y1, y2 )
ttodorov 0:881ff0b71102 117 }
ttodorov 0:881ff0b71102 118
ttodorov 0:881ff0b71102 119 if ( y1 == y2 )
ttodorov 0:881ff0b71102 120 {
ttodorov 0:881ff0b71102 121 if ( x1 > x2 )
ttodorov 0:881ff0b71102 122 swap( ushort, x1, x2 )
ttodorov 2:81ed304b7e9b 123 DrawHLine( x1, y1, x2 - x1, color );
ttodorov 0:881ff0b71102 124 }
ttodorov 0:881ff0b71102 125 else if ( x1 == x2 )
ttodorov 0:881ff0b71102 126 {
ttodorov 0:881ff0b71102 127 if ( y1 > y2 )
ttodorov 0:881ff0b71102 128 swap( ushort, y1, y2 )
ttodorov 2:81ed304b7e9b 129 DrawVLine( x1, y1, y2 - y1, color );
ttodorov 0:881ff0b71102 130 }
ttodorov 4:3ac4239f6c9c 131 else
ttodorov 0:881ff0b71102 132 {
ttodorov 12:d0978272a340 133 unsigned int usedColor = color == -1 ? _background : color == -2 ? _foreground : ( unsigned int ) color;
ttodorov 4:3ac4239f6c9c 134 Activate();
ttodorov 4:3ac4239f6c9c 135 if ( abs( x2 - x1 ) > abs( y2 - y1 ) )
ttodorov 0:881ff0b71102 136 {
ttodorov 4:3ac4239f6c9c 137 delta = ( double( y2 - y1 ) / double( x2 - x1 ) );
ttodorov 4:3ac4239f6c9c 138 ty = double( y1 );
ttodorov 4:3ac4239f6c9c 139 if ( x1 > x2 )
ttodorov 0:881ff0b71102 140 {
ttodorov 4:3ac4239f6c9c 141 for ( int i = x1; i >= x2; i-- )
ttodorov 4:3ac4239f6c9c 142 {
ttodorov 4:3ac4239f6c9c 143 SetXY( i, int( ty + 0.5 ), i, int( ty + 0.5 ) );
ttodorov 10:69571adcfad5 144 SetPixelColor( usedColor );
ttodorov 4:3ac4239f6c9c 145 ty = ty - delta;
ttodorov 4:3ac4239f6c9c 146 }
ttodorov 4:3ac4239f6c9c 147 }
ttodorov 4:3ac4239f6c9c 148 else
ttodorov 4:3ac4239f6c9c 149 {
ttodorov 4:3ac4239f6c9c 150 for ( int i = x1; i <= x2; i++ )
ttodorov 4:3ac4239f6c9c 151 {
ttodorov 4:3ac4239f6c9c 152 SetXY( i, int( ty + 0.5 ), i, int( ty + 0.5 ) );
ttodorov 10:69571adcfad5 153 SetPixelColor( usedColor );
ttodorov 4:3ac4239f6c9c 154 ty = ty + delta;
ttodorov 4:3ac4239f6c9c 155 }
ttodorov 0:881ff0b71102 156 }
ttodorov 0:881ff0b71102 157 }
ttodorov 0:881ff0b71102 158 else
ttodorov 0:881ff0b71102 159 {
ttodorov 4:3ac4239f6c9c 160 delta = ( float( x2 - x1 ) / float( y2 - y1 ) );
ttodorov 4:3ac4239f6c9c 161 tx = float( x1 );
ttodorov 4:3ac4239f6c9c 162 if ( y1 > y2 )
ttodorov 0:881ff0b71102 163 {
ttodorov 4:3ac4239f6c9c 164 for ( int i = y2 + 1; i > y1; i-- )
ttodorov 4:3ac4239f6c9c 165 {
ttodorov 4:3ac4239f6c9c 166 SetXY( int( tx + 0.5 ), i, int( tx + 0.5 ), i );
ttodorov 10:69571adcfad5 167 SetPixelColor( usedColor );
ttodorov 4:3ac4239f6c9c 168 tx = tx + delta;
ttodorov 4:3ac4239f6c9c 169 }
ttodorov 4:3ac4239f6c9c 170 }
ttodorov 4:3ac4239f6c9c 171 else
ttodorov 4:3ac4239f6c9c 172 {
ttodorov 4:3ac4239f6c9c 173 for ( int i = y1; i < y2 + 1; i++ )
ttodorov 4:3ac4239f6c9c 174 {
ttodorov 4:3ac4239f6c9c 175 SetXY( int( tx + 0.5 ), i, int( tx + 0.5 ), i );
ttodorov 10:69571adcfad5 176 SetPixelColor( usedColor );
ttodorov 4:3ac4239f6c9c 177 tx = tx + delta;
ttodorov 4:3ac4239f6c9c 178 }
ttodorov 0:881ff0b71102 179 }
ttodorov 0:881ff0b71102 180 }
ttodorov 4:3ac4239f6c9c 181 Deactivate();
ttodorov 0:881ff0b71102 182 }
ttodorov 0:881ff0b71102 183 }
ttodorov 0:881ff0b71102 184
ttodorov 0:881ff0b71102 185 void LCD::DrawRect( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, int color )
ttodorov 0:881ff0b71102 186 {
ttodorov 0:881ff0b71102 187 if ( x1 > x2 ) swap( ushort, x1, x2 )
ttodorov 0:881ff0b71102 188 if ( y1 > y2 ) swap( ushort, y1, y2 )
ttodorov 0:881ff0b71102 189
ttodorov 2:81ed304b7e9b 190 DrawHLine( x1, y1, x2 - x1, color );
ttodorov 2:81ed304b7e9b 191 DrawHLine( x1, y2, x2 - x1, color );
ttodorov 2:81ed304b7e9b 192 DrawVLine( x1, y1, y2 - y1, color );
ttodorov 2:81ed304b7e9b 193 DrawVLine( x2, y1, y2 - y1, color );
ttodorov 0:881ff0b71102 194 }
ttodorov 0:881ff0b71102 195
ttodorov 0:881ff0b71102 196 void LCD::DrawRoundRect( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, int color )
ttodorov 0:881ff0b71102 197 {
ttodorov 0:881ff0b71102 198 if ( x1 > x2 ) swap( ushort, x1, x2 )
ttodorov 0:881ff0b71102 199 if ( y1 > y2 ) swap( ushort, y1, y2 )
ttodorov 0:881ff0b71102 200
ttodorov 0:881ff0b71102 201 if ( ( x2 - x1 ) > 4 && ( y2 - y1 ) > 4 )
ttodorov 0:881ff0b71102 202 {
ttodorov 0:881ff0b71102 203 DrawPixel( x1 + 1, y1 + 1, color );
ttodorov 0:881ff0b71102 204 DrawPixel( x2 - 1, y1 + 1, color );
ttodorov 0:881ff0b71102 205 DrawPixel( x1 + 1, y2 - 1, color );
ttodorov 0:881ff0b71102 206 DrawPixel( x2 - 1, y2 - 1, color );
ttodorov 2:81ed304b7e9b 207 DrawHLine( x1 + 2, y1, x2 - x1 - 4, color );
ttodorov 2:81ed304b7e9b 208 DrawHLine( x1 + 2, y2, x2 - x1 - 4, color );
ttodorov 2:81ed304b7e9b 209 DrawVLine( x1, y1 + 2, y2 - y1 - 4, color );
ttodorov 2:81ed304b7e9b 210 DrawVLine( x2, y1 + 2, y2 - y1 - 4, color );
ttodorov 0:881ff0b71102 211 }
ttodorov 0:881ff0b71102 212 }
ttodorov 0:881ff0b71102 213
ttodorov 0:881ff0b71102 214 void LCD::FillRect( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, int color )
ttodorov 0:881ff0b71102 215 {
ttodorov 0:881ff0b71102 216 if ( x1 > x2 ) swap( ushort, x1, x2 );
ttodorov 0:881ff0b71102 217 if ( y1 > y2 ) swap( ushort, y1, y2 );
ttodorov 0:881ff0b71102 218
ttodorov 12:d0978272a340 219 for ( int i = 0; i < ( ( y2 - y1 ) / 2 ) + 1; i++ )
ttodorov 0:881ff0b71102 220 {
ttodorov 12:d0978272a340 221 DrawHLine( x1, y1 + i, x2 - x1, color );
ttodorov 12:d0978272a340 222 DrawHLine( x1, y2 - i, x2 - x1, color );
ttodorov 0:881ff0b71102 223 }
ttodorov 0:881ff0b71102 224 }
ttodorov 0:881ff0b71102 225
ttodorov 0:881ff0b71102 226 void LCD::FillRoundRect( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, int color )
ttodorov 0:881ff0b71102 227 {
ttodorov 0:881ff0b71102 228 if ( x1 > x2 ) swap( ushort, x1, x2 )
ttodorov 0:881ff0b71102 229 if ( y1 > y2 ) swap( ushort, y1, y2 )
ttodorov 0:881ff0b71102 230
ttodorov 0:881ff0b71102 231 if ( ( x2 - x1 ) > 4 && ( y2 - y1 ) > 4 )
ttodorov 0:881ff0b71102 232 {
ttodorov 0:881ff0b71102 233 for ( int i = 0; i < ( ( y2 - y1 ) / 2 ) + 1; i++ )
ttodorov 0:881ff0b71102 234 {
ttodorov 0:881ff0b71102 235 switch ( i )
ttodorov 0:881ff0b71102 236 {
ttodorov 0:881ff0b71102 237 case 0:
ttodorov 2:81ed304b7e9b 238 DrawHLine( x1 + 2, y1 + i, x2 - x1 - 4, color );
ttodorov 2:81ed304b7e9b 239 DrawHLine( x1 + 2, y2 - i, x2 - x1 - 4, color );
ttodorov 0:881ff0b71102 240 break;
ttodorov 0:881ff0b71102 241
ttodorov 0:881ff0b71102 242 case 1:
ttodorov 2:81ed304b7e9b 243 DrawHLine( x1 + 1, y1 + i, x2 - x1 - 2, color );
ttodorov 2:81ed304b7e9b 244 DrawHLine( x1 + 1, y2 - i, x2 - x1 - 2, color );
ttodorov 0:881ff0b71102 245 break;
ttodorov 0:881ff0b71102 246
ttodorov 0:881ff0b71102 247 default:
ttodorov 2:81ed304b7e9b 248 DrawHLine( x1, y1 + i, x2 - x1, color );
ttodorov 2:81ed304b7e9b 249 DrawHLine( x1, y2 - i, x2 - x1, color );
ttodorov 0:881ff0b71102 250 break;
ttodorov 0:881ff0b71102 251 }
ttodorov 0:881ff0b71102 252 }
ttodorov 0:881ff0b71102 253 }
ttodorov 0:881ff0b71102 254 }
ttodorov 0:881ff0b71102 255
ttodorov 0:881ff0b71102 256 void LCD::DrawCircle( unsigned short x, unsigned short y, unsigned short radius, int color )
ttodorov 0:881ff0b71102 257 {
ttodorov 0:881ff0b71102 258 int f = 1 - radius;
ttodorov 0:881ff0b71102 259 int ddF_x = 1;
ttodorov 0:881ff0b71102 260 int ddF_y = -2 * radius;
ttodorov 0:881ff0b71102 261 int x1 = 0;
ttodorov 0:881ff0b71102 262 int y1 = radius;
ttodorov 12:d0978272a340 263 unsigned int usedColor = color == -1 ? _background : color == -2 ? _foreground : ( unsigned int ) color;
ttodorov 0:881ff0b71102 264
ttodorov 4:3ac4239f6c9c 265 Activate();
ttodorov 2:81ed304b7e9b 266 SetXY( x, y + radius, x, y + radius );
ttodorov 10:69571adcfad5 267 SetPixelColor( usedColor );
ttodorov 2:81ed304b7e9b 268 SetXY( x, y - radius, x, y - radius );
ttodorov 10:69571adcfad5 269 SetPixelColor( usedColor );
ttodorov 2:81ed304b7e9b 270 SetXY( x + radius, y, x + radius, y );
ttodorov 10:69571adcfad5 271 SetPixelColor( usedColor );
ttodorov 2:81ed304b7e9b 272 SetXY( x - radius, y, x - radius, y );
ttodorov 10:69571adcfad5 273 SetPixelColor( usedColor );
ttodorov 0:881ff0b71102 274
ttodorov 0:881ff0b71102 275 while ( x1 < y1 )
ttodorov 0:881ff0b71102 276 {
ttodorov 0:881ff0b71102 277 if ( f >= 0 )
ttodorov 0:881ff0b71102 278 {
ttodorov 0:881ff0b71102 279 y1--;
ttodorov 0:881ff0b71102 280 ddF_y += 2;
ttodorov 0:881ff0b71102 281 f += ddF_y;
ttodorov 0:881ff0b71102 282 }
ttodorov 0:881ff0b71102 283 x1++;
ttodorov 0:881ff0b71102 284 ddF_x += 2;
ttodorov 0:881ff0b71102 285 f += ddF_x;
ttodorov 2:81ed304b7e9b 286 SetXY( x + x1, y + y1, x + x1, y + y1 );
ttodorov 10:69571adcfad5 287 SetPixelColor( usedColor );
ttodorov 2:81ed304b7e9b 288 SetXY( x - x1, y + y1, x - x1, y + y1 );
ttodorov 10:69571adcfad5 289 SetPixelColor( usedColor );
ttodorov 2:81ed304b7e9b 290 SetXY( x + x1, y - y1, x + x1, y - y1 );
ttodorov 10:69571adcfad5 291 SetPixelColor( usedColor );
ttodorov 2:81ed304b7e9b 292 SetXY( x - x1, y - y1, x - x1, y - y1 );
ttodorov 10:69571adcfad5 293 SetPixelColor( usedColor );
ttodorov 2:81ed304b7e9b 294 SetXY( x + y1, y + x1, x + y1, y + x1 );
ttodorov 10:69571adcfad5 295 SetPixelColor( usedColor );
ttodorov 2:81ed304b7e9b 296 SetXY( x - y1, y + x1, x - y1, y + x1 );
ttodorov 10:69571adcfad5 297 SetPixelColor( usedColor );
ttodorov 2:81ed304b7e9b 298 SetXY( x + y1, y - x1, x + y1, y - x1 );
ttodorov 10:69571adcfad5 299 SetPixelColor( usedColor );
ttodorov 2:81ed304b7e9b 300 SetXY( x - y1, y - x1, x - y1, y - x1 );
ttodorov 10:69571adcfad5 301 SetPixelColor( usedColor );
ttodorov 0:881ff0b71102 302 }
ttodorov 4:3ac4239f6c9c 303 Deactivate();
ttodorov 0:881ff0b71102 304 }
ttodorov 0:881ff0b71102 305
ttodorov 0:881ff0b71102 306 void LCD::FillCircle( unsigned short x, unsigned short y, unsigned short radius, int color )
ttodorov 0:881ff0b71102 307 {
ttodorov 12:d0978272a340 308 unsigned int usedColor = color == -1 ? _background : color == -2 ? _foreground : ( unsigned int ) color;
ttodorov 4:3ac4239f6c9c 309 Activate();
ttodorov 0:881ff0b71102 310 for ( int y1 = -radius; y1 <= radius; y1++ )
ttodorov 0:881ff0b71102 311 for ( int x1 = -radius; x1 <= radius; x1++ )
ttodorov 0:881ff0b71102 312 if ( x1 * x1 + y1 * y1 <= radius * radius )
ttodorov 0:881ff0b71102 313 {
ttodorov 2:81ed304b7e9b 314 SetXY( x + x1, y + y1, x + x1, y + y1 );
ttodorov 10:69571adcfad5 315 SetPixelColor( usedColor );
ttodorov 0:881ff0b71102 316 }
ttodorov 4:3ac4239f6c9c 317 Deactivate();
ttodorov 0:881ff0b71102 318 }
ttodorov 0:881ff0b71102 319
ttodorov 0:881ff0b71102 320 void LCD::Print( const char *str, unsigned short x, unsigned short y, int fgColor, int bgColor, unsigned short deg )
ttodorov 0:881ff0b71102 321 {
ttodorov 0:881ff0b71102 322 int stl, i;
ttodorov 0:881ff0b71102 323
ttodorov 0:881ff0b71102 324 stl = strlen( str );
ttodorov 0:881ff0b71102 325
ttodorov 12:d0978272a340 326 if ( x == RIGHT )
ttodorov 21:e5c1e8ffada1 327 x = GetWidth() - ( stl * _font->Width );
ttodorov 12:d0978272a340 328 if ( x == CENTER )
ttodorov 21:e5c1e8ffada1 329 x = ( GetWidth() - ( stl * _font->Width ) ) / 2;
ttodorov 0:881ff0b71102 330
ttodorov 0:881ff0b71102 331 for ( i = 0; i < stl; i++ )
ttodorov 0:881ff0b71102 332 if ( deg == 0 )
ttodorov 21:e5c1e8ffada1 333 PrintChar( *str++, x + ( i * ( _font->Width ) ), y, fgColor, bgColor );
ttodorov 0:881ff0b71102 334 else
ttodorov 2:81ed304b7e9b 335 RotateChar( *str++, x, y, i, fgColor, bgColor, deg );
ttodorov 0:881ff0b71102 336 }
ttodorov 0:881ff0b71102 337
ttodorov 12:d0978272a340 338 void LCD::DrawBitmap( unsigned short x, unsigned short y, const bitmap_t* img, unsigned char scale )
ttodorov 0:881ff0b71102 339 {
ttodorov 0:881ff0b71102 340 int tx, ty, tc, tsx, tsy;
ttodorov 0:881ff0b71102 341
ttodorov 4:3ac4239f6c9c 342 Activate();
ttodorov 0:881ff0b71102 343 if ( scale == 1 )
ttodorov 0:881ff0b71102 344 {
ttodorov 12:d0978272a340 345 SetXY( x, y, x + img->Width - 1, y + img->Height - 1 );
ttodorov 20:4bdca8d8dadc 346
ttodorov 13:5ceeba86bbe4 347 if ( img->Format == RGB16 )
ttodorov 0:881ff0b71102 348 {
ttodorov 13:5ceeba86bbe4 349 const unsigned short *pixel = ( const unsigned short* ) img->PixelData;
ttodorov 20:4bdca8d8dadc 350 for ( tc = 0; tc < ( img->Width * img->Height ); tc++ )
ttodorov 20:4bdca8d8dadc 351 SetPixelColor( *pixel++, img->Format );
ttodorov 13:5ceeba86bbe4 352 }
ttodorov 13:5ceeba86bbe4 353 else if ( img->Format == RGB18 )
ttodorov 13:5ceeba86bbe4 354 {
ttodorov 13:5ceeba86bbe4 355 const unsigned int *pixel = ( const unsigned int* ) img->PixelData;
ttodorov 20:4bdca8d8dadc 356 for ( tc = 0; tc < ( img->Width * img->Height ); tc++ )
ttodorov 20:4bdca8d8dadc 357 SetPixelColor( *pixel++, img->Format );
ttodorov 0:881ff0b71102 358 }
ttodorov 0:881ff0b71102 359 }
ttodorov 0:881ff0b71102 360 else
ttodorov 0:881ff0b71102 361 {
ttodorov 13:5ceeba86bbe4 362 if ( img->Format == RGB16 )
ttodorov 0:881ff0b71102 363 {
ttodorov 13:5ceeba86bbe4 364 const unsigned short *pixel = ( const unsigned short* ) img->PixelData;
ttodorov 13:5ceeba86bbe4 365
ttodorov 13:5ceeba86bbe4 366 for ( ty = 0; ty < img->Height; ty++ )
ttodorov 13:5ceeba86bbe4 367 {
ttodorov 13:5ceeba86bbe4 368 SetXY( x, y + ( ty * scale ), x + ( ( img->Width * scale ) - 1 ), y + ( ty * scale ) + scale );
ttodorov 13:5ceeba86bbe4 369 for ( tsy = 0; tsy < scale; tsy++ )
ttodorov 13:5ceeba86bbe4 370 {
ttodorov 13:5ceeba86bbe4 371 for ( tx = 0; tx < img->Width; tx++ )
ttodorov 13:5ceeba86bbe4 372 {
ttodorov 13:5ceeba86bbe4 373 for ( tsx = 0; tsx < scale; tsx++ )
ttodorov 20:4bdca8d8dadc 374 SetPixelColor( pixel[ ( ty * img->Width ) + tx ], img->Format );
ttodorov 20:4bdca8d8dadc 375 }
ttodorov 20:4bdca8d8dadc 376 }
ttodorov 20:4bdca8d8dadc 377 }
ttodorov 20:4bdca8d8dadc 378 }
ttodorov 20:4bdca8d8dadc 379 else if ( img->Format == RGB18 )
ttodorov 20:4bdca8d8dadc 380 {
ttodorov 20:4bdca8d8dadc 381 const unsigned int *pixel = ( const unsigned int* ) img->PixelData;
ttodorov 20:4bdca8d8dadc 382
ttodorov 20:4bdca8d8dadc 383 for ( ty = 0; ty < img->Height; ty++ )
ttodorov 20:4bdca8d8dadc 384 {
ttodorov 20:4bdca8d8dadc 385 SetXY( x, y + ( ty * scale ), x + ( ( img->Width * scale ) - 1 ), y + ( ty * scale ) + scale );
ttodorov 20:4bdca8d8dadc 386 for ( tsy = 0; tsy < scale; tsy++ )
ttodorov 20:4bdca8d8dadc 387 {
ttodorov 20:4bdca8d8dadc 388 for ( tx = 0; tx < img->Width; tx++ )
ttodorov 20:4bdca8d8dadc 389 {
ttodorov 20:4bdca8d8dadc 390 for ( tsx = 0; tsx < scale; tsx++ )
ttodorov 20:4bdca8d8dadc 391 SetPixelColor( pixel[ ( ty * img->Width ) + tx ], img->Format );
ttodorov 13:5ceeba86bbe4 392 }
ttodorov 13:5ceeba86bbe4 393 }
ttodorov 13:5ceeba86bbe4 394 }
ttodorov 13:5ceeba86bbe4 395 }
ttodorov 0:881ff0b71102 396 }
ttodorov 4:3ac4239f6c9c 397 Deactivate();
ttodorov 0:881ff0b71102 398 }
ttodorov 0:881ff0b71102 399
ttodorov 12:d0978272a340 400 void LCD::DrawBitmap( unsigned short x, unsigned short y, const bitmap_t* img, unsigned short deg, unsigned short rox, unsigned short roy )
ttodorov 0:881ff0b71102 401 {
ttodorov 0:881ff0b71102 402 int tx, ty, newx, newy;
ttodorov 0:881ff0b71102 403 double radian;
ttodorov 0:881ff0b71102 404 radian = deg * 0.0175;
ttodorov 0:881ff0b71102 405
ttodorov 0:881ff0b71102 406 if ( deg == 0 )
ttodorov 12:d0978272a340 407 DrawBitmap( x, y, img );
ttodorov 0:881ff0b71102 408 else
ttodorov 0:881ff0b71102 409 {
ttodorov 4:3ac4239f6c9c 410 Activate();
ttodorov 13:5ceeba86bbe4 411
ttodorov 13:5ceeba86bbe4 412 if ( img->Format == RGB16 )
ttodorov 13:5ceeba86bbe4 413 {
ttodorov 13:5ceeba86bbe4 414 const unsigned short *pixel = ( const unsigned short* ) img->PixelData;
ttodorov 13:5ceeba86bbe4 415
ttodorov 13:5ceeba86bbe4 416 for ( ty = 0; ty < img->Height; ty++ )
ttodorov 13:5ceeba86bbe4 417 for ( tx = 0; tx < img->Width; tx++ )
ttodorov 13:5ceeba86bbe4 418 {
ttodorov 13:5ceeba86bbe4 419 newx = x + rox + ( ( ( tx - rox ) * cos( radian ) ) - ( ( ty - roy ) * sin( radian ) ) );
ttodorov 13:5ceeba86bbe4 420 newy = y + roy + ( ( ( ty - roy ) * cos( radian ) ) + ( ( tx - rox ) * sin( radian ) ) );
ttodorov 13:5ceeba86bbe4 421
ttodorov 13:5ceeba86bbe4 422 SetXY( newx, newy, newx, newy );
ttodorov 20:4bdca8d8dadc 423 SetPixelColor( pixel[ ( ty * img->Width ) + tx ], img->Format );
ttodorov 13:5ceeba86bbe4 424 }
ttodorov 13:5ceeba86bbe4 425 }
ttodorov 13:5ceeba86bbe4 426 else if ( img->Format == RGB18 )
ttodorov 13:5ceeba86bbe4 427 {
ttodorov 13:5ceeba86bbe4 428 const unsigned int *pixel = ( const unsigned int* ) img->PixelData;
ttodorov 13:5ceeba86bbe4 429
ttodorov 13:5ceeba86bbe4 430 for ( ty = 0; ty < img->Height; ty++ )
ttodorov 13:5ceeba86bbe4 431 for ( tx = 0; tx < img->Width; tx++ )
ttodorov 13:5ceeba86bbe4 432 {
ttodorov 13:5ceeba86bbe4 433 newx = x + rox + ( ( ( tx - rox ) * cos( radian ) ) - ( ( ty - roy ) * sin( radian ) ) );
ttodorov 13:5ceeba86bbe4 434 newy = y + roy + ( ( ( ty - roy ) * cos( radian ) ) + ( ( tx - rox ) * sin( radian ) ) );
ttodorov 13:5ceeba86bbe4 435
ttodorov 13:5ceeba86bbe4 436 SetXY( newx, newy, newx, newy );
ttodorov 20:4bdca8d8dadc 437 SetPixelColor( pixel[ ( ty * img->Width ) + tx ], img->Format );
ttodorov 13:5ceeba86bbe4 438 }
ttodorov 13:5ceeba86bbe4 439 }
ttodorov 4:3ac4239f6c9c 440 Deactivate();
ttodorov 0:881ff0b71102 441 }
ttodorov 4:3ac4239f6c9c 442 }
ttodorov 4:3ac4239f6c9c 443
ttodorov 4:3ac4239f6c9c 444 inline
ttodorov 4:3ac4239f6c9c 445 void LCD::Activate( void )
ttodorov 4:3ac4239f6c9c 446 {
ttodorov 4:3ac4239f6c9c 447 _lcd_pin_cs = LOW;
ttodorov 4:3ac4239f6c9c 448 }
ttodorov 4:3ac4239f6c9c 449
ttodorov 4:3ac4239f6c9c 450 inline
ttodorov 4:3ac4239f6c9c 451 void LCD::Deactivate( void )
ttodorov 4:3ac4239f6c9c 452 {
ttodorov 4:3ac4239f6c9c 453 _lcd_pin_cs = HIGH;
ttodorov 0:881ff0b71102 454 }
ttodorov 0:881ff0b71102 455
ttodorov 0:881ff0b71102 456 inline
ttodorov 2:81ed304b7e9b 457 void LCD::WriteCmdData( unsigned short cmd, unsigned short data )
ttodorov 0:881ff0b71102 458 {
ttodorov 2:81ed304b7e9b 459 WriteCmd( cmd );
ttodorov 2:81ed304b7e9b 460 WriteData( data );
ttodorov 0:881ff0b71102 461 }
ttodorov 0:881ff0b71102 462
ttodorov 12:d0978272a340 463 inline
ttodorov 12:d0978272a340 464 void LCD::ClearXY( void )
ttodorov 0:881ff0b71102 465 {
ttodorov 12:d0978272a340 466 SetXY( 0, 0, GetWidth() - 1, GetHeight() - 1 );
ttodorov 0:881ff0b71102 467 }
ttodorov 0:881ff0b71102 468
ttodorov 2:81ed304b7e9b 469 void LCD::DrawHLine( unsigned short x, unsigned short y, unsigned short len, int color )
ttodorov 0:881ff0b71102 470 {
ttodorov 12:d0978272a340 471 unsigned int usedColor = color == -1 ? _background : color == -2 ? _foreground : ( unsigned int ) color;
ttodorov 0:881ff0b71102 472
ttodorov 4:3ac4239f6c9c 473 Activate();
ttodorov 2:81ed304b7e9b 474 SetXY( x, y, x + len, y );
ttodorov 0:881ff0b71102 475 for ( int i = 0; i < len + 1; i++ )
ttodorov 10:69571adcfad5 476 SetPixelColor( usedColor );
ttodorov 4:3ac4239f6c9c 477 Deactivate();
ttodorov 0:881ff0b71102 478 }
ttodorov 0:881ff0b71102 479
ttodorov 2:81ed304b7e9b 480 void LCD::DrawVLine( unsigned short x, unsigned short y, unsigned short len, int color )
ttodorov 0:881ff0b71102 481 {
ttodorov 12:d0978272a340 482 unsigned int usedColor = color == -1 ? _background : color == -2 ? _foreground : ( unsigned int ) color;
ttodorov 0:881ff0b71102 483
ttodorov 4:3ac4239f6c9c 484 Activate();
ttodorov 2:81ed304b7e9b 485 SetXY( x, y, x, y + len );
ttodorov 0:881ff0b71102 486 for ( int i = 0; i < len; i++ )
ttodorov 10:69571adcfad5 487 SetPixelColor( usedColor );
ttodorov 4:3ac4239f6c9c 488 Deactivate();
ttodorov 0:881ff0b71102 489 }
ttodorov 0:881ff0b71102 490
ttodorov 2:81ed304b7e9b 491 void LCD::PrintChar( char c, unsigned short x, unsigned short y, int fgColor, int bgColor )
ttodorov 0:881ff0b71102 492 {
ttodorov 0:881ff0b71102 493 uint8_t i, ch;
ttodorov 0:881ff0b71102 494 uint16_t j;
ttodorov 12:d0978272a340 495 unsigned int usedColorFG = fgColor == -1 ? _background : fgColor == -2 ? _foreground : ( unsigned int ) fgColor;
ttodorov 12:d0978272a340 496 unsigned int usedColorBG = bgColor == -1 ? _background : bgColor == -2 ? _foreground : ( unsigned int ) bgColor;
ttodorov 21:e5c1e8ffada1 497
ttodorov 21:e5c1e8ffada1 498 uint16_t totalCharBytes = ( _font->Width * _font->Height ) / 8;
ttodorov 21:e5c1e8ffada1 499 int16_t position = _font->Position[ c - _font->Offset ];
ttodorov 21:e5c1e8ffada1 500 if ( position == -1 ) position = 0; // will print space character
ttodorov 21:e5c1e8ffada1 501
ttodorov 4:3ac4239f6c9c 502 Activate();
ttodorov 0:881ff0b71102 503
ttodorov 21:e5c1e8ffada1 504 SetXY( x, y, x + _font->Width - 1, y + _font->Height - 1 );
ttodorov 21:e5c1e8ffada1 505
ttodorov 21:e5c1e8ffada1 506 for ( j = 0; j < totalCharBytes; j++ )
ttodorov 0:881ff0b71102 507 {
ttodorov 21:e5c1e8ffada1 508 ch = _font->Data[ position ];
ttodorov 12:d0978272a340 509 for ( i = 0; i < 8; i++ )
ttodorov 0:881ff0b71102 510 {
ttodorov 21:e5c1e8ffada1 511 if ( ( ch & ( 1 << ( 7 - i ) ) ) != 0 ) SetPixelColor( usedColorFG );
ttodorov 21:e5c1e8ffada1 512 else SetPixelColor( usedColorBG );
ttodorov 0:881ff0b71102 513 }
ttodorov 21:e5c1e8ffada1 514 position++;
ttodorov 0:881ff0b71102 515 }
ttodorov 4:3ac4239f6c9c 516 Deactivate();
ttodorov 0:881ff0b71102 517 }
ttodorov 0:881ff0b71102 518
ttodorov 2:81ed304b7e9b 519 void LCD::RotateChar( char c, unsigned short x, unsigned short y, int pos, int fgColor, int bgColor, unsigned short deg )
ttodorov 0:881ff0b71102 520 {
ttodorov 0:881ff0b71102 521 uint8_t i, j, ch;
ttodorov 0:881ff0b71102 522 int newx, newy;
ttodorov 0:881ff0b71102 523 double radian;
ttodorov 0:881ff0b71102 524 radian = deg * 0.0175;
ttodorov 0:881ff0b71102 525
ttodorov 12:d0978272a340 526 unsigned int usedColorFG = fgColor == -1 ? _background : fgColor == -2 ? _foreground : ( unsigned int ) fgColor;
ttodorov 12:d0978272a340 527 unsigned int usedColorBG = bgColor == -1 ? _background : bgColor == -2 ? _foreground : ( unsigned int ) bgColor;
ttodorov 0:881ff0b71102 528
ttodorov 21:e5c1e8ffada1 529 int16_t position = _font->Position[ c - _font->Offset ];
ttodorov 21:e5c1e8ffada1 530 if ( position == -1 ) position = 0; // will print space character
ttodorov 21:e5c1e8ffada1 531
ttodorov 4:3ac4239f6c9c 532 Activate();
ttodorov 21:e5c1e8ffada1 533
ttodorov 21:e5c1e8ffada1 534 for ( j = 0; j < _font->Height; j++ )
ttodorov 0:881ff0b71102 535 {
ttodorov 21:e5c1e8ffada1 536 for ( uint16_t zz = 0; zz < ( ( double ) _font->Width / 8 ); zz++ )
ttodorov 0:881ff0b71102 537 {
ttodorov 21:e5c1e8ffada1 538 ch = _font->Data[ position + zz ];
ttodorov 0:881ff0b71102 539 for ( i = 0; i < 8; i++ )
ttodorov 0:881ff0b71102 540 {
ttodorov 21:e5c1e8ffada1 541 newx = x + ( ( ( i + ( zz * 8 ) + ( pos * _font->Width ) ) * cos( radian ) ) - ( ( j ) * sin( radian ) ) );
ttodorov 21:e5c1e8ffada1 542 newy = y + ( ( ( j ) * cos( radian ) ) + ( ( i + ( zz * 8 ) + ( pos * _font->Width ) ) * sin( radian ) ) );
ttodorov 0:881ff0b71102 543
ttodorov 2:81ed304b7e9b 544 SetXY( newx, newy, newx + 1, newy + 1 );
ttodorov 0:881ff0b71102 545
ttodorov 21:e5c1e8ffada1 546 if ( ( ch & ( 1 << ( 7 - i ) ) ) != 0 ) SetPixelColor( usedColorFG );
ttodorov 21:e5c1e8ffada1 547 else SetPixelColor( usedColorBG );
ttodorov 0:881ff0b71102 548 }
ttodorov 0:881ff0b71102 549 }
ttodorov 21:e5c1e8ffada1 550 position += ( _font->Width / 8 );
ttodorov 0:881ff0b71102 551 }
ttodorov 21:e5c1e8ffada1 552
ttodorov 4:3ac4239f6c9c 553 Deactivate();
ttodorov 0:881ff0b71102 554 }