TFT_ILI9163C test A fork of https://github.com/sumotoy/TFT_ILI9163C

Dependencies:   Adafruit-GFX-Library TFT_ILI9163C mbed

Fork of IL9163C_test by _ peu605

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /*-----( Import needed libraries )-----*/  
00002 #include "mbed.h"
00003 #include <Adafruit_GFX.h>
00004 #include <TFT_ILI9163C.h>
00005 
00006 /* to connect Arduino TFT LCD Screen follow as described in
00007 https://www.arduino.cc/en/Guide/TFTtoBoards
00008 */
00009 
00010 /* define pin used*/
00011 #define __MOSI D11
00012 #define __MISO NC
00013 #define __SCLK D13
00014 #define __CS D10
00015 #define __DC D9
00016 #define __RST D8
00017 
00018 /*-----( Declare Constants )-----*/ 
00019 // Color definitions
00020 #define BLACK           0x0000
00021 #define BLUE            0x001F
00022 #define RED             0xF800
00023 #define GREEN           0x07E0
00024 #define CYAN            0x07FF
00025 #define MAGENTA         0xF81F
00026 #define YELLOW          0xFFE0
00027 #define WHITE           0xFFFF
00028 #define TRANSPARENT     -1
00029 
00030 #define SPI_BITRATE     50000000L
00031 
00032 /*-----( Declare objects )-----*/ 
00033 TFT_ILI9163C tft(__MOSI, __MISO, __SCLK, __CS, __DC, __RST);
00034 
00035 
00036 int main()
00037 { 
00038     tft.begin();
00039     tft.setBitrate(50000000);
00040     
00041     for(int i= 0; i<3; i++){
00042         tft.setRotation(0);
00043         tft.fillScreen(RED);
00044         wait(1.0);
00045         tft.fillScreen(BLUE);
00046         wait(1.0);
00047         tft.fillScreen(GREEN);
00048         wait(1.0);
00049         tft.fillScreen(CYAN);
00050         wait(1.0);
00051         tft.fillScreen(MAGENTA);
00052         wait(1.0);
00053         }
00054         
00055     for(int i= 0; i<10; i++){       
00056         tft.fillRect(0,0,128,80, GREEN);
00057         tft.fillRect(0,80,128,160, YELLOW);
00058         wait(0.5);
00059         tft.fillRect(0,0,128,80, YELLOW);
00060         tft.fillRect(0,80,128,160, GREEN);
00061         wait(0.5);
00062         } 
00063         
00064     tft.fillScreen(BLACK);   
00065     tft.fillRect(20,60,60,80,CYAN);
00066  
00067         
00068         
00069 }