AD-128160-UARTでmbedのFlashに置いた128x128の16bit bitmap画像を表示してみたプログラムです。 === image === {{http://farm8.staticflickr.com/7008/6497076427_b531626b5b.jpg}} === circuit === {{http://farm8.staticflickr.com/7164/6498120233_a004e4fe29.jpg}}
Revision 0:0dcf639e09e9, committed 2011-12-12
- Comitter:
- nucho
- Date:
- Mon Dec 12 04:08:09 2011 +0000
- Commit message:
Changed in this revision
diff -r 000000000000 -r 0dcf639e09e9 AD128160.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AD128160.lib Mon Dec 12 04:08:09 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/nucho/code/AD128160/#d15cda2a5e91
diff -r 000000000000 -r 0dcf639e09e9 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Dec 12 04:08:09 2011 +0000 @@ -0,0 +1,48 @@ +#include "mbed.h" +#include "AD128160.h" + +#define DATA_SIZE 128*128 + +LocalFileSystem local("local"); +AD128160 lcd(p9,p20); + +int rgb565(int r, int g,int b) +{ + int rgb; + + rgb = (r & 0xF8) << 8; /* RRRRR----------- */ + rgb |= (g & 0xFC) << 3; /* -----GGGGGG----- */ + rgb |= b >> 3; /* -----------BBBBB */ + + return rgb; +} + +int main() { + FILE *fpi; + int i; + unsigned char idat; + unsigned char dat,dat2; + //lcd.speed(115200); + //lcd.speed(230400); + lcd.speed(460800); + + if ((fpi=fopen("/local/sample.bmp", "rb")) == NULL) { + fprintf(stderr, "input file open error\n"); + exit(1); + } + + for (i=0;i<0x46;i++)//bitmap headder throw + fread(&idat, sizeof(unsigned char), 1, fpi); + + for(int i=0;i<128;i++){ + for(int j=0;j<128;j++){ + fread(&dat, sizeof(unsigned char), 1, fpi); + fread(&dat2, sizeof(unsigned char), 1, fpi); + + int rgb=dat | dat2<<8; + lcd.color(rgb); + lcd.pixel(i,j); + } + } + +}
diff -r 000000000000 -r 0dcf639e09e9 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Dec 12 04:08:09 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/078e4b97a13e