TFT_ILI9163C test A fork of https://github.com/sumotoy/TFT_ILI9163C
Dependencies: Adafruit-GFX-Library TFT_ILI9163C mbed
Fork of IL9163C_test by
main.cpp@11:b838083e66f0, 2016-03-04 (annotated)
- Committer:
- billycorgan123
- Date:
- Fri Mar 04 08:58:51 2016 +0000
- Revision:
- 11:b838083e66f0
- Parent:
- 9:99e7307d5a59
program with Arduino TFT LCD Screen, 128x160, ILI9163
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
billycorgan123 | 11:b838083e66f0 | 1 | /*-----( Import needed libraries )-----*/ |
peu605 | 0:26cf1056924c | 2 | #include "mbed.h" |
peu605 | 0:26cf1056924c | 3 | #include <Adafruit_GFX.h> |
peu605 | 0:26cf1056924c | 4 | #include <TFT_ILI9163C.h> |
peu605 | 0:26cf1056924c | 5 | |
billycorgan123 | 11:b838083e66f0 | 6 | /* to connect Arduino TFT LCD Screen follow as described in |
billycorgan123 | 11:b838083e66f0 | 7 | https://www.arduino.cc/en/Guide/TFTtoBoards |
billycorgan123 | 11:b838083e66f0 | 8 | */ |
billycorgan123 | 11:b838083e66f0 | 9 | |
billycorgan123 | 11:b838083e66f0 | 10 | /* define pin used*/ |
peu605 | 0:26cf1056924c | 11 | #define __MOSI D11 |
peu605 | 0:26cf1056924c | 12 | #define __MISO NC |
peu605 | 0:26cf1056924c | 13 | #define __SCLK D13 |
peu605 | 0:26cf1056924c | 14 | #define __CS D10 |
peu605 | 0:26cf1056924c | 15 | #define __DC D9 |
peu605 | 0:26cf1056924c | 16 | #define __RST D8 |
peu605 | 0:26cf1056924c | 17 | |
billycorgan123 | 11:b838083e66f0 | 18 | /*-----( Declare Constants )-----*/ |
peu605 | 0:26cf1056924c | 19 | // Color definitions |
peu605 | 0:26cf1056924c | 20 | #define BLACK 0x0000 |
peu605 | 0:26cf1056924c | 21 | #define BLUE 0x001F |
peu605 | 0:26cf1056924c | 22 | #define RED 0xF800 |
peu605 | 0:26cf1056924c | 23 | #define GREEN 0x07E0 |
peu605 | 0:26cf1056924c | 24 | #define CYAN 0x07FF |
peu605 | 0:26cf1056924c | 25 | #define MAGENTA 0xF81F |
peu605 | 8:4fcf5494f425 | 26 | #define YELLOW 0xFFE0 |
peu605 | 0:26cf1056924c | 27 | #define WHITE 0xFFFF |
peu605 | 0:26cf1056924c | 28 | #define TRANSPARENT -1 |
peu605 | 0:26cf1056924c | 29 | |
peu605 | 8:4fcf5494f425 | 30 | #define SPI_BITRATE 50000000L |
peu605 | 8:4fcf5494f425 | 31 | |
billycorgan123 | 11:b838083e66f0 | 32 | /*-----( Declare objects )-----*/ |
peu605 | 9:99e7307d5a59 | 33 | TFT_ILI9163C tft(__MOSI, __MISO, __SCLK, __CS, __DC, __RST); |
peu605 | 0:26cf1056924c | 34 | |
peu605 | 0:26cf1056924c | 35 | |
peu605 | 9:99e7307d5a59 | 36 | int main() |
billycorgan123 | 11:b838083e66f0 | 37 | { |
peu605 | 9:99e7307d5a59 | 38 | tft.begin(); |
peu605 | 9:99e7307d5a59 | 39 | tft.setBitrate(50000000); |
peu605 | 9:99e7307d5a59 | 40 | |
billycorgan123 | 11:b838083e66f0 | 41 | for(int i= 0; i<3; i++){ |
billycorgan123 | 11:b838083e66f0 | 42 | tft.setRotation(0); |
billycorgan123 | 11:b838083e66f0 | 43 | tft.fillScreen(RED); |
billycorgan123 | 11:b838083e66f0 | 44 | wait(1.0); |
billycorgan123 | 11:b838083e66f0 | 45 | tft.fillScreen(BLUE); |
billycorgan123 | 11:b838083e66f0 | 46 | wait(1.0); |
billycorgan123 | 11:b838083e66f0 | 47 | tft.fillScreen(GREEN); |
billycorgan123 | 11:b838083e66f0 | 48 | wait(1.0); |
billycorgan123 | 11:b838083e66f0 | 49 | tft.fillScreen(CYAN); |
billycorgan123 | 11:b838083e66f0 | 50 | wait(1.0); |
billycorgan123 | 11:b838083e66f0 | 51 | tft.fillScreen(MAGENTA); |
billycorgan123 | 11:b838083e66f0 | 52 | wait(1.0); |
billycorgan123 | 11:b838083e66f0 | 53 | } |
billycorgan123 | 11:b838083e66f0 | 54 | |
billycorgan123 | 11:b838083e66f0 | 55 | for(int i= 0; i<10; i++){ |
billycorgan123 | 11:b838083e66f0 | 56 | tft.fillRect(0,0,128,80, GREEN); |
billycorgan123 | 11:b838083e66f0 | 57 | tft.fillRect(0,80,128,160, YELLOW); |
billycorgan123 | 11:b838083e66f0 | 58 | wait(0.5); |
billycorgan123 | 11:b838083e66f0 | 59 | tft.fillRect(0,0,128,80, YELLOW); |
billycorgan123 | 11:b838083e66f0 | 60 | tft.fillRect(0,80,128,160, GREEN); |
billycorgan123 | 11:b838083e66f0 | 61 | wait(0.5); |
billycorgan123 | 11:b838083e66f0 | 62 | } |
billycorgan123 | 11:b838083e66f0 | 63 | |
billycorgan123 | 11:b838083e66f0 | 64 | tft.fillScreen(BLACK); |
billycorgan123 | 11:b838083e66f0 | 65 | tft.fillRect(20,60,60,80,CYAN); |
billycorgan123 | 11:b838083e66f0 | 66 | |
billycorgan123 | 11:b838083e66f0 | 67 | |
billycorgan123 | 11:b838083e66f0 | 68 | |
peu605 | 0:26cf1056924c | 69 | } |