Demo code and library for teh SSD0139 screen on an arduino header For Oxford University Engineering Coursework Module
Dependencies: LCDTFT_ssd0139 mbed
main.cpp@0:92feefa9d5ba, 2014-09-02 (annotated)
- Committer:
- cstevens
- Date:
- Tue Sep 02 09:02:37 2014 +0000
- Revision:
- 0:92feefa9d5ba
- Child:
- 1:e783e326d127
temporay demo for ssd0139 driver
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
cstevens | 0:92feefa9d5ba | 1 | #include "mbed.h" |
cstevens | 0:92feefa9d5ba | 2 | #include "LCDTFT.h" |
cstevens | 0:92feefa9d5ba | 3 | |
cstevens | 0:92feefa9d5ba | 4 | //BusOut MyBus(p13,p14,p15,p16,p17,p18,p19,p20,p30,p29,p28,p27,p26,p25,p24,p23); |
cstevens | 0:92feefa9d5ba | 5 | BusOut MyBus(PTA13,PTD5,PTD4,PTA12,PTA4,PTA5,PTC8,PTC9); |
cstevens | 0:92feefa9d5ba | 6 | 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); |
cstevens | 0:92feefa9d5ba | 7 | |
cstevens | 0:92feefa9d5ba | 8 | int main(){ |
cstevens | 0:92feefa9d5ba | 9 | while(1){ |
cstevens | 0:92feefa9d5ba | 10 | //landscape ? |
cstevens | 0:92feefa9d5ba | 11 | MyLCD.vLCDTFTInit(1); |
cstevens | 0:92feefa9d5ba | 12 | |
cstevens | 0:92feefa9d5ba | 13 | |
cstevens | 0:92feefa9d5ba | 14 | |
cstevens | 0:92feefa9d5ba | 15 | |
cstevens | 0:92feefa9d5ba | 16 | MyLCD.vLCDTFTFillScreen(ColorBlack); |
cstevens | 0:92feefa9d5ba | 17 | MyLCD.vLCDTFTRectangle(3,3,319,157,0,ColorWhite); |
cstevens | 0:92feefa9d5ba | 18 | |
cstevens | 0:92feefa9d5ba | 19 | wait(1); |
cstevens | 0:92feefa9d5ba | 20 | MyLCD.vLCDTFTSetParametersPrintf(8,8,8,155,3,ColorLime,ColorBlack); |
cstevens | 0:92feefa9d5ba | 21 | MyLCD.printf("PPO2:\n 1.21\n 1.18\n 1.20"); |
cstevens | 0:92feefa9d5ba | 22 | MyLCD.vLCDTFTSetParametersPrintf(110,8,110,233,3,ColorCian,ColorBlack); |
cstevens | 0:92feefa9d5ba | 23 | MyLCD.printf("fO2 %%:\n 27.3\n 26.5\n 27.1"); |
cstevens | 0:92feefa9d5ba | 24 | wait(5); |
cstevens | 0:92feefa9d5ba | 25 | |
cstevens | 0:92feefa9d5ba | 26 | //portrait |
cstevens | 0:92feefa9d5ba | 27 | MyLCD.vLCDTFTInit(0); |
cstevens | 0:92feefa9d5ba | 28 | wait(1); |
cstevens | 0:92feefa9d5ba | 29 | MyLCD.vLCDTFTFillScreen(ColorWhite); |
cstevens | 0:92feefa9d5ba | 30 | wait(2); |
cstevens | 0:92feefa9d5ba | 31 | short int x,y; |
cstevens | 0:92feefa9d5ba | 32 | y=250; |
cstevens | 0:92feefa9d5ba | 33 | for(x=0;x<240;x++){ |
cstevens | 0:92feefa9d5ba | 34 | MyLCD.vLCDTFTPoint(x,y,ColorGreen); |
cstevens | 0:92feefa9d5ba | 35 | wait_ms(1); |
cstevens | 0:92feefa9d5ba | 36 | } //endfor |
cstevens | 0:92feefa9d5ba | 37 | |
cstevens | 0:92feefa9d5ba | 38 | // red square |
cstevens | 0:92feefa9d5ba | 39 | for(x=100;x<140;x++){ |
cstevens | 0:92feefa9d5ba | 40 | for(y=100;y<140;y++){ |
cstevens | 0:92feefa9d5ba | 41 | MyLCD.vLCDTFTPoint(x,y,ColorRed); |
cstevens | 0:92feefa9d5ba | 42 | |
cstevens | 0:92feefa9d5ba | 43 | }//endfor |
cstevens | 0:92feefa9d5ba | 44 | |
cstevens | 0:92feefa9d5ba | 45 | |
cstevens | 0:92feefa9d5ba | 46 | } // endfor |
cstevens | 0:92feefa9d5ba | 47 | x=40; |
cstevens | 0:92feefa9d5ba | 48 | for(y=0;y<320;y++){ |
cstevens | 0:92feefa9d5ba | 49 | MyLCD.vLCDTFTPoint(x,y,ColorBlue); |
cstevens | 0:92feefa9d5ba | 50 | wait_ms(1); |
cstevens | 0:92feefa9d5ba | 51 | } //endfor |
cstevens | 0:92feefa9d5ba | 52 | y=40; |
cstevens | 0:92feefa9d5ba | 53 | for(x=0;x<240;x++){ |
cstevens | 0:92feefa9d5ba | 54 | MyLCD.vLCDTFTPoint(x,y,ColorBlue); |
cstevens | 0:92feefa9d5ba | 55 | wait_ms(1); |
cstevens | 0:92feefa9d5ba | 56 | } //endfor |
cstevens | 0:92feefa9d5ba | 57 | |
cstevens | 0:92feefa9d5ba | 58 | MyLCD.vLCDTFTLine(0,0,239,319,ColorPurple); |
cstevens | 0:92feefa9d5ba | 59 | |
cstevens | 0:92feefa9d5ba | 60 | wait(1); |
cstevens | 0:92feefa9d5ba | 61 | MyLCD.vLCDTFTRectangle(50,200,150,300,0,ColorNaranja); |
cstevens | 0:92feefa9d5ba | 62 | |
cstevens | 0:92feefa9d5ba | 63 | MyLCD.vLCDTFTRectangle(55,205,145,295,1,ColorYellow); |
cstevens | 0:92feefa9d5ba | 64 | |
cstevens | 0:92feefa9d5ba | 65 | MyLCD.vLCDTFTSetParametersPrintf(5,155,5,239,2,ColorBlue,ColorWhite); |
cstevens | 0:92feefa9d5ba | 66 | MyLCD.printf("Hello mbed!!!"); |
cstevens | 0:92feefa9d5ba | 67 | |
cstevens | 0:92feefa9d5ba | 68 | wait(3); |
cstevens | 0:92feefa9d5ba | 69 | MyLCD.vLCDTFTFillScreen(ColorBlack); |
cstevens | 0:92feefa9d5ba | 70 | MyLCD.vLCDTFTRectangle(3,3,236,157,0,ColorWhite); |
cstevens | 0:92feefa9d5ba | 71 | MyLCD.vLCDTFTRectangle(4,4,235,156,0,ColorWhite); |
cstevens | 0:92feefa9d5ba | 72 | wait(1); |
cstevens | 0:92feefa9d5ba | 73 | MyLCD.vLCDTFTSetParametersPrintf(8,8,8,155,3,ColorLime,ColorBlack); |
cstevens | 0:92feefa9d5ba | 74 | MyLCD.printf("PPO2:\n 1.21\n 1.18\n 1.20"); |
cstevens | 0:92feefa9d5ba | 75 | MyLCD.vLCDTFTSetParametersPrintf(110,8,110,233,3,ColorCian,ColorBlack); |
cstevens | 0:92feefa9d5ba | 76 | MyLCD.printf("fO2 %%:\n 27.3\n 26.5\n 27.1"); |
cstevens | 0:92feefa9d5ba | 77 | |
cstevens | 0:92feefa9d5ba | 78 | MyLCD.vLCDTFTSetParametersPrintf(30,200,30,233,2,ColorRed,ColorBlack); |
cstevens | 0:92feefa9d5ba | 79 | MyLCD.printf("Countdown\n"); |
cstevens | 0:92feefa9d5ba | 80 | int a=0; |
cstevens | 0:92feefa9d5ba | 81 | for(a=10;a>0;a--){ |
cstevens | 0:92feefa9d5ba | 82 | MyLCD.vLCDTFTSetParametersPrintf(30,260,30,233,2,ColorRed,ColorBlack); |
cstevens | 0:92feefa9d5ba | 83 | MyLCD.printf("%d ",a); |
cstevens | 0:92feefa9d5ba | 84 | wait(1); |
cstevens | 0:92feefa9d5ba | 85 | |
cstevens | 0:92feefa9d5ba | 86 | } // endfor |
cstevens | 0:92feefa9d5ba | 87 | |
cstevens | 0:92feefa9d5ba | 88 | |
cstevens | 0:92feefa9d5ba | 89 | |
cstevens | 0:92feefa9d5ba | 90 | |
cstevens | 0:92feefa9d5ba | 91 | |
cstevens | 0:92feefa9d5ba | 92 | //landscape ? |
cstevens | 0:92feefa9d5ba | 93 | MyLCD.vLCDTFTInit(1); |
cstevens | 0:92feefa9d5ba | 94 | |
cstevens | 0:92feefa9d5ba | 95 | MyLCD.vLCDTFTFillScreen(ColorWhite); |
cstevens | 0:92feefa9d5ba | 96 | |
cstevens | 0:92feefa9d5ba | 97 | |
cstevens | 0:92feefa9d5ba | 98 | MyLCD.vLCDTFTFillScreen(ColorWhite); |
cstevens | 0:92feefa9d5ba | 99 | MyLCD.vLCDTFTRectangle(3,3,315,157,0,ColorNavy); |
cstevens | 0:92feefa9d5ba | 100 | |
cstevens | 0:92feefa9d5ba | 101 | wait(1); |
cstevens | 0:92feefa9d5ba | 102 | MyLCD.vLCDTFTSetParametersPrintf(8,8,8,155,3,ColorGreen,ColorWhite); |
cstevens | 0:92feefa9d5ba | 103 | MyLCD.printf("PPO2:\n 1.21\n 1.18\n 1.20"); |
cstevens | 0:92feefa9d5ba | 104 | MyLCD.vLCDTFTSetParametersPrintf(110,8,110,233,3,ColorBlue,ColorWhite); |
cstevens | 0:92feefa9d5ba | 105 | MyLCD.printf("fO2 %%:\n 27.3\n 26.5\n 27.1"); |
cstevens | 0:92feefa9d5ba | 106 | wait(5); |
cstevens | 0:92feefa9d5ba | 107 | |
cstevens | 0:92feefa9d5ba | 108 | for(a=0;a<320;a++){ |
cstevens | 0:92feefa9d5ba | 109 | MyLCD.vLCDTFTPoint(a,180,ColorBlue); |
cstevens | 0:92feefa9d5ba | 110 | } |
cstevens | 0:92feefa9d5ba | 111 | |
cstevens | 0:92feefa9d5ba | 112 | }// endwhile |
cstevens | 0:92feefa9d5ba | 113 | } //endmain |