ILI9325 based TFT Arduino shield on KL25Z
Dependencies: TFTLCD_8bit mbed
This is for cheap touch screen TFT from Thiha Electronics (http://www.thiha-elec.com/shield.html).
main.cpp@6:f7d4a6a500f3, 2014-12-03 (annotated)
- Committer:
- ThihaElectronics
- Date:
- Wed Dec 03 16:57:50 2014 +0000
- Revision:
- 6:f7d4a6a500f3
- Parent:
- 5:922253f4e70b
- Child:
- 7:8ba4518ba2f8
added drawing example with comments
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ThihaElectronics | 0:968ea69b9984 | 1 | #include "mbed.h" |
ThihaElectronics | 5:922253f4e70b | 2 | #include "ili9328.h" |
ThihaElectronics | 5:922253f4e70b | 3 | |
ThihaElectronics | 0:968ea69b9984 | 4 | // prepare the data bus for writing commands and pixel data |
ThihaElectronics | 0:968ea69b9984 | 5 | //BusOut dataBus( p30, p29, p28, p27, p26, p25, p24, p23, p22, p21, p20, p19, p18, p17, p16, p15 ); // 16 pins |
ThihaElectronics | 0:968ea69b9984 | 6 | BusOut dataBus( PTA13, PTD5, PTD4, PTA12, PTA4, PTA5, PTC8, PTC9 ); // 16 pins |
ThihaElectronics | 0:968ea69b9984 | 7 | // create the lcd instance |
ThihaElectronics | 5:922253f4e70b | 8 | ILI9328_LCD lcd( PTB3, PTC2, PTB2, PTB1, &dataBus, NC, PTB0); // control pins and data bus |
ThihaElectronics | 0:968ea69b9984 | 9 | //CS, RESET, RS, WR |
ThihaElectronics | 0:968ea69b9984 | 10 | int main() |
ThihaElectronics | 0:968ea69b9984 | 11 | { |
ThihaElectronics | 0:968ea69b9984 | 12 | // initialize display - place it in standard portrait mode and set background to black and |
ThihaElectronics | 0:968ea69b9984 | 13 | // foreground to white color. |
ThihaElectronics | 0:968ea69b9984 | 14 | lcd.Initialize(); |
ThihaElectronics | 5:922253f4e70b | 15 | // set current font to the smallest 8x12 pixels font. |
ThihaElectronics | 5:922253f4e70b | 16 | // lcd.SetFont( Font8x12 ); |
ThihaElectronics | 5:922253f4e70b | 17 | // print something on the screen |
ThihaElectronics | 5:922253f4e70b | 18 | lcd.Print( "Hello, World!", CENTER, 50); // align text to center horizontally and use starndard colors |
ThihaElectronics | 0:968ea69b9984 | 19 | |
ThihaElectronics | 6:f7d4a6a500f3 | 20 | |
ThihaElectronics | 6:f7d4a6a500f3 | 21 | |
ThihaElectronics | 6:f7d4a6a500f3 | 22 | /* |
ThihaElectronics | 6:f7d4a6a500f3 | 23 | lcd.ClearScreen(); |
ThihaElectronics | 6:f7d4a6a500f3 | 24 | |
ThihaElectronics | 6:f7d4a6a500f3 | 25 | // for(ii=0;ii<240;ii++) |
ThihaElectronics | 6:f7d4a6a500f3 | 26 | // height = lcd.GetHeight(); |
ThihaElectronics | 6:f7d4a6a500f3 | 27 | // for(ii=0;ii<lcd.GetHeight1();ii++) |
ThihaElectronics | 6:f7d4a6a500f3 | 28 | for(ii=0;ii<width;ii++) |
ThihaElectronics | 6:f7d4a6a500f3 | 29 | { |
ThihaElectronics | 6:f7d4a6a500f3 | 30 | // lcd.DrawLine(0, 0, lcd.GetWidth1(), ii,COLOR_GREEN); |
ThihaElectronics | 6:f7d4a6a500f3 | 31 | lcd.DrawLine(0, 0, height, ii,COLOR_GREEN); |
ThihaElectronics | 6:f7d4a6a500f3 | 32 | // lcd.DrawLine(0, 0, 320, ii,COLOR_GREEN); |
ThihaElectronics | 6:f7d4a6a500f3 | 33 | ii = ii+10; |
ThihaElectronics | 6:f7d4a6a500f3 | 34 | } |
ThihaElectronics | 6:f7d4a6a500f3 | 35 | |
ThihaElectronics | 6:f7d4a6a500f3 | 36 | lcd.DrawCircle(height/4, width/4, 20, COLOR_GREEN); |
ThihaElectronics | 6:f7d4a6a500f3 | 37 | |
ThihaElectronics | 6:f7d4a6a500f3 | 38 | lcd.FillCircle(height/2, width/2, 50, COLOR_GREEN); |
ThihaElectronics | 6:f7d4a6a500f3 | 39 | |
ThihaElectronics | 6:f7d4a6a500f3 | 40 | lcd.FillTriangle(height/4, width/4,(height/4)+20, (width/4)+40,(height/4)-20, (width/4)+40, COLOR_RED); |
ThihaElectronics | 6:f7d4a6a500f3 | 41 | */ |
ThihaElectronics | 6:f7d4a6a500f3 | 42 | |
ThihaElectronics | 0:968ea69b9984 | 43 | while ( 1 ) { } |
ThihaElectronics | 0:968ea69b9984 | 44 | } |