Demo code and library for teh SSD0139 screen on an arduino header For Oxford University Engineering Coursework Module
Dependencies: LCDTFT_ssd0139 mbed
Revision 1:e783e326d127, committed 2016-06-06
- Comitter:
- cstevens
- Date:
- Mon Jun 06 13:40:16 2016 +0000
- Parent:
- 0:92feefa9d5ba
- Commit message:
- library and demo code for tft ssd0139 controller on a 240x320 screen
Changed in this revision
LCDTFT.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 92feefa9d5ba -r e783e326d127 LCDTFT.lib --- a/LCDTFT.lib Tue Sep 02 09:02:37 2014 +0000 +++ b/LCDTFT.lib Mon Jun 06 13:40:16 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/Suky/code/LCDTFT/#ebedda77b33b +http://mbed.org/users/cstevens/code/LCDTFT_ssd0139/#f999653c1069
diff -r 92feefa9d5ba -r e783e326d127 main.cpp --- a/main.cpp Tue Sep 02 09:02:37 2014 +0000 +++ b/main.cpp Mon Jun 06 13:40:16 2016 +0000 @@ -1,8 +1,8 @@ #include "mbed.h" #include "LCDTFT.h" - //BusOut MyBus(p13,p14,p15,p16,p17,p18,p19,p20,p30,p29,p28,p27,p26,p25,p24,p23); - BusOut MyBus(PTA13,PTD5,PTD4,PTA12,PTA4,PTA5,PTC8,PTC9); + + BusOut MyBus(PTA13,PTD5,PTD4,PTA12,PTA4,PTA5,PTC8,PTC9); // 8 bit bus on these dvices LCDTFT MyLCD(PTB0,PTB1,PTB2,PTB3,PTC2,&MyBus);//LCDTFT(PinName PIN_RD,PinName PIN_WR,PinName PIN_RS,PinName PIN_CS,PinName PIN_RESET, BusOut *BUSLCD); int main(){ @@ -10,6 +10,40 @@ //landscape ? MyLCD.vLCDTFTInit(1); + MyLCD.vLCDTFTFillScreen(ColorWhite); + MyLCD.vLCDTFTSetParametersPrintf(3,3,3,300,2,ColorBlue,ColorWhite); + MyLCD.printf("Dive Profile"); + MyLCD.vLCDTFTRectangle(30,40,315,200,0,ColorBlack); +int a=0; + int depth=0; + short int x,y; + //dummy profile + for(a=1;a<279;a++){ + depth=40+5.5*16*sin(a*a*3.14/280/280); + MyLCD.vLCDTFTLine(a+30,depth,a+30,41,ColorCian); + MyLCD.vLCDTFTPoint(a+30,depth,ColorBlue); + } + //tics + for(a=0;a<10;a++) + { if(a>0) + { + MyLCD.vLCDTFTLine(40,40+a*16,315,40+a*16,ColorNavy); + MyLCD.vLCDTFTLine(30+a*28,50,30+a*28,200,ColorNavy); + } + MyLCD.vLCDTFTLine(30,40+a*16,40,40+a*16,ColorBlack); + MyLCD.vLCDTFTLine(30+a*28,40,30+a*28,50,ColorBlack); + + MyLCD.vLCDTFTSetParametersPrintf(3,40+a*16-3,3,28,1,ColorRed,ColorWhite); + MyLCD.printf("%d",a*5); + MyLCD.vLCDTFTSetParametersPrintf(30+a*28-3,30,30+a*28-3,319,1,ColorRed,ColorWhite); + MyLCD.printf("%d",a*5); + } + a=200; + x=a+30; + y=40+5.5*16*sin(a*a*3.14/280/280); + MyLCD.vLCDTFTCircle(200,y-6,6,1,ColorNaranja); + + wait(10); @@ -28,11 +62,12 @@ wait(1); MyLCD.vLCDTFTFillScreen(ColorWhite); wait(2); - short int x,y; + y=250; for(x=0;x<240;x++){ MyLCD.vLCDTFTPoint(x,y,ColorGreen); wait_ms(1); + MyLCD.vLCDTFTLine(x,160,x,250,x*80); } //endfor // red square @@ -77,7 +112,7 @@ MyLCD.vLCDTFTSetParametersPrintf(30,200,30,233,2,ColorRed,ColorBlack); MyLCD.printf("Countdown\n"); - int a=0; + for(a=10;a>0;a--){ MyLCD.vLCDTFTSetParametersPrintf(30,260,30,233,2,ColorRed,ColorBlack); MyLCD.printf("%d ",a); @@ -105,9 +140,5 @@ MyLCD.printf("fO2 %%:\n 27.3\n 26.5\n 27.1"); wait(5); -for(a=0;a<320;a++){ - MyLCD.vLCDTFTPoint(a,180,ColorBlue); - } - }// endwhile } //endmain \ No newline at end of file