Forked para SNOCC

Dependencies:   GPS

Dependents:   SNOCC_V1 SNOCC_V2

Fork of RA8875 by SNOCC

Revision:
93:6fbc516de05e
Parent:
79:544eb4964795
Child:
95:ef538bd687c0
diff -r ce1ab76e8614 -r 6fbc516de05e GraphicsDisplay.cpp
--- a/GraphicsDisplay.cpp	Sun Feb 01 17:07:13 2015 +0000
+++ b/GraphicsDisplay.cpp	Sun Feb 01 18:50:57 2015 +0000
@@ -343,15 +343,22 @@
     return c;
 }
 
-/// RRRR RGGG GGGB BBBB
+// RGB16 little endian 
+//      GGGB BBBB RRRR RGGG
+// swap
+//      RRRR RGGG GGGB BBBB
+//                RRRR R
+// extend to BMP Color Palette is BGRx
+//      BBBB BBBB GGGG GGGG RRRR RRRR 0000 0000
 RGBQUAD GraphicsDisplay::RGB16ToRGBQuad(color_t c)
 {
     RGBQUAD q;
     
     memset(&q, 0, sizeof(q));
+    c = (c << 8) | (c >> 8);    // swap
     q.rgbBlue  = ((c & 0x001F) << 3) | (c & 0x07);          /* Blue value */
-    q.rgbGreen = ((c & 0x07E0) >> 3) | ((c >> 7) & 0x03);   /* Green value */
-    q.rgbRed   = ((c & 0xF800) >> 8) | ((c >> 11) & 0x07);  /* Red value */
+    q.rgbGreen = ((c & 0x07E0) >> 3) | ((c >> 9) & 0x03);   /* Green value */
+    q.rgbRed   = ((c & 0xF800) >> 8) | ((c >> 13) & 0x07);  /* Red value */
     q.rgbReserved = 0;
     return q;
 }