SSD1963 Initial code & test fill screen.
Dependencies: mbed
main.cpp@0:2714fcd95190, 2014-04-18 (annotated)
- Committer:
- techstep
- Date:
- Fri Apr 18 04:16:35 2014 +0000
- Revision:
- 0:2714fcd95190
ST Nucleo F401RE; 7" TFT LCD 800x480 [SSD1963]; Test TFT Init.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
techstep | 0:2714fcd95190 | 1 | /***************************************************************************** |
techstep | 0:2714fcd95190 | 2 | * Project : 7" TFT LCD 800x480 [AT070TN92] |
techstep | 0:2714fcd95190 | 3 | * Compiler : mbed Online |
techstep | 0:2714fcd95190 | 4 | * Type : Main |
techstep | 0:2714fcd95190 | 5 | * Comment : Support mbed ST Nucleo Board. [Now on ST Nucleo F030R8] |
techstep | 0:2714fcd95190 | 6 | * : Support Chip = SSD1963 |
techstep | 0:2714fcd95190 | 7 | * File : main.c |
techstep | 0:2714fcd95190 | 8 | * |
techstep | 0:2714fcd95190 | 9 | * Author : Mr.Thongchai Artsamart [Bird Techstep] |
techstep | 0:2714fcd95190 | 10 | * E-Mail : t.artsamart@gmail.com |
techstep | 0:2714fcd95190 | 11 | * : tbird_th@hotmail.com |
techstep | 0:2714fcd95190 | 12 | * Start Date : 20/03/2014 [dd/mm/yyyy] |
techstep | 0:2714fcd95190 | 13 | * Version Date : 20/03/2014 [dd/mm/yyyy] |
techstep | 0:2714fcd95190 | 14 | * Licensed under a Creative Commons Attribution-ShareAlike 3.0 License. |
techstep | 0:2714fcd95190 | 15 | ***************************************************************************** |
techstep | 0:2714fcd95190 | 16 | * Remark : Thank you -. no1wudi [CooCox] |
techstep | 0:2714fcd95190 | 17 | * -. |
techstep | 0:2714fcd95190 | 18 | *****************************************************************************/ |
techstep | 0:2714fcd95190 | 19 | #include "mbed.h" |
techstep | 0:2714fcd95190 | 20 | #include "SSD1963.h" |
techstep | 0:2714fcd95190 | 21 | //#include "stm32f4xx.h" |
techstep | 0:2714fcd95190 | 22 | |
techstep | 0:2714fcd95190 | 23 | // Section : Define panel ----------------------------------------------------- |
techstep | 0:2714fcd95190 | 24 | #define LCD_W 800 |
techstep | 0:2714fcd95190 | 25 | #define LCD_H 480 |
techstep | 0:2714fcd95190 | 26 | |
techstep | 0:2714fcd95190 | 27 | // Section : Color define ----------------------------------------------------- |
techstep | 0:2714fcd95190 | 28 | #define ColorLightPink 255,182,193 |
techstep | 0:2714fcd95190 | 29 | #define ColorPink 255,192,203 |
techstep | 0:2714fcd95190 | 30 | #define ColorCrimson 220,20,60 |
techstep | 0:2714fcd95190 | 31 | #define ColorLavenderBlush 255,240,245 |
techstep | 0:2714fcd95190 | 32 | #define ColorHotPink 255,105,180 |
techstep | 0:2714fcd95190 | 33 | #define ColorDeepPink 255,20,147 |
techstep | 0:2714fcd95190 | 34 | #define ColorMediumVioletRed 199,21,133 |
techstep | 0:2714fcd95190 | 35 | #define ColorOrchid 218,112,214 |
techstep | 0:2714fcd95190 | 36 | #define ColorPurple 128,0,128 |
techstep | 0:2714fcd95190 | 37 | #define ColorBlue 0,0,255 |
techstep | 0:2714fcd95190 | 38 | #define ColorYellow 255,255,0 |
techstep | 0:2714fcd95190 | 39 | #define ColorOlive 128,128,0 |
techstep | 0:2714fcd95190 | 40 | #define ColorGreen 0,255,0 |
techstep | 0:2714fcd95190 | 41 | #define ColorGold 215,215,0 |
techstep | 0:2714fcd95190 | 42 | #define ColorOrange 255,165,0 |
techstep | 0:2714fcd95190 | 43 | #define ColorRed 255,0,0 |
techstep | 0:2714fcd95190 | 44 | #define ColorWhite 255,255,255 |
techstep | 0:2714fcd95190 | 45 | #define ColorBlack 0,0,0 |
techstep | 0:2714fcd95190 | 46 | #define ColorGlay 128,128,128 |
techstep | 0:2714fcd95190 | 47 | // End : Color define --------------------------------------------------------- |
techstep | 0:2714fcd95190 | 48 | |
techstep | 0:2714fcd95190 | 49 | // Section : Pins Connect ----------------------------------------------------- |
techstep | 0:2714fcd95190 | 50 | // Bus PortC |
techstep | 0:2714fcd95190 | 51 | // RS PA_15 |
techstep | 0:2714fcd95190 | 52 | // WR PA_14 |
techstep | 0:2714fcd95190 | 53 | // RD PA_13 |
techstep | 0:2714fcd95190 | 54 | // CS PA_12 |
techstep | 0:2714fcd95190 | 55 | // RESET PA_11 |
techstep | 0:2714fcd95190 | 56 | |
techstep | 0:2714fcd95190 | 57 | // Test Fast IO in PortC ------------------------------------------------------ |
techstep | 0:2714fcd95190 | 58 | //#define LCD_PIN_RESET GPIOA,GPIO_Pin_11 |
techstep | 0:2714fcd95190 | 59 | //#define LCD_PIN_nCS GPIOA,GPIO_Pin_12 |
techstep | 0:2714fcd95190 | 60 | //#define LCD_PIN_nRD GPIOA,GPIO_Pin_13 |
techstep | 0:2714fcd95190 | 61 | //#define LCD_PIN_nWR GPIOA,GPIO_Pin_14 |
techstep | 0:2714fcd95190 | 62 | //#define LCD_PIN_nRS GPIOA,GPIO_Pin_15 |
techstep | 0:2714fcd95190 | 63 | // End Test Fast IO in PortC -------------------------------------------------- |
techstep | 0:2714fcd95190 | 64 | |
techstep | 0:2714fcd95190 | 65 | //PortInOut LCD_BUS(PortC, 0xFFFF); |
techstep | 0:2714fcd95190 | 66 | //BusInOut LCD_BUS(PC_0,PC_1,PC_2,PC_3,PC_4,PC_5,PC_6,PC_7,PC_8,PC_9,PC_10,PC_11,PC_12,PC_13,PC_14,PC_15); |
techstep | 0:2714fcd95190 | 67 | //#define LCD_RESET PA_11 |
techstep | 0:2714fcd95190 | 68 | //#define LCD_nCS PA_12 |
techstep | 0:2714fcd95190 | 69 | //#define LCD_nRD PA_13 |
techstep | 0:2714fcd95190 | 70 | //#define LCD_nWR PA_14 |
techstep | 0:2714fcd95190 | 71 | //#define LCD_nRS PA_15 |
techstep | 0:2714fcd95190 | 72 | //DigitalOut LCD_RESET(PA_11); |
techstep | 0:2714fcd95190 | 73 | //DigitalOut LCD_nCS(PA_12); |
techstep | 0:2714fcd95190 | 74 | //DigitalOut LCD_nRD(PA_13); |
techstep | 0:2714fcd95190 | 75 | //DigitalOut LCD_nWR(PA_14); |
techstep | 0:2714fcd95190 | 76 | //DigitalOut LCD_nRS(PA_15); |
techstep | 0:2714fcd95190 | 77 | // End : Pins Connect --------------------------------------------------------- |
techstep | 0:2714fcd95190 | 78 | |
techstep | 0:2714fcd95190 | 79 | //SSD1963 MyTFT(LCD_nRS, LCD_nWR, LCD_nRD, LCD_nCS, LCD_RESET, &LCD_BUS); |
techstep | 0:2714fcd95190 | 80 | //Serial pc(SERIAL_TX, SERIAL_RX); |
techstep | 0:2714fcd95190 | 81 | SSD1963 MyTFT; |
techstep | 0:2714fcd95190 | 82 | |
techstep | 0:2714fcd95190 | 83 | // define timer ms ------------------------------------------------------------ |
techstep | 0:2714fcd95190 | 84 | #define timer_ms 1000 |
techstep | 0:2714fcd95190 | 85 | //======================================= |
techstep | 0:2714fcd95190 | 86 | int main(void) { |
techstep | 0:2714fcd95190 | 87 | /* |
techstep | 0:2714fcd95190 | 88 | MyTFT.writeCommand(0x0000); uint16_t tftID = MyTFT.readData(); |
techstep | 0:2714fcd95190 | 89 | pc.printf("\n \r"); |
techstep | 0:2714fcd95190 | 90 | pc.printf("Hello World! Bird Techstep\n \r"); |
techstep | 0:2714fcd95190 | 91 | pc.printf("TFT LCD Chip No. : "); |
techstep | 0:2714fcd95190 | 92 | pc.printf("0x%04x", tftID); |
techstep | 0:2714fcd95190 | 93 | pc.printf("\n \r"); |
techstep | 0:2714fcd95190 | 94 | // Use GPIOC->ODR = Output or GPIOC->IDR = Input |
techstep | 0:2714fcd95190 | 95 | */ |
techstep | 0:2714fcd95190 | 96 | //MyTFT.init(); |
techstep | 0:2714fcd95190 | 97 | MyTFT.begin(); |
techstep | 0:2714fcd95190 | 98 | |
techstep | 0:2714fcd95190 | 99 | while(1) |
techstep | 0:2714fcd95190 | 100 | { |
techstep | 0:2714fcd95190 | 101 | MyTFT.fillScreen(MyTFT.Color565(ColorBlack)); |
techstep | 0:2714fcd95190 | 102 | wait_ms(timer_ms); |
techstep | 0:2714fcd95190 | 103 | MyTFT.fillScreen(MyTFT.Color565(ColorGlay)); |
techstep | 0:2714fcd95190 | 104 | wait_ms(timer_ms); |
techstep | 0:2714fcd95190 | 105 | |
techstep | 0:2714fcd95190 | 106 | MyTFT.fillScreen(MyTFT.Color565(ColorLightPink)); |
techstep | 0:2714fcd95190 | 107 | wait_ms(timer_ms); |
techstep | 0:2714fcd95190 | 108 | MyTFT.fillScreen(MyTFT.Color565(ColorPink)); |
techstep | 0:2714fcd95190 | 109 | wait_ms(timer_ms); |
techstep | 0:2714fcd95190 | 110 | MyTFT.fillScreen(MyTFT.Color565(ColorCrimson)); |
techstep | 0:2714fcd95190 | 111 | wait_ms(timer_ms); |
techstep | 0:2714fcd95190 | 112 | MyTFT.fillScreen(MyTFT.Color565(ColorLavenderBlush)); |
techstep | 0:2714fcd95190 | 113 | wait_ms(timer_ms); |
techstep | 0:2714fcd95190 | 114 | MyTFT.fillScreen(MyTFT.Color565(ColorHotPink)); |
techstep | 0:2714fcd95190 | 115 | wait_ms(timer_ms); |
techstep | 0:2714fcd95190 | 116 | MyTFT.fillScreen(MyTFT.Color565(ColorDeepPink)); |
techstep | 0:2714fcd95190 | 117 | wait_ms(timer_ms); |
techstep | 0:2714fcd95190 | 118 | MyTFT.fillScreen(MyTFT.Color565(ColorMediumVioletRed)); |
techstep | 0:2714fcd95190 | 119 | wait_ms(timer_ms); |
techstep | 0:2714fcd95190 | 120 | MyTFT.fillScreen(MyTFT.Color565(ColorOrchid)); |
techstep | 0:2714fcd95190 | 121 | wait_ms(timer_ms); |
techstep | 0:2714fcd95190 | 122 | MyTFT.fillScreen(MyTFT.Color565(ColorPurple)); |
techstep | 0:2714fcd95190 | 123 | wait_ms(timer_ms); |
techstep | 0:2714fcd95190 | 124 | MyTFT.fillScreen(MyTFT.Color565(ColorWhite)); |
techstep | 0:2714fcd95190 | 125 | wait_ms(timer_ms); |
techstep | 0:2714fcd95190 | 126 | MyTFT.fillScreen(MyTFT.Color565(ColorBlue)); |
techstep | 0:2714fcd95190 | 127 | wait_ms(timer_ms); |
techstep | 0:2714fcd95190 | 128 | MyTFT.fillScreen(MyTFT.Color565(ColorYellow)); |
techstep | 0:2714fcd95190 | 129 | wait_ms(timer_ms); |
techstep | 0:2714fcd95190 | 130 | MyTFT.fillScreen(MyTFT.Color565(ColorOlive)); |
techstep | 0:2714fcd95190 | 131 | wait_ms(timer_ms); |
techstep | 0:2714fcd95190 | 132 | MyTFT.fillScreen(MyTFT.Color565(ColorGreen)); |
techstep | 0:2714fcd95190 | 133 | wait_ms(timer_ms); |
techstep | 0:2714fcd95190 | 134 | MyTFT.fillScreen(MyTFT.Color565(ColorGold)); |
techstep | 0:2714fcd95190 | 135 | wait_ms(timer_ms); |
techstep | 0:2714fcd95190 | 136 | MyTFT.fillScreen(MyTFT.Color565(ColorOrange)); |
techstep | 0:2714fcd95190 | 137 | wait_ms(timer_ms); |
techstep | 0:2714fcd95190 | 138 | MyTFT.fillScreen(MyTFT.Color565(ColorRed)); |
techstep | 0:2714fcd95190 | 139 | wait_ms(timer_ms); |
techstep | 0:2714fcd95190 | 140 | |
techstep | 0:2714fcd95190 | 141 | } |
techstep | 0:2714fcd95190 | 142 | } |