ILI9325 based TFT Arduino shield on KL25Z

Dependencies:   TFTLCD_8bit mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "ili9328.h"
00003 
00004 // prepare the data bus for writing commands and pixel data
00005 //BusOut dataBus( p30, p29, p28, p27, p26, p25, p24, p23, p22, p21, p20, p19, p18, p17, p16, p15 ); // 16 pins
00006 BusOut dataBus( PTA13, PTD5, PTD4, PTA12, PTA4, PTA5, PTC8, PTC9 ); // 16 pins
00007 // create the lcd instance
00008 ILI9328_LCD lcd( PTB3, PTC2, PTB2, PTB1, &dataBus, NC, PTB0); // control pins and data bus
00009 //CS, RESET, RS, WR
00010 int main()
00011 {
00012     int ii,height,width;
00013     
00014     height = lcd.GetHeight();
00015     width = lcd.GetWidth();
00016     // initialize display - place it in standard portrait mode and set background to black and
00017     //                      foreground to white color.
00018     lcd.Initialize();
00019     // set current font to the smallest 8x12 pixels font.
00020 //    lcd.SetFont( Font8x12 );
00021     // print something on the screen
00022     lcd.Print( "Hello, World!", CENTER, 50); // align text to center horizontally and use starndard colors
00023 
00024     wait(2);
00025    
00026     lcd.ClearScreen();
00027 
00028 //    for(ii=0;ii<240;ii++)
00029 //    height = lcd.GetHeight();
00030 //    for(ii=0;ii<lcd.GetHeight1();ii++)
00031     for(ii=0;ii<width;ii++)
00032     {
00033 //        lcd.DrawLine(0, 0, lcd.GetWidth1(), ii,COLOR_GREEN);
00034         lcd.DrawLine(0, 0, height, ii,COLOR_GREEN);
00035 //        lcd.DrawLine(0, 0, 320, ii,COLOR_GREEN);
00036         ii = ii+10;    
00037     }
00038     wait(2);
00039 
00040     lcd.DrawCircle(height/4, width/4, 20, COLOR_GREEN);
00041     wait(2);
00042 
00043     lcd.FillCircle(height/2, width/2, 50, COLOR_GREEN);
00044     wait(2);
00045 
00046     lcd.FillTriangle(height/4, width/4,(height/4)+20, (width/4)+40,(height/4)-20, (width/4)+40, COLOR_RED);
00047 
00048 
00049     while ( 1 ) { }
00050 }