this is kazushi's branch of AD128160
Fork of AD128160 by
Revision 3:f5576943e216, committed 2011-10-08
- Comitter:
- akira
- Date:
- Sat Oct 08 23:51:33 2011 +0000
- Parent:
- 2:5d8d5291b4cd
- Child:
- 4:1f72df1a88e0
- Commit message:
Changed in this revision
s_Lcd.cpp | Show annotated file Show diff for this revision Revisions of this file |
s_Lcd.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/s_Lcd.cpp Sat Oct 08 08:19:31 2011 +0000 +++ b/s_Lcd.cpp Sat Oct 08 23:51:33 2011 +0000 @@ -25,40 +25,37 @@ device.putc(0x55); device.putc(0xD5); device.putc(0xAA); + wait(0.1); } -void lcdprint( char data[98],int x,int y) +void s_Lcdinit() { - unsigned char s; - unsigned char x0H; - unsigned char x0L; - unsigned char y0H; - unsigned char y0L; - unsigned char datalen; - x0H = x >> 8; - x0L = x & 0xFF; - y0H = y >> 8; - y0L = y & 0xFF; - datalen = strlen(data)+5; + device.baud(9600); + rst = 0; //Reset + wait(0.1); + rst = 1; + wait(0.1); + device.putc(0x55);//Back light On + device.putc(0x03); + device.putc(0x89); + device.putc(0x01); + device.putc(0x2C); + device.putc(0xB6); + device.putc(0xAA); + wait(0.1); + device.putc(0x55);// Clear + device.putc(0x02); + device.putc(0x80); device.putc(0x55); - device.putc(datalen); - device.putc(0x0B); // command ASCII Print - device.putc(x0H); //x upper 8bit - device.putc(x0L); //x low 8bit - device.putc(y0H); //y upper 8bit - device.putc(y0L); //y low 8bit - for(int a=0;a<strlen(data);a++) - { - device.putc(data[a]); - s = s+data[a]; -// pc.printf("%x:",data[a]); - } - s = s+x0H+x0L+y0H+y0L+0x0B; - device.putc(s);//sumcheck + device.putc(0xD5); device.putc(0xAA); -// pc.printf("print %x %x %x %x %x %d ",x0H,x0L,y0H,y0L,s,datalen); + wait(0.1); + lcdspeed(); + wait(0.1); + device.baud(115200); } + void color(int rgb) { int c1; @@ -225,7 +222,8 @@ device.putc(sum); device.putc(0xAA); } -void lcdput(unsigned char data,int x,int y) + +void lcdprint(char data[98],int x,int y) { unsigned char s; unsigned char x0H; @@ -237,7 +235,7 @@ x0L = x & 0xFF; y0H = y >> 8; y0L = y & 0xFF; - datalen = 6; + datalen = strlen(data)+5; device.putc(0x55); device.putc(datalen); device.putc(0x0B); // command ASCII Print @@ -245,33 +243,14 @@ device.putc(x0L); //x low 8bit device.putc(y0H); //y upper 8bit device.putc(y0L); //y low 8bit - device.putc(data); - s = data+x0H+x0L+y0H+y0L+0x0B; + for(int a=0;a<strlen(data);a++) + { + device.putc(data[a]); + s = s+data[a]; +// pc.printf("%x:",data[a]); + } + s = s+x0H+x0L+y0H+y0L+0x0B; device.putc(s);//sumcheck device.putc(0xAA); // pc.printf("print %x %x %x %x %x %d ",x0H,x0L,y0H,y0L,s,datalen); } - - -void s_Lcdinit() - { - device.baud(9600); - rst = 0; //Reset - wait(0.1); - rst = 1; - wait(0.5); - lcdspeed(); - wait(0.1); - device.baud(115200); - device.putc(0x55);//Back light On - device.putc(0x03); - device.putc(0x89); - device.putc(0x01); - device.putc(0x2C); - device.putc(0xB6); - device.putc(0xAA); - wait(0.1); - cls(); - - } -
--- a/s_Lcd.h Sat Oct 08 08:19:31 2011 +0000 +++ b/s_Lcd.h Sat Oct 08 23:51:33 2011 +0000 @@ -9,7 +9,6 @@ void line(int x0,int y0,int x1,int y1); void circle(int x0,int y0,int r,int paint); void lcdprint(char data[98],int x0,int y0); -void lcdput(unsigned char data,int x0,int y0); void lcdspeed(); void cls(); #endif