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:
1:14bef43daf6f
Parent:
0:881ff0b71102
Child:
2:81ed304b7e9b
--- a/lcd_base.cpp	Sat Dec 01 19:38:53 2012 +0000
+++ b/lcd_base.cpp	Sat Dec 01 23:49:10 2012 +0000
@@ -70,7 +70,7 @@
     _lcd_pin_cs = LOW;
     clearXY();
     _lcd_pin_rs = HIGH;
-    for ( int i = 0; i < ( ( _disp_width + 1 ) * ( _disp_height + 1 ) ); i++ )
+    for ( int i = 0; i < ( ( _disp_width ) * ( _disp_height ) ); i++ )
         writeData( rgb );
     _lcd_pin_cs = HIGH;
 }
@@ -332,16 +332,16 @@
     if ( _orientation == PORTRAIT )
     {
         if ( x == RIGHT )
-            x = ( _disp_width + 1 ) - ( stl * _font.width );
+            x = _disp_width - ( stl * _font.width );
         if ( x == CENTER )
-            x = ( ( _disp_width + 1 ) - ( stl * _font.width ) ) / 2;
+            x = ( _disp_width - ( stl * _font.width ) ) / 2;
     }
     else
     {
         if ( x == RIGHT )
-            x = ( _disp_height + 1 ) - ( stl * _font.width );
+            x = _disp_height - ( stl * _font.width );
         if ( x == CENTER )
-            x = ( ( _disp_height + 1 ) - ( stl * _font.width ) ) / 2;
+            x = ( _disp_height - ( stl * _font.width ) ) / 2;
     }
 
     for ( i = 0; i < stl; i++ )
@@ -489,9 +489,9 @@
 void LCD::clearXY()
 {
     if ( _orientation == PORTRAIT )
-        setXY( 0, 0, _disp_width, _disp_height );
+        setXY( 0, 0, _disp_width - 1, _disp_height - 1 );
     else
-        setXY( 0, 0, _disp_height, _disp_width );
+        setXY( 0, 0, _disp_height - 1, _disp_width - 1 );
 }
 
 void LCD::drawHLine( unsigned short x, unsigned short y, unsigned short len, int color )