Code to run the cheap 2.4" TFT made by mcufriend.com on the STM nucleo. No modifications required, this plugs into the arduino header.

Dependents:   ST7735_V2_STM32F407

Fork of TFTLCD_8bit by Thiha Electronics

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();
     }