Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of TFTLCD by
Diff: ssd1289.cpp
- Revision:
- 12:d0978272a340
- Parent:
- 10:69571adcfad5
- Child:
- 15:af3cd35886fb
--- a/ssd1289.cpp	Tue Dec 11 16:50:09 2012 +0000
+++ b/ssd1289.cpp	Tue Dec 11 18:11:14 2012 +0000
@@ -32,9 +32,10 @@
     else _lcd_pin_rd = 0;
 }
 
-void SSD1289_LCD::Initialize( orientation_t orientation )
+void SSD1289_LCD::Initialize( orientation_t orientation, colordepth_t colors )
 {
     _orientation = orientation;
+    _colorDepth = RGB16;
     
     _lcd_pin_reset = HIGH;
     wait_ms( 5 );
@@ -142,7 +143,12 @@
     WriteCmd( 0x22 );
 }
 
-void SSD1289_LCD::SetPixelColor( unsigned short color )
+void SSD1289_LCD::SetPixelColor( unsigned int color )
 {
-    WriteData( color );
+    unsigned char r, g, b;
+    r = ( color >> 16 ) & 0xFF;
+    g = ( color >> 8 ) & 0xFF;
+    b = color & 0xFF;
+    unsigned short clr = ( ( ( ( r ) & 0xF8 ) | ( ( g ) >> 5 ) ) << 8 ) | ( ( ( ( g ) & 0x1C ) << 3 ) | ( ( b ) >> 3 ) );
+    WriteData( clr );
 }
    