Packed 12bit Raw image file load to display to Nokia LCD. Add function "blit12" to Nokia LCD for native 12bit color buffer.
Diff: main.cpp
- Revision:
- 0:b9050fc6f305
- Child:
- 1:ea521c134e8a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Feb 09 21:11:28 2011 +0000 @@ -0,0 +1,32 @@ +#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.raw", "r"); + if (fp != NULL) { + printf("Start!\r\n"); + unsigned char buf[4]; + for (int y = 0; y < 128; y++) { + for (int x = 0; x < 128; x++) { + fread(buf, sizeof(unsigned char), 3, fp); + int pix = buf[0]; + pix <<= 8; + pix += buf[1]; + pix <<= 8; + pix += buf[2]; + lcd.pixel(x, y, pix); + } + } + fclose(fp); + printf("Finish!\r\n"); + } else { + printf("Can't open file.\r\n"); + } +}