Kentaro Sekimoto / Mbed 2 deprecated GR-PEACH_TFTLCD_8bit

Dependencies:   TFTLCD_8bit mbed-src 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 // GR_PEACH_ILI9325
00005 // Imported from KL25Z_ILI9325
00006 
00007 // prepare the data bus for writing commands and pixel data
00008 //BusOut dataBus( p30, p29, p28, p27, p26, p25, p24, p23, p22, p21, p20, p19, p18, p17, p16, p15 ); // 16 pins
00009 BusOut dataBus( P2_7, P2_6, P2_5, P2_4, P2_3, P2_2, P2_1, P2_0 ); // 16 pins
00010 // create the lcd instance
00011 ILI9328_LCD lcd( P5_7, P5_4, P5_6, P5_5, &dataBus , NC, P5_3); // control pins and data bus
00012 //CS, RESET, RS, WR
00013 int main()
00014 {
00015     int ii,height,width;
00016     
00017     height = lcd.GetHeight();
00018     width = lcd.GetWidth();
00019     // initialize display - place it in standard portrait mode and set background to black and
00020     //                      foreground to white color.
00021     lcd.Initialize();
00022     // set current font to the smallest 8x12 pixels font.
00023 //    lcd.SetFont( Font8x12 );
00024     // print something on the screen
00025     lcd.Print( "Hello, World!", CENTER, 50); // align text to center horizontally and use starndard colors
00026 
00027     wait(2);
00028    
00029     lcd.ClearScreen();
00030 
00031 //    for(ii=0;ii<240;ii++)
00032 //    height = lcd.GetHeight();
00033 //    for(ii=0;ii<lcd.GetHeight1();ii++)
00034     for(ii=0;ii<width;ii++)
00035     {
00036 //        lcd.DrawLine(0, 0, lcd.GetWidth1(), ii,COLOR_GREEN);
00037         lcd.DrawLine(0, 0, height, ii,COLOR_GREEN);
00038 //        lcd.DrawLine(0, 0, 320, ii,COLOR_GREEN);
00039         ii = ii+10;    
00040     }
00041     wait(2);
00042 
00043     lcd.DrawCircle(height/4, width/4, 20, COLOR_GREEN);
00044     wait(2);
00045 
00046     lcd.FillCircle(height/2, width/2, 50, COLOR_GREEN);
00047     wait(2);
00048 
00049     lcd.FillTriangle(height/4, width/4,(height/4)+20, (width/4)+40,(height/4)-20, (width/4)+40, COLOR_RED);
00050 
00051 
00052     while ( 1 ) { }
00053 }