ILI9325 based GR_SAKURA LCD Shield
Dependencies: TFTLCD_8bit mbed-src mbed
main.cpp@9:2d26ff43f069, 2015-01-03 (annotated)
- Committer:
- ksekimoto
- Date:
- Sat Jan 03 04:41:39 2015 +0000
- Revision:
- 9:2d26ff43f069
- Parent:
- 8:d4fc30048585
The first version. Forked from KL25Z_ILI9325 by Thiha Electronics
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 | |
ksekimoto | 8:d4fc30048585 | 4 | // GR_PEACH_ILI9325 |
ksekimoto | 8:d4fc30048585 | 5 | // Imported from KL25Z_ILI9325 |
ksekimoto | 8:d4fc30048585 | 6 | |
ThihaElectronics | 0:968ea69b9984 | 7 | // prepare the data bus for writing commands and pixel data |
ThihaElectronics | 0:968ea69b9984 | 8 | //BusOut dataBus( p30, p29, p28, p27, p26, p25, p24, p23, p22, p21, p20, p19, p18, p17, p16, p15 ); // 16 pins |
ksekimoto | 8:d4fc30048585 | 9 | BusOut dataBus( P2_7, P2_6, P2_5, P2_4, P2_3, P2_2, P2_1, P2_0 ); // 16 pins |
ThihaElectronics | 0:968ea69b9984 | 10 | // create the lcd instance |
ksekimoto | 8:d4fc30048585 | 11 | ILI9328_LCD lcd( P5_7, P5_4, P5_6, P5_5, &dataBus , NC, P5_3); // control pins and data bus |
ThihaElectronics | 0:968ea69b9984 | 12 | //CS, RESET, RS, WR |
ThihaElectronics | 0:968ea69b9984 | 13 | int main() |
ThihaElectronics | 0:968ea69b9984 | 14 | { |
ThihaElectronics | 7:8ba4518ba2f8 | 15 | int ii,height,width; |
ThihaElectronics | 7:8ba4518ba2f8 | 16 | |
ThihaElectronics | 7:8ba4518ba2f8 | 17 | height = lcd.GetHeight(); |
ThihaElectronics | 7:8ba4518ba2f8 | 18 | width = lcd.GetWidth(); |
ThihaElectronics | 0:968ea69b9984 | 19 | // initialize display - place it in standard portrait mode and set background to black and |
ThihaElectronics | 0:968ea69b9984 | 20 | // foreground to white color. |
ThihaElectronics | 0:968ea69b9984 | 21 | lcd.Initialize(); |
ThihaElectronics | 5:922253f4e70b | 22 | // set current font to the smallest 8x12 pixels font. |
ThihaElectronics | 5:922253f4e70b | 23 | // lcd.SetFont( Font8x12 ); |
ThihaElectronics | 5:922253f4e70b | 24 | // print something on the screen |
ThihaElectronics | 5:922253f4e70b | 25 | lcd.Print( "Hello, World!", CENTER, 50); // align text to center horizontally and use starndard colors |
ThihaElectronics | 0:968ea69b9984 | 26 | |
ThihaElectronics | 7:8ba4518ba2f8 | 27 | wait(2); |
ThihaElectronics | 7:8ba4518ba2f8 | 28 | |
ThihaElectronics | 6:f7d4a6a500f3 | 29 | lcd.ClearScreen(); |
ThihaElectronics | 6:f7d4a6a500f3 | 30 | |
ThihaElectronics | 6:f7d4a6a500f3 | 31 | // for(ii=0;ii<240;ii++) |
ThihaElectronics | 6:f7d4a6a500f3 | 32 | // height = lcd.GetHeight(); |
ThihaElectronics | 6:f7d4a6a500f3 | 33 | // for(ii=0;ii<lcd.GetHeight1();ii++) |
ThihaElectronics | 6:f7d4a6a500f3 | 34 | for(ii=0;ii<width;ii++) |
ThihaElectronics | 6:f7d4a6a500f3 | 35 | { |
ThihaElectronics | 6:f7d4a6a500f3 | 36 | // lcd.DrawLine(0, 0, lcd.GetWidth1(), ii,COLOR_GREEN); |
ThihaElectronics | 6:f7d4a6a500f3 | 37 | lcd.DrawLine(0, 0, height, ii,COLOR_GREEN); |
ThihaElectronics | 6:f7d4a6a500f3 | 38 | // lcd.DrawLine(0, 0, 320, ii,COLOR_GREEN); |
ThihaElectronics | 6:f7d4a6a500f3 | 39 | ii = ii+10; |
ThihaElectronics | 6:f7d4a6a500f3 | 40 | } |
ThihaElectronics | 7:8ba4518ba2f8 | 41 | wait(2); |
ThihaElectronics | 6:f7d4a6a500f3 | 42 | |
ThihaElectronics | 6:f7d4a6a500f3 | 43 | lcd.DrawCircle(height/4, width/4, 20, COLOR_GREEN); |
ThihaElectronics | 7:8ba4518ba2f8 | 44 | wait(2); |
ThihaElectronics | 6:f7d4a6a500f3 | 45 | |
ThihaElectronics | 6:f7d4a6a500f3 | 46 | lcd.FillCircle(height/2, width/2, 50, COLOR_GREEN); |
ThihaElectronics | 7:8ba4518ba2f8 | 47 | wait(2); |
ThihaElectronics | 6:f7d4a6a500f3 | 48 | |
ThihaElectronics | 6:f7d4a6a500f3 | 49 | lcd.FillTriangle(height/4, width/4,(height/4)+20, (width/4)+40,(height/4)-20, (width/4)+40, COLOR_RED); |
ThihaElectronics | 7:8ba4518ba2f8 | 50 | |
ThihaElectronics | 6:f7d4a6a500f3 | 51 | |
ThihaElectronics | 0:968ea69b9984 | 52 | while ( 1 ) { } |
ThihaElectronics | 0:968ea69b9984 | 53 | } |