KSM edits to RA8875

Dependents:   Liz_Test_Code

Revision:
93:6fbc516de05e
Parent:
92:ce1ab76e8614
Child:
94:203729061e48
--- a/RA8875.cpp	Sun Feb 01 17:07:13 2015 +0000
+++ b/RA8875.cpp	Sun Feb 01 18:50:57 2015 +0000
@@ -1051,18 +1051,19 @@
     color_t pixel;
     RetCode_t ret = noerror;
 
-    INFO("getPixelStream(%p, %u, %d, %d)", p, count, x, y);
+    //INFO("getPixelStream(%p, %u, %d, %d)", p, count, x, y);
     PERFORMANCE_RESET;
     //WriteCommand(0x45,0x00);    // read left->right, top->bottom
     ret = WriteCommand(0x40,0x00);    // Graphics write mode
-    INFO("  r = %d", ret);
+    //INFO("  r = %d", ret);
     ret = SetGraphicsCursorRead(x, y);
-    INFO("  r = %d", ret);
+    //INFO("  r = %d", ret);
     ret = WriteCommand(0x02);
-    INFO("  r = %d", ret);
+    //INFO("  r = %d", ret);
     _select(true);
     _spiwrite(0x40);         // Cmd: read data
     _spiwrite(0x00);         // dummy read
+    _spiwrite(0x00);         // dummy read  [20150201: Required to properly align the data stream. Not yet sure why...]
     while (count--) {
         pixel  = _spiread();
         pixel |= (_spiread() << 8);
@@ -1666,10 +1667,10 @@
         }
 
         // Be optimistic - don't check for errors.
-        //HexDump("BMP_Header", (uint8_t *)&BMP_Header, sizeof(BMP_Header));
+        HexDump("BMP_Header", (uint8_t *)&BMP_Header, sizeof(BMP_Header));
         size_t r = fwrite(&BMP_Header, sizeof(char), sizeof(BMP_Header), Image);
 
-        //HexDump("BMP_Info", (uint8_t *)&BMP_Info, sizeof(BMP_Info));
+        HexDump("BMP_Info", (uint8_t *)&BMP_Info, sizeof(BMP_Info));
         r = fwrite(&BMP_Info, sizeof(char), sizeof(BMP_Info), Image);
 
         color_t transparency = GetBackgroundTransparencyColor();
@@ -1703,6 +1704,8 @@
                     ERR("getPixelStream error, and no recovery handler...");
                 }
             }
+            INFO("1st Color: %04X", pixelBuffer[0]);
+            HexDump("Raster", (uint8_t *)pixelBuffer, w);
             // Convert the local buffer to RGBQUAD format
             int lb = 0;
             for (int i=0; i<w; i++) {