this is kazushi's branch of AD128160
Fork of AD128160 by
Revision 1:188eab573f3b, committed 2011-10-02
- Comitter:
- akira
- Date:
- Sun Oct 02 15:03:19 2011 +0000
- Parent:
- 0:6fc03008c3fd
- Child:
- 2:5d8d5291b4cd
- Commit message:
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Oct 02 15:03:19 2011 +0000 @@ -0,0 +1,51 @@ +// Graphic commands : GingaX +// Website http://www31.atwiki.jp/gingax/ +// Twitter @gingaxx +// +// s_Lcdinit(); LCD Initialization +// cls(); Fill the screen with background color +// pixel(x,y); set a single pixel at x,y +// line(x0,y0,x1,y1); draw a line from x0,y0 to x1,y1 +// box(x0,y0,x1,y1,paint); draw a square from x0,y0 to x1,y1 ,Paint =1 +// circle( x0,y0,r ,paint); draw a circle around x0,y0 with radius,Paint =1 +// lcdprint(char data[98],int x,int y) + +#include "mbed.h" +#include "s_Lcd.h" + +DigitalOut myled1(LED1); +DigitalOut myled4(LED4); + + +int main() { + + s_Lcdinit(); + + while(1) + { + color(0xffff); + pixel(110,110); + for(int a=0;a<10;a++) + { + lcdprint("GingaX *****",10,a*16); + } + color(0xf800); + box(100,100,120,120,0); + for(int a=0;a<0xffff;a=a+128) + { + color(a); + box(10,10,100,100,1); + color(a*100); + circle(50,50,40,1); + color(a*4); + circle(70,70,50,0); + for(int x=0;x<129;x=x+10) + { + line(0,0,x,129); + line(0,0,129,x); + } + //wait(0.1); + } + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Oct 02 15:03:19 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912
--- a/s_Lcd.cpp Sun Oct 02 15:02:29 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,245 +0,0 @@ -#include "mbed.h" - -Serial device(p9, p10); // tx, rx -//Serial pc(USBTX, USBRX); // tx, rx -DigitalOut rst(p20); //P20 --> LCD RST (Reset) - -void lcdspeed() - { - device.putc(0x55);// UART Speed 115200bps - device.putc(0x05); - device.putc(0x8B); - device.putc(0x00); - device.putc(0x01); - device.putc(0xC2); - device.putc(0x00); - device.putc(0x4E); - device.putc(0xAA); - } - -void s_Lcdinit() - { - 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(0xD5); - device.putc(0xAA); - wait(0.1); - lcdspeed(); - wait(0.1); - device.baud(115200); - } - - -void color(int rgb) - { - int c1; - int c2; - int sum; - - c1=(rgb >> 8) & 0xff; - c2=(rgb & 0xff); - sum=c1+c2+0x84; - device.putc(0x55); - device.putc(0x03); - device.putc(0x84); - device.putc(c1); - device.putc(c2); - device.putc(sum); - device.putc(0xAA); - //pc.printf("color %x %x %x ",c1,c2,sum); - } - -void pixel(int x0,int y0) - { - unsigned char x0H; - unsigned char x0L; - unsigned char y0H; - unsigned char y0L; - unsigned char sum; - - x0H = x0 >> 8; - x0L = x0 & 0xFF; - y0H = y0 >> 8; - y0L = y0 & 0xff; - - sum = x0H+x0L+y0H+y0L+0x01; - device.putc(0x55); - device.putc(0x05); - device.putc(0x01);//command - device.putc(x0H); - device.putc(x0L); - device.putc(y0H); - device.putc(y0L); - device.putc(sum); - device.putc(0xAA); - } - -void box(int x0,int y0,int x1,int y1,int paint) - { - unsigned char x0H; - unsigned char x0L; - unsigned char x1H; - unsigned char x1L; - unsigned char y0H; - unsigned char y0L; - unsigned char y1H; - unsigned char y1L; - unsigned char sum; - unsigned char cmd; - switch (paint) - { - case 1: - cmd = 0x04; - break; - default: - cmd =0x03; - break; - } - x0H = x0 >> 8; - x0L = x0 & 0xFF; - y0H = y0 >> 8; - y0L = y0 & 0xff; - x1H = x1 >> 8; - x1L = x1 & 0xFF; - y1H = y1 >> 8; - y1L = y1 & 0xff; - sum = x0H+x0L+y0H+y0L+x1H+x1L+y1H+y1L+cmd; - device.putc(0x55);//Box - device.putc(0x09); - device.putc(cmd);//command - device.putc(x0H); - device.putc(x0L); - device.putc(y0H); - device.putc(y0L); - device.putc(x1H); - device.putc(x1L); - device.putc(y1H); - device.putc(y1L); - device.putc(sum); - device.putc(0xAA); - } - -void circle(int x0,int y0,int r,int paint) - { - unsigned char x0H; - unsigned char x0L; - unsigned char y0H; - unsigned char y0L; - unsigned char rH; - unsigned char rL; - unsigned char sum; - unsigned char cmd; - switch (paint) - { - case 0: - cmd = 0x05; - break; - case 1: - cmd = 0x06; - break; - default: - cmd =0x05; - break; - } - x0H = x0 >> 8; - x0L = x0 & 0xFF; - y0H = y0 >> 8; - y0L = y0 & 0xff; - rH = r >> 8; - rL = r & 0xFF; - sum = x0H+x0L+y0H+y0L+rH+rL+cmd; - device.putc(0x55); - device.putc(0x07); - device.putc(cmd);//command - device.putc(x0H); - device.putc(x0L); - device.putc(y0H); - device.putc(y0L); - device.putc(rH); - device.putc(rL); - device.putc(sum); - device.putc(0xAA); - } - -void line(int x0,int y0,int x1,int y1) - { - unsigned char x0H; - unsigned char x0L; - unsigned char x1H; - unsigned char x1L; - unsigned char y0H; - unsigned char y0L; - unsigned char y1H; - unsigned char y1L; - unsigned char sum; - - x0H = x0 >> 8; - x0L = x0 & 0xFF; - y0H = y0 >> 8; - y0L = y0 & 0xff; - x1H = x1 >> 8; - x1L = x1 & 0xFF; - y1H = y1 >> 8; - y1L = y1 & 0xff; - sum = x0H+x0L+y0H+y0L+x1H+x1L+y1H+y1L+02; - device.putc(0x55); - device.putc(0x09); - device.putc(0x02);//command - device.putc(x0H); - device.putc(x0L); - device.putc(y0H); - device.putc(y0L); - device.putc(x1H); - device.putc(x1L); - device.putc(y1H); - device.putc(y1L); - device.putc(sum); - device.putc(0xAA); - } - -void lcdprint(char data[98],int x,int y) - { - 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.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(0xAA); -// pc.printf("print %x %x %x %x %x %d ",x0H,x0L,y0H,y0L,s,datalen); - }
--- a/s_Lcd.h Sun Oct 02 15:02:29 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -#ifndef s_Lcd_H_ -#define a_Lcd_H_ - - -void s_Lcdinit(); -void color(int rgb); -void pixel(int x0,int y0); -void box(int x0,int y0,int x1,int y1,int paint); -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 lcdspeed(); -#endif