ILI9325 based GR_SAKURA LCD Shield
Dependencies: TFTLCD_8bit mbed-src mbed
main.cpp@3:86f4425affe5, 2014-04-16 (annotated)
- Committer:
- ThihaElectronics
- Date:
- Wed Apr 16 14:49:07 2014 +0000
- Revision:
- 3:86f4425affe5
- Parent:
- 2:bfdbc88d37bf
- Child:
- 4:471d7c5e8360
add triangle routine
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ThihaElectronics | 0:968ea69b9984 | 1 | #include "mbed.h" |
ThihaElectronics | 0:968ea69b9984 | 2 | #include "ili9325.h" |
ThihaElectronics | 3:86f4425affe5 | 3 | #include "lcd_base.h" |
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 | 2:bfdbc88d37bf | 8 | ILI9325_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 | 3:86f4425affe5 | 12 | int ii; |
ThihaElectronics | 3:86f4425affe5 | 13 | unsigned short height = lcd.GetHeight(); |
ThihaElectronics | 3:86f4425affe5 | 14 | unsigned short width = lcd.GetWidth(); |
ThihaElectronics | 3:86f4425affe5 | 15 | |
ThihaElectronics | 0:968ea69b9984 | 16 | // initialize display - place it in standard portrait mode and set background to black and |
ThihaElectronics | 0:968ea69b9984 | 17 | // foreground to white color. |
ThihaElectronics | 3:86f4425affe5 | 18 | //lcd.Initialize(LANDSCAPE,RGB18); |
ThihaElectronics | 0:968ea69b9984 | 19 | lcd.Initialize(); |
ThihaElectronics | 2:bfdbc88d37bf | 20 | |
ThihaElectronics | 2:bfdbc88d37bf | 21 | lcd.FillScreen(COLOR_GREEN); |
ThihaElectronics | 0:968ea69b9984 | 22 | // set current font to the smallest 8x12 pixels font. |
ThihaElectronics | 0:968ea69b9984 | 23 | // lcd.SetFont( Font8x12 ); |
ThihaElectronics | 0:968ea69b9984 | 24 | // print something on the screen |
ThihaElectronics | 2:bfdbc88d37bf | 25 | |
ThihaElectronics | 3:86f4425affe5 | 26 | lcd.Print( "Thiha Electronics", CENTER, 0, -2,COLOR_GREEN); // align text to center horizontally and use starndard colors |
ThihaElectronics | 2:bfdbc88d37bf | 27 | lcd.Print( "Using KL25Z on mbed", CENTER, 300, -2,COLOR_GREEN); // align text to center horizontally and use starndard colors |
ThihaElectronics | 2:bfdbc88d37bf | 28 | lcd.Print( "Code @ users/", CENTER, 600, -2,COLOR_GREEN); // align text to center horizontally and use starndard colors |
ThihaElectronics | 3:86f4425affe5 | 29 | lcd.Print( "/ThihaElectronics/", CENTER, 900, -2,COLOR_GREEN); // align text to center horizontally and use starndard colors |
ThihaElectronics | 3:86f4425affe5 | 30 | lcd.Print( "KL25Z_ILI9325/", CENTER, 1200, -2,COLOR_GREEN); // align text to center horizontally and use starndard colors |
ThihaElectronics | 3:86f4425affe5 | 31 | |
ThihaElectronics | 3:86f4425affe5 | 32 | wait(2); |
ThihaElectronics | 3:86f4425affe5 | 33 | |
ThihaElectronics | 3:86f4425affe5 | 34 | lcd.ClearScreen(); |
ThihaElectronics | 2:bfdbc88d37bf | 35 | |
ThihaElectronics | 3:86f4425affe5 | 36 | // for(ii=0;ii<240;ii++) |
ThihaElectronics | 3:86f4425affe5 | 37 | // height = lcd.GetHeight(); |
ThihaElectronics | 3:86f4425affe5 | 38 | // for(ii=0;ii<lcd.GetHeight1();ii++) |
ThihaElectronics | 3:86f4425affe5 | 39 | for(ii=0;ii<width;ii++) |
ThihaElectronics | 3:86f4425affe5 | 40 | { |
ThihaElectronics | 3:86f4425affe5 | 41 | // lcd.DrawLine(0, 0, lcd.GetWidth1(), ii,COLOR_GREEN); |
ThihaElectronics | 3:86f4425affe5 | 42 | lcd.DrawLine(0, 0, height, ii,COLOR_GREEN); |
ThihaElectronics | 3:86f4425affe5 | 43 | // lcd.DrawLine(0, 0, 320, ii,COLOR_GREEN); |
ThihaElectronics | 3:86f4425affe5 | 44 | ii = ii+10; |
ThihaElectronics | 3:86f4425affe5 | 45 | } |
ThihaElectronics | 2:bfdbc88d37bf | 46 | |
ThihaElectronics | 3:86f4425affe5 | 47 | lcd.DrawCircle(height/4, width/4, 20, COLOR_GREEN); |
ThihaElectronics | 3:86f4425affe5 | 48 | |
ThihaElectronics | 3:86f4425affe5 | 49 | lcd.FillCircle(height/2, width/2, 50, COLOR_GREEN); |
ThihaElectronics | 3:86f4425affe5 | 50 | |
ThihaElectronics | 3:86f4425affe5 | 51 | lcd.FillTriangle(height/4, width/4,(height/4)+20, (width/4)+40,(height/4)-20, (width/4)+40, COLOR_RED); |
ThihaElectronics | 3:86f4425affe5 | 52 | |
ThihaElectronics | 0:968ea69b9984 | 53 | |
ThihaElectronics | 0:968ea69b9984 | 54 | while ( 1 ) { } |
ThihaElectronics | 0:968ea69b9984 | 55 | } |