4D LABS PICASO-SGC Command Set
Revision 2:cf251e70769f, committed 2012-07-29
- Comitter:
- jppfavonian
- Date:
- Sun Jul 29 21:28:57 2012 +0000
- Parent:
- 1:6caecd9e09a8
- Commit message:
- Next level, still not working correctly
Changed in this revision
LCD43PCT.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 6caecd9e09a8 -r cf251e70769f LCD43PCT.cpp --- a/LCD43PCT.cpp Fri Jul 27 14:17:01 2012 +0000 +++ b/LCD43PCT.cpp Sun Jul 29 21:28:57 2012 +0000 @@ -1,5 +1,6 @@ #include "mbed.h" +#include "Gen.h" #include <LCD43PCT.h> // 4D Systems uLCD-43PTC DEFAULT BAUD RATE: 9600bps @@ -16,13 +17,12 @@ void LCD43PCT::reset(){ //Reset the LCD43PCT board _resetPin=0; //set the pin to GND to reset - wait_ms(500); + wait_ms(1); _resetPin=1; //set the pin to 3.3v to end reset - wait_ms(500); + wait_ms(1000); } unsigned char LCD43PCT::start(){ //Init the LCD43PCT - wait_ms(500); _serialLCD43PCT.putc('U'); wait_ms(1000); return _serialLCD43PCT.getc() - '\x06'; @@ -243,19 +243,16 @@ _serialLCD43PCT.putc(fill); if (_serialLCD43PCT.getc() - '\x06') return 1; //set pensize command fail - _serialLCD43PCT.putc('F'); - _serialLCD43PCT.putc(font); - if (_serialLCD43PCT.getc() - '\x06') return 1; //set font size command fail - _serialLCD43PCT.putc('S'); _serialLCD43PCT.putc(x1>>8); _serialLCD43PCT.putc(x1); _serialLCD43PCT.putc(y1>>8); _serialLCD43PCT.putc(y1); + _serialLCD43PCT.putc(font); + _serialLCD43PCT.putc(colour>>8); + _serialLCD43PCT.putc(colour); _serialLCD43PCT.putc(1); //x size _serialLCD43PCT.putc(1); //y size - _serialLCD43PCT.putc(colour>>8); - _serialLCD43PCT.putc(colour); while(1){ _serialLCD43PCT.putc(text[counter]); if(text[counter]==0x00){ @@ -342,15 +339,33 @@ unsigned char LCD43PCT::touchScreen(int buffer[]){ //Ask for a touch on the screen, if return=1, touch coordinates are stored on the buffer[] - _serialLCD43PCT.putc('G'); + _serialLCD43PCT.putc('Y'); // display control function + _serialLCD43PCT.putc('\x05'); // enable Touch + _serialLCD43PCT.putc('\x00'); +// sr.printf("touch "); + buffer[0]=_serialLCD43PCT.getc(); +// sr.printf("%02X ",buffer[0]); + + + _serialLCD43PCT.putc('o'); + _serialLCD43PCT.putc('\x04'); buffer[0]=_serialLCD43PCT.getc(); buffer[0]=buffer[0]<<8; buffer[0]|=_serialLCD43PCT.getc(); buffer[1]=_serialLCD43PCT.getc(); buffer[1]=buffer[1]<<8; buffer[1]|=_serialLCD43PCT.getc(); - _serialLCD43PCT.getc(); - if(buffer[0]<0x0200){ + if(buffer[0] != 0){ + sr.printf("%04X ",int(buffer[1])); + _serialLCD43PCT.putc('o'); + _serialLCD43PCT.putc('\x05'); + buffer[0]=_serialLCD43PCT.getc(); + buffer[0]=buffer[0]<<8; + buffer[0]|=_serialLCD43PCT.getc(); + buffer[1]=_serialLCD43PCT.getc(); + buffer[1]=buffer[1]<<8; + buffer[1]|=_serialLCD43PCT.getc(); + sr.printf("%04X %04X ",int(buffer[1]),int(buffer[3])); return 1; }else{ return 0;