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:   UTFT_SSD1289

Fork of TFTLCD by Todor Todorov

Revision:
7:5c418fc1879f
Parent:
4:3ac4239f6c9c
Child:
8:7a4791dbb065
--- a/lcd_base.cpp	Mon Dec 03 15:38:56 2012 +0000
+++ b/lcd_base.cpp	Tue Dec 04 02:26:44 2012 +0000
@@ -346,7 +346,7 @@
             RotateChar( *str++, x, y, i, fgColor, bgColor, deg );
 }
 
-void LCD::DrawBitmap( unsigned short x, unsigned short y, unsigned short sx, unsigned short sy, bitmap_t data, unsigned char scale )
+void LCD::DrawBitmap( unsigned short x, unsigned short y, unsigned short sx, unsigned short sy, const unsigned short* imgPixelData, unsigned char scale )
 {
     int tx, ty, tc, tsx, tsy;
 
@@ -357,7 +357,7 @@
         {
             SetXY( x, y, x + sx - 1, y + sy - 1 );
             for ( tc = 0; tc < ( sx * sy ); tc++ )
-                WriteData( data[ tc ] );
+                WriteData( imgPixelData[ tc ] );
         }
         else
         {
@@ -365,7 +365,7 @@
             {
                 SetXY( x, y + ty, x + sx - 1, y + ty );
                 for ( tx = sx; tx >= 0; tx-- )
-                    WriteData( data[ ( ty * sx ) + tx ] );
+                    WriteData( imgPixelData[ ( ty * sx ) + tx ] );
             }
         }
     }
@@ -379,7 +379,7 @@
                 for ( tsy = 0; tsy < scale; tsy++ )
                     for ( tx = 0; tx < sx; tx++ )
                         for ( tsx = 0; tsx < scale; tsx++ )
-                            WriteData( data[ ( ty * sx ) + tx ] );
+                            WriteData( imgPixelData[ ( ty * sx ) + tx ] );
             }
         }
         else
@@ -391,7 +391,7 @@
                     SetXY( x, y + ( ty * scale ) + tsy, x + ( ( sx * scale ) - 1 ), y + ( ty * scale ) + tsy );
                     for ( tx = sx; tx >= 0; tx-- )
                         for ( tsx = 0; tsx < scale; tsx++ )
-                            WriteData( data[ ( ty * sx ) + tx ] );
+                            WriteData( imgPixelData[ ( ty * sx ) + tx ] );
                 }
             }
         }
@@ -399,14 +399,14 @@
     Deactivate();
 }
 
-void LCD::DrawBitmap( unsigned short x, unsigned short y, unsigned short sx, unsigned short sy, bitmap_t data, unsigned short deg, unsigned short rox, unsigned short roy )
+void LCD::DrawBitmap( unsigned short x, unsigned short y, unsigned short sx, unsigned short sy, const unsigned short* imgPixelData, unsigned short deg, unsigned short rox, unsigned short roy )
 {
     int tx, ty, newx, newy;
     double radian;
     radian = deg * 0.0175;
 
     if ( deg == 0 )
-        DrawBitmap( x, y, sx, sy, data );
+        DrawBitmap( x, y, sx, sy, imgPixelData );
     else
     {
         Activate();
@@ -417,7 +417,7 @@
                 newy = y + roy + ( ( ( ty - roy ) * cos( radian ) ) + ( ( tx - rox ) * sin( radian ) ) );
 
                 SetXY( newx, newy, newx, newy );
-                WriteData( data[ ( ty * sx ) + tx ] );
+                WriteData( imgPixelData[ ( ty * sx ) + tx ] );
             }
         Deactivate();
     }