Packed 12bit Raw image file load to display to Nokia LCD. Add function "blit12" to Nokia LCD for native 12bit color buffer.

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
sakai
Date:
Thu Feb 10 14:44:49 2011 +0000
Parent:
3:8739f7e5148a
Commit message:

Changed in this revision

NokiaLCD.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/NokiaLCD.cpp	Thu Feb 10 14:29:29 2011 +0000
+++ b/NokiaLCD.cpp	Thu Feb 10 14:44:49 2011 +0000
@@ -339,7 +339,7 @@
 
 void NokiaLCD::blit12(int x, int y, int width, int height, const unsigned char* colour12) {
     _cs = 0;
-    _window(x, y, width, height);
+    _window(x, y, width, height+2); // The reason is not understood.
 
     switch (_type) {
         case LCD6100:
@@ -349,7 +349,7 @@
              }
              break;
         case LCD6610:
-            for (int i=0; i<width*height*3/2; i++) { 
+            for (int i=0; i<width*height/2*3; i++) { 
                 data(colour12[i]); 
             }
             break;
--- a/main.cpp	Thu Feb 10 14:29:29 2011 +0000
+++ b/main.cpp	Thu Feb 10 14:44:49 2011 +0000
@@ -1,23 +1,23 @@
-#include "mbed.h"
-#include "NokiaLCD.h"
-#include "SDFileSystem.h"
-
-NokiaLCD lcd(p11, p13, p14, p15, NokiaLCD::LCD6610); // mosi, sclk, cs, rst, type
-SDFileSystem sd(p5, p6, p7, p8, "sd");
-
-int main() {
-    lcd.background(0x000000);
-    lcd.cls();
-    FILE *fp = NULL;
-    fp = fopen("/sd/128x128.r12", "r");
-    if (fp != NULL) {
-        printf("Start!\r\n");
-        unsigned char bufLine[64 * 3 * 128];
-        fread(bufLine, sizeof(unsigned char), (64 * 3 * 128), fp);
-        lcd.blit12(0, 0, 128, 128, bufLine);
-        fclose(fp);
-        printf("Finish!\r\n");
-    } else {
-        printf("Can't open file.\r\n");
-    }
-}
+#include "mbed.h"
+#include "NokiaLCD.h"
+#include "SDFileSystem.h"
+
+NokiaLCD lcd(p11, p13, p14, p15, NokiaLCD::LCD6610); // mosi, sclk, cs, rst, type
+SDFileSystem sd(p5, p6, p7, p8, "sd");
+
+int main() {
+    lcd.background(0x000000);
+    lcd.cls();
+    FILE *fp = NULL;
+    fp = fopen("/sd/128x128.r12", "r");
+    if (fp != NULL) {
+        printf("Start!\r\n");
+        unsigned char bufLine[64 * 3 * 128];
+        fread(bufLine, sizeof(unsigned char), (64 * 3 * 128), fp);
+        lcd.blit12(0, 0, 128, 128, bufLine);
+        fclose(fp);
+        printf("Finish!\r\n");
+    } else {
+        printf("Can't open file.\r\n");
+    }
+}