AD-128160-UART制御用のライブラリ http://www.aitendo.co.jp/product/3119 gingaxさんのプログラムを参考に作らせてもらっています。 http://mbed.org/users/akira/libraries/AD128160/m159hi
Dependents: AD128160_HelloWorld
Diff: AD128160.cpp
- Revision:
- 2:6f2db745808e
- Parent:
- 0:2e2f3b389d8a
- Child:
- 3:d15cda2a5e91
--- a/AD128160.cpp Mon Dec 12 02:12:24 2011 +0000 +++ b/AD128160.cpp Mon Dec 12 02:38:49 2011 +0000 @@ -2,7 +2,7 @@ AD128160::AD128160(PinName tx,PinName reset):_device(tx,NC),_rst(reset) { - init(); + init(); } int AD128160::_putc(int c) { @@ -55,25 +55,25 @@ color(0xffff); } -void AD128160::brightness(int value){ +void AD128160::brightness(int value) { unsigned char sum=0; unsigned char byte[2]; byte[0] = (value & 0xff00)>>8; byte[1] = value & 0x00ff; - + sum+=byte[0]+byte[1]+0x89; - + _device.putc(0x55);//Back light On _device.putc(0x03); - _device.putc(0x89); + _device.putc(0x89); _device.putc(byte[0]); _device.putc(byte[1]); _device.putc(sum); _device.putc(0xAA); } -void AD128160::reset(){ +void AD128160::reset() { _rst = 0; //Reset wait(0.1); _rst = 1; @@ -83,7 +83,7 @@ void AD128160::speed(int baud) { unsigned char sum=0; - + unsigned char byte[4]; byte[0] = (baud&0xff000000)>>24; byte[1] = (baud&0x00ff0000)>>16; @@ -99,12 +99,28 @@ _device.putc(byte[1]); _device.putc(byte[2]); _device.putc(byte[3]); - + _device.putc(sum); _device.putc(0xAA); wait(0.1); _device.baud(baud); - + +} + +int AD128160::width(){ + return LCD_WIDTH; +} + +int AD128160::height(){ + return LCD_HEIGHT; +} + +int AD128160::columns(){ + return LCD_COLS; +} + +int AD128160::rows(){ + return LCD_ROWS; } void AD128160::bmp(int x0,int y0,int bmp_no) { @@ -143,7 +159,7 @@ _device.putc(0x55); _device.putc(0xD5); _device.putc(0xAA); - + locate(0,0); } @@ -180,24 +196,6 @@ _device.putc(0xAA); } - -void AD128160::color2(int c1,int c2) { - //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); -} - void AD128160::backgroudColor(int rgb) { int c1; int c2; @@ -237,7 +235,7 @@ void AD128160::newline(void) { _column = 0; _row++; - + if (_row >= LCD_ROWS) { _row = 0; }