A modifiedversion of TFTLCD by Todor Todorov with ultra-fast operation for SSD1289 controller. TODO: speed-up fonts, add my own fonts Can work out-of-the-box with ST Nucleo F401RE
Dependents: TFT_320QVT_Window_Drag_Demo TFT_320QVT_HelloWorld
Fork of TFTLCD by
Diff: ili9328.cpp
- Revision:
- 26:28f64fbcf7df
- Parent:
- 25:6cffb758c075
- Child:
- 27:26491d710e72
diff -r 6cffb758c075 -r 28f64fbcf7df ili9328.cpp --- a/ili9328.cpp Sun Jun 16 02:53:06 2013 +0000 +++ b/ili9328.cpp Sun Jun 16 03:36:07 2013 +0000 @@ -85,6 +85,10 @@ } switch ( _colorDepth ) { + case RGB18: + entryMod |= 0x9000; + break; + case RGB16: default: entryMod |= 0x1000; @@ -212,6 +216,7 @@ { unsigned char r, g, b; unsigned short clr; + r = g = b = 0; if ( _colorDepth == RGB16 ) { switch ( mode ) @@ -243,23 +248,20 @@ r = ( ( color >> 8 ) & 0xF8 ) | ( ( color & 0x8000 ) >> 13 ); g = ( color >> 3 ) & 0xFC; b = ( ( color << 3 ) & 0xFC ) | ( ( color >> 3 ) & 0x01 ); - WriteData( ( r << 8 ) | g ); - WriteData( b ); break; case RGB18: b = ( color << 2 ) & 0xFC; g = ( color >> 4 ) & 0xFC; r = ( color >> 10 ) & 0xFC; - WriteData( ( r << 8 ) | g ); - WriteData( b ); break; case RGB24: r = ( color >> 16 ) & 0xFC; g = ( color >> 8 ) & 0xFC; b = color & 0xFC; - WriteData( ( r << 8 ) | g ); - WriteData( b ); break; } + clr = ( r << 8 ) | ( g << 2 ) | ( b >> 4 ); + WriteData( clr ); + WriteData( b << 4 ); } }