├── library.properties ├── library.json ├── src ├── 2828.h ├── touch.h ├── 2828.cpp ├── touch.cpp └── ER-TFTM0784-1.h ├── LICENSE ├── README.md └── examples └── demo └── demo.ino /library.properties: -------------------------------------------------------------------------------- 1 | name=ER-TFTM0784-1 2 | version=0.0.1 3 | author=caiannello 4 | maintainer=caiannello 5 | sentence=ER-TFTM0784-1 library 6 | paragraph= 7 | category=Other 8 | url= 9 | architectures=* 10 | 11 | -------------------------------------------------------------------------------- /library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ER-TFTM0784-1", 3 | "frameworks": "Arduino", 4 | "platforms": "*", 5 | "keywords": "ra8876, gt911, ssd2828, eastrising, buydisplay", 6 | "description": "Display lib for ER-TFTM0784-1 1280x400 TFT LCD", 7 | "version": "0.0.1", 8 | "authors":[ 9 | { "name": "Craig Iannello, Port to Arduino", 10 | "maintainer": true 11 | }, 12 | { "name": "Javen Liu, Author of original example code", 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /src/2828.h: -------------------------------------------------------------------------------- 1 | #ifndef __2828_H__ 2 | #define __2828_H__ 3 | 4 | #include 5 | #include 6 | 7 | extern uint8_t CS_2828; 8 | extern uint8_t RST_2828; 9 | extern uint8_t SDI_2828; 10 | extern uint8_t SCLK_2828; 11 | 12 | void SPI_3W_SET_Cmd(uint16_t Sdata); 13 | void SPI_3W_SET_PAs(uint16_t Sdata); 14 | uint8_t SPI_ReadData(void); 15 | void SPI_WriteData(uint8_t value); 16 | void SPI_WriteCmd(uint8_t value); 17 | void GP_COMMAD_PA(uint16_t num); 18 | 19 | void SSD2828_Reset(void); 20 | void SSD2828_initial(void); 21 | 22 | #endif -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Craig Iannello 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/touch.h: -------------------------------------------------------------------------------- 1 | #ifndef __TOUCH_H__ 2 | #define __TOUCH_H__ 3 | 4 | #include 5 | #include 6 | #include 7 | /* touch panel interface define */ 8 | 9 | extern uint8_t SDA_911; 10 | extern uint8_t SCL_911; 11 | extern uint8_t PEN_911; 12 | extern uint8_t RESET_911; 13 | 14 | 15 | //Touch Status 16 | #define Key_Down 0x01 17 | #define Key_Up 0x00 18 | 19 | 20 | typedef struct 21 | { 22 | uint16_t x1; 23 | uint16_t y1; 24 | uint16_t x2; 25 | uint16_t y2; 26 | uint16_t x3; 27 | uint16_t y3; 28 | uint16_t x4; 29 | uint16_t y4; 30 | uint16_t x5; 31 | uint16_t y5; 32 | 33 | 34 | uint8_t touch_point; 35 | uint8_t Key_Sta; 36 | } _ts_event; 37 | 38 | #define WRITE_ADD 0xba 39 | #define READ_ADD 0xbb 40 | 41 | #define CT_MAX_TOUCH 5 //���ݴ��������֧�ֵĵ��� 42 | 43 | // Registers define 44 | #define GTP_READ_COOR_ADDR 0x814e 45 | #define GTP_REG_SLEEP 0x8040 46 | #define GTP_REG_SENSOR_ID 0x814a 47 | #define GTP_REG_CONFIG_DATA 0x8047 48 | #define GTP_REG_VERSION 0x8440 49 | 50 | //#define CT_READ_XY_REG 0x814E //��ȡ����Ĵ��� 51 | //#define CT_CONFIG_REG 0x8047 //���ò�����ʼ�Ĵ��� 52 | 53 | const uint8_t GTP_CFG_DATA[] PROGMEM = 54 | { 55 | /* 56 | 0x63,0x00,0x04,0x58,0x02,0x0A,0x3D,0x00, 57 | 0x01,0x08,0x28,0x0F,0x50,0x32,0x03,0x05, 58 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x17, 59 | 0x19,0x1D,0x14,0x90,0x2F,0x89,0x23,0x25, 60 | 0xD3,0x07,0x00,0x00,0x00,0x02,0x03,0x1D, 61 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 62 | 0x00,0x00,0x00,0x19,0x32,0x94,0xD5,0x02, 63 | 0x07,0x00,0x00,0x04,0xA2,0x1A,0x00,0x90, 64 | 0x1E,0x00,0x80,0x23,0x00,0x73,0x28,0x00, 65 | 0x68,0x2E,0x00,0x68,0x00,0x00,0x00,0x00, 66 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 67 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 68 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 69 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 70 | 0x16,0x15,0x14,0x11,0x10,0x0F,0x0E,0x0D, 71 | 0x0C,0x09,0x08,0x07,0x06,0x05,0x04,0x01, 72 | 0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00, 73 | 0x00,0x00,0x00,0x00,0x00,0x00,0x29,0x28, 74 | 0x27,0x26,0x25,0x24,0x23,0x22,0x21,0x20, 75 | 0x1F,0x1E,0x1C,0x1B,0x19,0x14,0x13,0x12, 76 | 0x11,0x10,0x0F,0x0E,0x0D,0x0C,0x0A,0x08, 77 | 0x07,0x06,0x04,0x02,0x00,0xFF,0x00,0x00, 78 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 79 | 0x71,0x01 */ 80 | 81 | 0x5A,0x00,0x05,0x90,0x01,0x05,0x0D,0x00, 82 | 0x01,0x08,0x28,0x05,0x50,0x32,0x03,0x05, 83 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 84 | 0x00,0x00,0x00,0x8B,0x2B,0x0A,0x22,0x24, 85 | 0x31,0x0D,0x00,0x00,0x00,0x01,0x03,0x2D, 86 | 0x00,0x00,0x00,0x00,0x00,0x03,0x64,0x32, 87 | 0x00,0x00,0x00,0x1A,0x40,0x94,0xC5,0x02, 88 | 0x07,0x00,0x00,0x04,0x95,0x1C,0x00,0x7F, 89 | 0x22,0x00,0x71,0x28,0x00,0x62,0x31,0x00, 90 | 0x58,0x3A,0x00,0x58,0x00,0x00,0x00,0x00, 91 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 92 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 93 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 94 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 95 | 0x02,0x04,0x06,0x08,0x0A,0x0C,0x0E,0x10, 96 | 0x12,0x14,0xFF,0xFF,0xFF,0xFF,0x00,0x00, 97 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 98 | 0x00,0x00,0x00,0x00,0x00,0x00,0x16,0x18, 99 | 0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22,0x24, 100 | 0x26,0x13,0x12,0x10,0x0F,0x0C,0x0A,0x08, 101 | 0x06,0x04,0x02,0x00,0xFF,0xFF,0xFF,0xFF, 102 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 103 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 104 | 0xE3,0x01 105 | }; 106 | 107 | 108 | void TOUCH_Init(void); 109 | void TOUCH_Start(void); 110 | void TOUCH_Stop(void); 111 | uint8_t TOUCH_Wait_Ack(void); 112 | void TOUCH_Ack(void); 113 | void TOUCH_NAck(void); 114 | 115 | void TOUCH_Send_Byte(uint8_t txd); 116 | uint8_t TOUCH_Read_Byte(uint8_t ack); 117 | void Draw_Big_Point(uint16_t x,uint16_t y,uint16_t colour); 118 | uint8_t GT911_read_data(void); 119 | void inttostr(uint16_t value,uint8_t *str); 120 | void GT911_RD_Reg(uint16_t reg,uint8_t *buf,uint8_t len); 121 | uint8_t GT911_WR_Reg(uint16_t reg,uint8_t *buf,uint8_t len); 122 | 123 | 124 | #endif 125 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ``` 2 | /////////////////////////////////////////////////////////////////////////////// 3 | 4 | Display library for EASTRISING 1280x400 TFT LCD (model ER-TFTM0784-1) 5 | 6 | This one is different from its peers, which usually have just a RA8876. 7 | It adds An SSD2828 controller which requires its own initialization. 8 | 9 | This is a sloppy port to Arduino of demo code originally written by 10 | JAVEN LIU for a C8051 microcontroller. 11 | 12 | Product URL: 13 | 14 | https://www.buydisplay.com/spi-1280x400-7-84-ips-tft-lcd-module-with-ra8876-capacitive-touch-panel 15 | 16 | /////////////////////////////////////////////////////////////////////////////// 17 | 18 | ------------------------------------------------------------------------------- 19 | The module has three main controllers on it: 20 | ------------------------------------------------------------------------------- 21 | 22 | RA8876: Main display controller which does the graphics and text. 23 | It has attached 16MB SDRAM and can do DMA to move graphics 24 | around and stuff. 25 | 26 | It can use any of the following communications schemes: 27 | 28 | * SPI 4-Wire (up to ~50Mhz if wires are short) 29 | * 8080 Parallel, 16 bit (needs a TON of IO PINS) 30 | * 8080 Parallel, 8 bit 31 | 32 | SSD2828: Low-level MIPI LCD driver. SPI interface. Needs to be 33 | sent some configuration data on powerup, and it can be 34 | ignored after that. 35 | 36 | GT911: Capacitive touch panel controller. I2C interface + 1 Interrupt 37 | flag output pin. 38 | 39 | ------------------------------------------------------------------------------- 40 | NOTE 41 | ------------------------------------------------------------------------------- 42 | 43 | I ordered mine configured for 3.3V and SPI interface. It draws around 300 mA 44 | at this voltage, so it can't be powered directly by any Arduino. An external 45 | power supply is necessary. OR, you can configure it for 5V and not worry about 46 | it. 47 | 48 | I did my development and testing on an Arduino DUE, hence the 3.3V, but the 49 | code should work on other Arduinos or Teensy with minimal modification. 50 | 51 | ------------------------------------------------------------------------------- 52 | CONNECTING AN ARDUINO DUE IN SPI MODE 53 | ------------------------------------------------------------------------------- 54 | 55 | SSD2828 Panel Driver 56 | 57 | /CS 24 58 | RESET 25 59 | SDI 26 60 | SCLK 27 61 | 62 | GT911 Touch Screen 63 | 64 | SDA 28 65 | SCL 29 66 | INT 30 67 | RESET 31 68 | 69 | RA8876 LCD Controller 70 | 71 | RESET 34 72 | /CS 10 73 | SDI 109 (Arduino DUE ISP port MOSI pin) 74 | SDO 108 (Arduino DUE ISP port, MISO pin) 75 | SCLK 110 (Arduino DUE ISP port, SCK pin) 76 | 77 | ------------------------------------------------------------------------------- 78 | CONNECTING AN ARDUINO DUE IN 16-BIT 8080 PARALLEL MODE 79 | ------------------------------------------------------------------------------- 80 | 81 | SSD2828 Panel Driver 82 | 83 | /CS 24 84 | RESET 25 85 | SDI 26 86 | SCLK 27 87 | 88 | GT911 Touch Screen 89 | 90 | SDA 28 91 | SCL 29 92 | INT 30 93 | RESET 31 94 | 95 | RA8876 LCD Controller 96 | 97 | RESET 34 98 | RS 33 99 | /CS 34 100 | WR 35 101 | RD 36 102 | D0 38 103 | D1 39 104 | D2 40 105 | D3 41 106 | D4 42 107 | D5 43 108 | D6 44 109 | D7 45 110 | D8 46 111 | D9 47 112 | D10 48 113 | D11 49 114 | D12 50 115 | D13 51 116 | D14 52 117 | D15 53 118 | 119 | ------------------------------------------------------------------------------- 120 | EXAMPLES 121 | ------------------------------------------------------------------------------- 122 | 123 | demo.ino - Demonstrates the RA8876 graphics. 124 | 125 | ------------------------------------------------------------------------------- 126 | HELP WANTED 127 | ------------------------------------------------------------------------------- 128 | 129 | There is much room for improvement and optimization here, so please 130 | lend a hand. 131 | 132 | --- 133 | ``` 134 | -------------------------------------------------------------------------------- /src/2828.cpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // SSD2828 MIPI Bridge - Initialization 4 | // 5 | // Hard-coded to work with this particular LCD panel: 6 | // 7 | // Brand: EASTRISING 8 | // Model: ER-TFTM0784-1 9 | // ( 400 x 1280 dots 7.84" color IPS tft lcd ) 10 | // 11 | // This code was only slightly modified from the 8051 example code 12 | // written by JAVEN LIU. In his example, he bit-bangs the SPI to the 13 | // SSD2828, and since this only needs to be done on powerup and doesnt 14 | // need to be performant, I decided to keep it that way to save resources. 15 | // 16 | // I did change the GPIO stuff to be Arduino-oriented rather than Keil 8051. 17 | // 18 | /////////////////////////////////////////////////////////////////////////////// 19 | #include "2828.h" 20 | //----------------------------------------------------------------------------- 21 | void SSD2828_Reset(void) 22 | { 23 | 24 | // GPIO init 25 | 26 | pinMode(SDI_2828,OUTPUT); 27 | digitalWrite(SDI_2828,1); 28 | 29 | pinMode(SCLK_2828,OUTPUT); 30 | digitalWrite(SCLK_2828,1); 31 | 32 | pinMode(CS_2828,OUTPUT); 33 | digitalWrite(CS_2828,1); 34 | 35 | pinMode(RST_2828,OUTPUT); 36 | digitalWrite(RST_2828,1); 37 | 38 | // chip reset 39 | 40 | digitalWrite(RST_2828,0); 41 | delay(30); 42 | 43 | digitalWrite(RST_2828,1); 44 | delay(50); 45 | 46 | } 47 | //----------------------------------------------------------------------------- 48 | inline void spi_delay(void) 49 | { 50 | // 128 NOPS should bring the SPI speed well below 2.3 MHz on 51 | // a Teensy 4.0. On AVR devices, even slower. 52 | 53 | asm("nop;nop;nop;nop;nop;nop;nop;nop;"); 54 | asm("nop;nop;nop;nop;nop;nop;nop;nop;"); 55 | asm("nop;nop;nop;nop;nop;nop;nop;nop;"); 56 | asm("nop;nop;nop;nop;nop;nop;nop;nop;"); 57 | asm("nop;nop;nop;nop;nop;nop;nop;nop;"); 58 | asm("nop;nop;nop;nop;nop;nop;nop;nop;"); 59 | asm("nop;nop;nop;nop;nop;nop;nop;nop;"); 60 | asm("nop;nop;nop;nop;nop;nop;nop;nop;"); 61 | 62 | asm("nop;nop;nop;nop;nop;nop;nop;nop;"); 63 | asm("nop;nop;nop;nop;nop;nop;nop;nop;"); 64 | asm("nop;nop;nop;nop;nop;nop;nop;nop;"); 65 | asm("nop;nop;nop;nop;nop;nop;nop;nop;"); 66 | asm("nop;nop;nop;nop;nop;nop;nop;nop;"); 67 | asm("nop;nop;nop;nop;nop;nop;nop;nop;"); 68 | asm("nop;nop;nop;nop;nop;nop;nop;nop;"); 69 | asm("nop;nop;nop;nop;nop;nop;nop;nop;"); 70 | } 71 | //----------------------------------------------------------------------------- 72 | void SPI_3W_SET_Cmd(uint16_t Sdata) 73 | { 74 | uint8_t i; 75 | digitalWrite(CS_2828,0); 76 | spi_delay(); 77 | digitalWrite(SDI_2828,0); 78 | spi_delay(); 79 | digitalWrite(SCLK_2828 ,0); 80 | spi_delay(); 81 | digitalWrite(SCLK_2828 ,1); 82 | spi_delay(); 83 | for(i=8; i>0; i--) 84 | { 85 | if(Sdata&0x80) 86 | digitalWrite(SDI_2828,1); 87 | else 88 | digitalWrite(SDI_2828,0); 89 | spi_delay(); 90 | digitalWrite(SCLK_2828 ,0); 91 | spi_delay(); 92 | digitalWrite(SCLK_2828 ,1); 93 | spi_delay(); 94 | Sdata <<= 1; 95 | } 96 | digitalWrite(SCLK_2828 ,0); 97 | spi_delay(); 98 | digitalWrite(CS_2828,1); 99 | spi_delay(); 100 | } 101 | //----------------------------------------------------------------------------- 102 | void SPI_3W_SET_PAs(uint16_t Sdata) 103 | { 104 | uint8_t i; 105 | digitalWrite(CS_2828,0); 106 | spi_delay(); 107 | digitalWrite(SDI_2828,1); 108 | spi_delay(); 109 | digitalWrite(SCLK_2828 ,0); 110 | spi_delay(); 111 | digitalWrite(SCLK_2828 ,1); 112 | spi_delay(); 113 | for(i=8; i>0; i--) 114 | { 115 | if(Sdata&0x80) 116 | digitalWrite(SDI_2828,1); 117 | else 118 | digitalWrite(SDI_2828,0); 119 | spi_delay(); 120 | digitalWrite(SCLK_2828 ,0); 121 | spi_delay(); 122 | digitalWrite(SCLK_2828 ,1); 123 | spi_delay(); 124 | Sdata <<= 1; 125 | } 126 | digitalWrite(SCLK_2828 ,0); 127 | spi_delay(); 128 | digitalWrite(CS_2828,1); 129 | spi_delay(); 130 | } 131 | //----------------------------------------------------------------------------- 132 | void SPI_WriteData(uint8_t value) 133 | { 134 | SPI_3W_SET_PAs(value); 135 | } 136 | //----------------------------------------------------------------------------- 137 | void SPI_WriteCmd(uint8_t value) 138 | { 139 | SPI_3W_SET_Cmd(value); 140 | } 141 | //----------------------------------------------------------------------------- 142 | void GP_COMMAD_PA(uint16_t num) 143 | { 144 | SPI_WriteCmd(0xbc); 145 | SPI_WriteData(num&0xff); 146 | SPI_WriteData((num>>8)&0xff); 147 | SPI_WriteCmd(0xbf); 148 | } 149 | //----------------------------------------------------------------------------- 150 | void SSD2828_initial(void) 151 | { 152 | SPI_WriteCmd(0xb7); 153 | SPI_WriteData(0x50); // 50=TX_CLK 70=PCLK 154 | SPI_WriteData(0x00); // Configuration Register 155 | 156 | SPI_WriteCmd(0xb8); 157 | SPI_WriteData(0x00); 158 | SPI_WriteData(0x00); // VC(Virtual ChannelID) Control Register 159 | 160 | SPI_WriteCmd(0xb9); 161 | SPI_WriteData(0x00); // 1=PLL disable 162 | SPI_WriteData(0x00); 163 | 164 | SPI_WriteCmd(0xBA); // PLL=(TX_CLK/MS)*NS 165 | SPI_WriteData(0x20); // 14,D7-0=NS(0x01 : NS=1) 166 | SPI_WriteData(0x82); // 42,D15-14=PLL00=62.5-125 01=126-250 10=251-500 11=501-1000 DB12-8=MS(01:MS=1) 167 | 168 | SPI_WriteCmd(0xBB); // LP Clock Divider LP clock = 400MHz / LPD / 8 = 480 / 8/ 8 = 7MHz 169 | SPI_WriteData(0x07); // D5-0=LPD=0x1 ¨C Divide by 2 170 | SPI_WriteData(0x00); 171 | 172 | SPI_WriteCmd(0xb9); 173 | SPI_WriteData(0x01); // 1=PLL disable 174 | SPI_WriteData(0x00); 175 | 176 | //MIPI lane configuration 177 | 178 | SPI_WriteCmd(0xDE); 179 | SPI_WriteData(0x00); // 11=4LANE 10=3LANE 01=2LANE 00=1LANE 180 | SPI_WriteData(0x00); 181 | 182 | SPI_WriteCmd(0xc9); 183 | SPI_WriteData(0x02); 184 | SPI_WriteData(0x23); // p1: HS-Data-zero p2: HS-Data- prepare --> 8031 issue 185 | 186 | delay(100); 187 | 188 | SPI_WriteCmd(0xCA); 189 | SPI_WriteData(0x01); // CLK Prepare 190 | SPI_WriteData(0x23); // Clk Zero 191 | 192 | SPI_WriteCmd(0xCB); // local_write_reg(addr=0xCB,data=0x0510) 193 | SPI_WriteData(0x10); // Clk Post 194 | SPI_WriteData(0x05); // Clk Per 195 | 196 | SPI_WriteCmd(0xCC); // local_write_reg(addr=0xCC,data=0x100A) 197 | SPI_WriteData(0x05); // HS Trail 198 | SPI_WriteData(0x10); // Clk Trail 199 | 200 | //LCD driver initialization 201 | 202 | SPI_WriteCmd(0xB7); 203 | SPI_WriteData(0x50); // 10=TX_CLK 30=PCLK 204 | SPI_WriteData(0x02); 205 | 206 | SPI_WriteCmd(0xBD); 207 | SPI_WriteData(0x00); 208 | SPI_WriteData(0x00); 209 | 210 | GP_COMMAD_PA(1); 211 | SPI_WriteData(0x10); 212 | 213 | 214 | GP_COMMAD_PA(2); 215 | SPI_WriteData(0xCD); 216 | SPI_WriteData(0xAA); 217 | 218 | GP_COMMAD_PA(2); 219 | SPI_WriteData(0x41); 220 | SPI_WriteData(0x34); 221 | 222 | GP_COMMAD_PA(2); 223 | SPI_WriteData(0x30); 224 | SPI_WriteData(0x00); 225 | 226 | GP_COMMAD_PA(2); 227 | SPI_WriteData(0x39); 228 | SPI_WriteData(0x11); 229 | 230 | GP_COMMAD_PA(2); 231 | SPI_WriteData(0x32); 232 | SPI_WriteData(0x00); 233 | 234 | GP_COMMAD_PA(2); 235 | SPI_WriteData(0x33); 236 | SPI_WriteData(0x38); 237 | 238 | GP_COMMAD_PA(2); 239 | SPI_WriteData(0x35); 240 | SPI_WriteData(0x24); 241 | 242 | GP_COMMAD_PA(2); 243 | SPI_WriteData(0x4F); 244 | SPI_WriteData(0x35); 245 | 246 | GP_COMMAD_PA(2); 247 | SPI_WriteData(0x4E); 248 | SPI_WriteData(0x27); 249 | 250 | GP_COMMAD_PA(2); 251 | SPI_WriteData(0x41); 252 | SPI_WriteData(0x56); 253 | 254 | GP_COMMAD_PA(9); 255 | SPI_WriteData(0x55); 256 | SPI_WriteData(0x00); 257 | SPI_WriteData(0x0F); 258 | SPI_WriteData(0x00); 259 | SPI_WriteData(0x0F); 260 | SPI_WriteData(0x00); 261 | SPI_WriteData(0x0F); 262 | SPI_WriteData(0x00); 263 | SPI_WriteData(0x0F); 264 | 265 | GP_COMMAD_PA(17); 266 | SPI_WriteData(0x56); 267 | SPI_WriteData(0x00); 268 | SPI_WriteData(0x0F); 269 | SPI_WriteData(0x00); 270 | SPI_WriteData(0x0F); 271 | SPI_WriteData(0x00); 272 | SPI_WriteData(0x0F); 273 | SPI_WriteData(0x00); 274 | SPI_WriteData(0x0F); 275 | SPI_WriteData(0x00); 276 | SPI_WriteData(0x0F); 277 | SPI_WriteData(0x00); 278 | SPI_WriteData(0x0F); 279 | SPI_WriteData(0x00); 280 | SPI_WriteData(0x0F); 281 | SPI_WriteData(0x00); 282 | SPI_WriteData(0x0F); 283 | 284 | GP_COMMAD_PA(2); 285 | SPI_WriteData(0x65); 286 | SPI_WriteData(0x08); 287 | 288 | GP_COMMAD_PA(2); 289 | SPI_WriteData(0x3A); 290 | SPI_WriteData(0x08); 291 | 292 | GP_COMMAD_PA(2); 293 | SPI_WriteData(0x36); 294 | SPI_WriteData(0x49); 295 | 296 | GP_COMMAD_PA(2); 297 | SPI_WriteData(0x67); 298 | SPI_WriteData(0x82); 299 | 300 | GP_COMMAD_PA(2); 301 | SPI_WriteData(0x69); 302 | SPI_WriteData(0x20); 303 | 304 | GP_COMMAD_PA(2); 305 | SPI_WriteData(0x6C); 306 | SPI_WriteData(0x80); 307 | 308 | GP_COMMAD_PA(2); 309 | SPI_WriteData(0x6D); 310 | SPI_WriteData(0x01); 311 | 312 | GP_COMMAD_PA(20); 313 | SPI_WriteData(0x53); 314 | SPI_WriteData(0x1F); 315 | SPI_WriteData(0x19); 316 | SPI_WriteData(0x15); 317 | SPI_WriteData(0x11); 318 | SPI_WriteData(0x11); 319 | SPI_WriteData(0x11); 320 | SPI_WriteData(0x12); 321 | SPI_WriteData(0x14); 322 | SPI_WriteData(0x15); 323 | SPI_WriteData(0x11); 324 | SPI_WriteData(0x0D); 325 | SPI_WriteData(0x0B); 326 | SPI_WriteData(0x0B); 327 | SPI_WriteData(0x0D); 328 | SPI_WriteData(0x0C); 329 | SPI_WriteData(0x0C); 330 | SPI_WriteData(0x08); 331 | SPI_WriteData(0x04); 332 | SPI_WriteData(0x00); 333 | 334 | GP_COMMAD_PA(20); 335 | SPI_WriteData(0x54); 336 | SPI_WriteData(0x1F); 337 | SPI_WriteData(0x19); 338 | SPI_WriteData(0x15); 339 | SPI_WriteData(0x11); 340 | SPI_WriteData(0x11); 341 | SPI_WriteData(0x11); 342 | SPI_WriteData(0x13); 343 | SPI_WriteData(0x15); 344 | SPI_WriteData(0x16); 345 | SPI_WriteData(0x11); 346 | SPI_WriteData(0x0D); 347 | SPI_WriteData(0x0C); 348 | SPI_WriteData(0x0C); 349 | SPI_WriteData(0x0E); 350 | SPI_WriteData(0x0C); 351 | SPI_WriteData(0x0C); 352 | SPI_WriteData(0x08); 353 | SPI_WriteData(0x04); 354 | SPI_WriteData(0x00); 355 | 356 | GP_COMMAD_PA(2); 357 | SPI_WriteData(0x6B); 358 | SPI_WriteData(0x00); 359 | 360 | GP_COMMAD_PA(2); 361 | SPI_WriteData(0x58); 362 | SPI_WriteData(0x00); 363 | 364 | GP_COMMAD_PA(2); 365 | SPI_WriteData(0x73); 366 | SPI_WriteData(0xF0); 367 | 368 | GP_COMMAD_PA(2); 369 | SPI_WriteData(0x76); 370 | SPI_WriteData(0x40); 371 | 372 | GP_COMMAD_PA(2); 373 | SPI_WriteData(0x77); 374 | SPI_WriteData(0x04); 375 | 376 | GP_COMMAD_PA(2); 377 | SPI_WriteData(0x74); 378 | SPI_WriteData(0x17); 379 | 380 | GP_COMMAD_PA(2); 381 | SPI_WriteData(0x5E); 382 | SPI_WriteData(0x03); 383 | 384 | GP_COMMAD_PA(2); 385 | SPI_WriteData(0x68); 386 | SPI_WriteData(0x10); 387 | 388 | GP_COMMAD_PA(2); 389 | SPI_WriteData(0x6A); 390 | SPI_WriteData(0x00); 391 | 392 | GP_COMMAD_PA(2); 393 | SPI_WriteData(0x28); 394 | SPI_WriteData(0x31); 395 | 396 | GP_COMMAD_PA(2); 397 | SPI_WriteData(0x29); 398 | SPI_WriteData(0x21); 399 | 400 | GP_COMMAD_PA(2); 401 | SPI_WriteData(0x63); 402 | SPI_WriteData(0x04); 403 | 404 | GP_COMMAD_PA(2); 405 | SPI_WriteData(0x27); 406 | SPI_WriteData(0x00); 407 | 408 | GP_COMMAD_PA(2); 409 | SPI_WriteData(0x7C); 410 | SPI_WriteData(0x80); 411 | 412 | GP_COMMAD_PA(2); 413 | SPI_WriteData(0x2E); 414 | SPI_WriteData(0x05); 415 | 416 | GP_COMMAD_PA(2); 417 | SPI_WriteData(0x4C); 418 | SPI_WriteData(0x80); 419 | 420 | GP_COMMAD_PA(2); 421 | SPI_WriteData(0x50); 422 | SPI_WriteData(0xC0); 423 | 424 | GP_COMMAD_PA(2); 425 | SPI_WriteData(0x78); 426 | SPI_WriteData(0x6E); 427 | 428 | GP_COMMAD_PA(2); 429 | SPI_WriteData(0x2D); 430 | SPI_WriteData(0x31); 431 | 432 | GP_COMMAD_PA(2); 433 | SPI_WriteData(0x49); 434 | SPI_WriteData(0x00); 435 | 436 | GP_COMMAD_PA(2); 437 | SPI_WriteData(0x4D); 438 | SPI_WriteData(0x00); 439 | 440 | GP_COMMAD_PA(1); 441 | SPI_WriteData(0x11); 442 | delay(120); 443 | GP_COMMAD_PA(1); 444 | SPI_WriteData(0x29); 445 | delay(120); 446 | 447 | SPI_WriteCmd(0xb7); 448 | SPI_WriteData(0x50); 449 | SPI_WriteData(0x00); // Configuration Register 450 | 451 | SPI_WriteCmd(0xb8); 452 | SPI_WriteData(0x00); 453 | SPI_WriteData(0x00); // VC(Virtual ChannelID) Control Register 454 | 455 | SPI_WriteCmd(0xb9); 456 | SPI_WriteData(0x00); // 1=PLL disable 457 | SPI_WriteData(0x00); 458 | 459 | SPI_WriteCmd(0xBA); 460 | SPI_WriteData(0x20); // 14,D7-0=NS(0x01 : NS=1) 461 | SPI_WriteData(0x82); // 42,D15-14=PLL00=62.5-125 01=126-250 10=251-500 11=501-1000 DB12-8=MS(01:MS=1) 462 | 463 | SPI_WriteCmd(0xBB); // LP Clock Divider LP clock = 400MHz / LPD / 8 = 480 / 8/ 8 = 7MHz 464 | SPI_WriteData(0x07); // D5-0=LPD=0x1 ¨C Divide by 2 465 | SPI_WriteData(0x00); 466 | 467 | SPI_WriteCmd(0xb9); 468 | SPI_WriteData(0x01); // 1=PLL disable 469 | SPI_WriteData(0x00); 470 | 471 | SPI_WriteCmd(0xc9); 472 | SPI_WriteData(0x02); 473 | SPI_WriteData(0x23); // p1: HS-Data-zero p2: HS-Data- prepare --> 8031 issue 474 | delay(100); 475 | 476 | SPI_WriteCmd(0xCA); 477 | SPI_WriteData(0x01); // CLK Prepare 478 | SPI_WriteData(0x23); // Clk Zero 479 | 480 | SPI_WriteCmd(0xCB); // local_write_reg(addr=0xCB,data=0x0510) 481 | SPI_WriteData(0x10); // Clk Post 482 | SPI_WriteData(0x05); // Clk Per 483 | 484 | SPI_WriteCmd(0xCC); // local_write_reg(addr=0xCC,data=0x100A) 485 | SPI_WriteData(0x05); // HS Trail 486 | SPI_WriteData(0x10); // Clk Trail 487 | 488 | SPI_WriteCmd(0xD0); 489 | SPI_WriteData(0x00); 490 | SPI_WriteData(0x00); 491 | 492 | //RGB interface configuration 493 | 494 | SPI_WriteCmd(0xB1); 495 | SPI_WriteData(0x18); // HSPW 07 496 | SPI_WriteData(0x02); // VSPW 05 497 | 498 | SPI_WriteCmd(0xB2); 499 | SPI_WriteData(0xa0); // HBPD 0x64=100 500 | SPI_WriteData(0x0a); // VBPD 8 ¼õСÏÂÒÆ 501 | 502 | SPI_WriteCmd(0xB3); 503 | SPI_WriteData(0xa0); // HFPD 8 504 | SPI_WriteData(0x0c); // VFPD 10 505 | 506 | SPI_WriteCmd(0xB4); // Horizontal active period 720=02D0 507 | SPI_WriteData(0x90); // 013F=319 02D0=720 508 | SPI_WriteData(0x01); 509 | 510 | SPI_WriteCmd(0xB5); // Vertical active period 1280=0500 511 | SPI_WriteData(0x00); // 01DF=479 0500=1280 512 | SPI_WriteData(0x05); 513 | 514 | 515 | SPI_WriteCmd(0xB6); // RGB CLK 16BPP=00 18BPP=01 516 | SPI_WriteData(0x0b); // D7=0 D6=0 D5=0 D1-0=11 ¨C 24bpp //07 517 | SPI_WriteData(0x00); // D15=VS D14=HS D13=CLK D12-9=NC D8=0=Video with blanking packet. 00-F0 518 | 519 | //MIPI lane configuration 520 | 521 | SPI_WriteCmd(0xDE); 522 | SPI_WriteData(0x03); // 11=4LANE 10=3LANE 01=2LANE 00=1LANE 523 | SPI_WriteData(0x00); 524 | 525 | SPI_WriteCmd(0xD6); // 05=BGR 04=RGB 526 | SPI_WriteData(0x05); // D0=0=RGB 1:BGR D1=1=Most significant byte sent first 527 | SPI_WriteData(0x00); 528 | 529 | SPI_WriteCmd(0xDB); 530 | SPI_WriteData(0x58); 531 | SPI_WriteData(0x00); 532 | 533 | 534 | SPI_WriteCmd(0xB7); 535 | SPI_WriteData(0x6B); 536 | SPI_WriteData(0x02); 537 | 538 | } 539 | 540 | /////////////////////////////////////////////////////////////////////////////// 541 | /////////////////////////////////////////////////////////////////////////////// 542 | 543 | 544 | -------------------------------------------------------------------------------- /src/touch.cpp: -------------------------------------------------------------------------------- 1 | #include "ER-TFTM0784-1.h" 2 | 3 | _ts_event ts_event; 4 | 5 | inline void i2c_pause(void) 6 | { 7 | asm("nop;nop;nop;nop;nop;nop;nop;nop;"); 8 | asm("nop;nop;nop;nop;nop;nop;nop;nop;"); 9 | asm("nop;nop;nop;nop;nop;nop;nop;nop;"); 10 | asm("nop;nop;nop;nop;nop;nop;nop;nop;"); 11 | asm("nop;nop;nop;nop;nop;nop;nop;nop;"); 12 | asm("nop;nop;nop;nop;nop;nop;nop;nop;"); 13 | asm("nop;nop;nop;nop;nop;nop;nop;nop;"); 14 | asm("nop;nop;nop;nop;nop;nop;nop;nop;"); 15 | } 16 | 17 | //IIC start 18 | void TOUCH_Start(void) 19 | { 20 | digitalWrite(SDA_911, 1); 21 | i2c_pause(); 22 | digitalWrite(SCL_911, 1); 23 | delayMicroseconds(3); 24 | digitalWrite(SDA_911, 0); 25 | delayMicroseconds(3); 26 | digitalWrite(SCL_911, 0); 27 | // delayMicroseconds(1); 28 | } 29 | 30 | 31 | //IIC stop 32 | void TOUCH_Stop(void) 33 | { 34 | digitalWrite(SDA_911, 0); 35 | i2c_pause(); 36 | digitalWrite(SCL_911, 1); 37 | delayMicroseconds(3); 38 | digitalWrite(SDA_911, 1); 39 | delayMicroseconds(3); 40 | digitalWrite(SCL_911, 0); 41 | // delayMicroseconds(1); 42 | } 43 | 44 | 45 | //Wait for an answer signal 46 | uint8_t TOUCH_Wait_Ack(void) 47 | { uint8_t errtime=0; 48 | 49 | digitalWrite(SDA_911, 1); 50 | // delayMicroseconds(1); 51 | digitalWrite(SCL_911, 1); 52 | // delayMicroseconds(1); 53 | while(digitalRead(SDA_911)) 54 | { 55 | errtime++; 56 | if(errtime>250) 57 | { 58 | TOUCH_Stop(); 59 | return 1; 60 | } 61 | ; 62 | } 63 | digitalWrite(SCL_911, 0); 64 | // delayMicroseconds(1); 65 | return 0; 66 | } 67 | 68 | 69 | 70 | //Acknowledge 71 | void TOUCH_Ack(void) 72 | { digitalWrite(SCL_911, 0); 73 | i2c_pause(); 74 | digitalWrite(SDA_911, 0); 75 | delayMicroseconds(2); 76 | digitalWrite(SCL_911, 1); 77 | delayMicroseconds(2); 78 | digitalWrite(SCL_911, 0); 79 | i2c_pause(); 80 | } 81 | 82 | 83 | 84 | //NO Acknowledge 85 | void TOUCH_NAck(void) 86 | { digitalWrite(SCL_911, 0); 87 | delayMicroseconds(1); 88 | digitalWrite(SDA_911, 1); 89 | delayMicroseconds(2); 90 | digitalWrite(SCL_911, 1); 91 | delayMicroseconds(2); 92 | digitalWrite(SCL_911, 0); 93 | i2c_pause(); 94 | } 95 | 96 | 97 | //IIC send one byte 98 | void TOUCH_Send_Byte(uint8_t Byte) 99 | { uint8_t t; 100 | digitalWrite(SCL_911, 0); 101 | // delayus(5); 102 | for(t=0;t<8;t++) 103 | { 104 | digitalWrite(SDA_911,(Byte & 0x80)!=0) ; 105 | Byte <<=1; 106 | delayMicroseconds(2); 107 | digitalWrite(SCL_911, 1); 108 | delayMicroseconds(2); 109 | digitalWrite(SCL_911, 0); 110 | // delayus(5); 111 | } 112 | 113 | } 114 | 115 | //Read one byte£¬ack=0£¬Send Acknowledge£¬ack=1£¬NO Acknowledge 116 | uint8_t TOUCH_Read_Byte(uint8_t ack) 117 | { uint8_t t,receive=0; 118 | 119 | digitalWrite(SCL_911, 0); 120 | // delayus(5); 121 | digitalWrite(SDA_911, 1); 122 | // delayus(5); 123 | for(t = 0; t < 8; t++) 124 | { i2c_pause(); 125 | digitalWrite(SCL_911, 0); 126 | delayMicroseconds(4); 127 | digitalWrite(SCL_911, 1); 128 | delayMicroseconds(4); 129 | receive<<=1; 130 | if(digitalRead(SDA_911)) 131 | receive=receive|0x01; 132 | // delayus(5); 133 | } 134 | 135 | 136 | if (ack) TOUCH_NAck();//NO Acknowledge 137 | else TOUCH_Ack(); //Send Acknowledge 138 | 139 | return receive; 140 | } 141 | 142 | uint8_t GT911_WR_Reg(uint16_t reg,uint8_t *buf,uint8_t len) 143 | { 144 | uint8_t i; 145 | uint8_t ret=0; 146 | TOUCH_Start(); 147 | TOUCH_Send_Byte(WRITE_ADD); //·¢ËÍдÃüÁî 148 | TOUCH_Wait_Ack(); 149 | TOUCH_Send_Byte(reg>>8); //·¢Ë͸ß8λµØÖ· 150 | TOUCH_Wait_Ack(); 151 | TOUCH_Send_Byte(reg&0xFF); //·¢Ë͵Í8λµØÖ· 152 | TOUCH_Wait_Ack(); 153 | for(i=0;i>8); //·¢Ë͸ß8λµØÖ· 171 | TOUCH_Wait_Ack(); 172 | TOUCH_Send_Byte(reg&0xFF); //·¢Ë͵Í8λµØÖ· 173 | TOUCH_Wait_Ack(); 174 | 175 | TOUCH_Start(); 176 | TOUCH_Send_Byte(READ_ADD); //·¢ËͶÁÃüÁî 177 | TOUCH_Wait_Ack(); 178 | for(i=0;i5&&ts_event.y1<=1280&&ts_event.y1>1230)return; 453 | if(ts_event.x1>=365&&ts_event.y1>=1215) 454 | { 455 | Select_Main_Window_16bpp(); 456 | Main_Image_Start_Address(0); 457 | Main_Image_Width(400); 458 | Main_Window_Start_XY(0,0); 459 | 460 | Canvas_Image_Start_address(0);//Layer 1 461 | Canvas_image_width(400);// 462 | Active_Window_XY(0,0); 463 | Active_Window_WH(400,1280); 464 | 465 | Foreground_color_65k(Black); 466 | Line_Start_XY(0,0); 467 | Line_End_XY(399,1279); 468 | Start_Square_Fill(); 469 | 470 | Foreground_color_65k(Black); 471 | Background_color_65k(Blue2); 472 | CGROM_Select_Internal_CGROM(); 473 | Font_Select_12x24_24x24(); 474 | Goto_Text_XY(0,450); 475 | Show_String("www.buydisplay.ocm CTP test"); 476 | 477 | Goto_Text_XY(0,1230); 478 | Show_String("exit"); 479 | Goto_Text_XY(376,1215); 480 | Show_String("clear"); 481 | } 482 | 483 | else{ 484 | 485 | inttostr(ts_event.x1,ss); 486 | 487 | 488 | Goto_Text_XY(100,465); //Set the display position 489 | 490 | Show_String("X="); 491 | Text_Mode(); 492 | LCD_CmdWrite(0x04); 493 | LCD_DataWrite(ss[0]); 494 | Check_Mem_WR_FIFO_not_Full(); 495 | LCD_DataWrite(ss[1]); 496 | Check_Mem_WR_FIFO_not_Full(); 497 | LCD_DataWrite(ss[2]); 498 | Check_Mem_WR_FIFO_not_Full(); 499 | LCD_DataWrite(ss[3]); 500 | Check_Mem_WR_FIFO_not_Full(); 501 | 502 | inttostr(ts_event.y1,ss); 503 | Goto_Text_XY(130, 465); //Set the display position 504 | 505 | Show_String("Y="); 506 | Text_Mode(); 507 | LCD_CmdWrite(0x04); 508 | LCD_DataWrite(ss[0]); 509 | Check_Mem_WR_FIFO_not_Full(); 510 | LCD_DataWrite(ss[1]); 511 | Check_Mem_WR_FIFO_not_Full(); 512 | LCD_DataWrite(ss[2]); 513 | Check_Mem_WR_FIFO_not_Full(); 514 | LCD_DataWrite(ss[3]); 515 | Check_Mem_WR_FIFO_not_Full(); 516 | 517 | 518 | 519 | Draw_Big_Point(ts_event.x1,ts_event.y1,color65k_red); 520 | Draw_Big_Point(ts_event.x2,ts_event.y2,color65k_green); 521 | Draw_Big_Point(ts_event.x3,ts_event.y3,color65k_blue); 522 | Draw_Big_Point(ts_event.x4,ts_event.y4,color65k_cyan); 523 | Draw_Big_Point(ts_event.x5,ts_event.y5,color65k_purple); 524 | 525 | 526 | 527 | 528 | } 529 | 530 | ts_event.x1=0; 531 | ts_event.y1=0; 532 | ts_event.x2=0; 533 | ts_event.y2=0; 534 | ts_event.x3=0; 535 | ts_event.y3=0; 536 | ts_event.x4=0; 537 | ts_event.y4=0; 538 | ts_event.x5=0; 539 | ts_event.y5=0; 540 | 541 | 542 | } 543 | 544 | 545 | } 546 | 547 | // Font_0_degree(); 548 | // VSCAN_T_to_B(); 549 | 550 | } 551 | -------------------------------------------------------------------------------- /examples/demo/demo.ino: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // ER-TFTM0784-1 7.84 INCH TFT LCD 1280*400 ( RA8876 + SSD2828 + GT911 ) 4 | // 5 | // 2020-04-14 : Ported to Arduino by Craig Iannello 6 | // Original by Javen Liu (Original heading next section) 7 | // 8 | // The demo code is pretty much verbatim of Javen's original. 9 | // 10 | // Devices accessed and pin usage: 11 | // 12 | // CHIP PURPOSE INTERFACE 13 | // RA8876 Graphics Driver SPI 4-Wire OR 8/16 bit Parallel 14 | // GT911 Touch I2C + Interrupt flag output 15 | // SSD2828 MIPI bridge SPI 4-Wire 16 | // 17 | // Note the two seperate SPI's. I read that the RA8876 doesn't properly 18 | // tri-state (release) the bus while it's unselected. I was too lazy to test 19 | // that, and just left the SSD2828 as software serial on some pins, 20 | // and hooked the HW SPI up to the RA8876. The 2828 only needs to be spoken 21 | // to on powerup and doesnt need to be fast. 22 | // 23 | // The touch panel code has been left as bit-bang too out of laziness. 24 | // 25 | /////////////////////////////////////////////////////////////////////////////// 26 | // 27 | // EASTRISING TECHNOLOGY CO,.LTD. 28 | // 29 | // Module : ER-TFTM0784-1 7.84 INCH TFT LCD 1280*400 30 | // Lanuage : C++ 31 | // Create : JAVEN LIU 32 | // Date : 2018-12-23 33 | // Drive IC : RA8876 FLASH:W25Q128FV 128M BIT FONT CHIP: 30L24T3Y CTP:GT911 34 | // INTERFACE : 16BIT 8080 CTP:IIC SSD2828: 3SPI 35 | // MCU : STC12LE5C60S2 1T MCU 36 | // MCU VDD : 3.3V 37 | // MODULE VDD : 5V OR 3.3V 38 | // 39 | /////////////////////////////////////////////////////////////////////////////// 40 | 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | 48 | #include "demo.h" 49 | 50 | //----------------------------------------------------------------------------- 51 | // the following global variables are declared as externs in the library and 52 | // are defined below. Sorry, this is probably poor style. 53 | //----------------------------------------------------------------------------- 54 | 55 | //----------------------------------------------------------------------------- 56 | // Setup communications method for RA8876 display controller 57 | //----------------------------------------------------------------------------- 58 | 59 | uint8_t mode_8876 = 2; // 0: Parallel 16 bits 8080 60 | // 1: Parallel 8 bits 8080 61 | // 2: SPI 4-Wire 62 | 63 | //----------------------------------------------------------------------------- 64 | // pins for display controller used in all modes 65 | //----------------------------------------------------------------------------- 66 | 67 | uint8_t RST_8876 = 34; 68 | 69 | //----------------------------------------------------------------------------- 70 | // pins for display controller only when in 4-wire SPI mode (mode 2) 71 | //----------------------------------------------------------------------------- 72 | 73 | uint32_t SPI_SPEED_8876 = 42000000; 74 | 75 | uint8_t CS_SER_8876 = 10; 76 | uint8_t SDI_8876 = 109; 77 | uint8_t SDO_8876 = 108; 78 | uint8_t SCLK_8876 = 110; 79 | 80 | //----------------------------------------------------------------------------- 81 | // pins for display controller only when in 8/16-Bit parallel mode (modes 0,1) 82 | // 83 | // (all of these are unused when in mode 2 but must be declared anyway) 84 | // 85 | // The parallel code in the Library is very much degraded from Javen's 86 | // original because I don't know a portable way of using IO lines in parallel 87 | // in Arduino, e.g. 88 | // 89 | // PORTA = 0xff 90 | // foo = PORTB; 91 | // 92 | // I'm ashamedly doing it bit-wise. 93 | // 94 | //----------------------------------------------------------------------------- 95 | 96 | uint8_t RS_8876 = 33; 97 | uint8_t CS_PAR_8876 = 34; 98 | uint8_t WR_8876 = 35; 99 | uint8_t RD_8876 = 36; 100 | uint8_t NEXT_8876 = 37; 101 | uint8_t D0 = 38; 102 | uint8_t D1 = 39; 103 | uint8_t D2 = 40; 104 | uint8_t D3 = 41; 105 | uint8_t D4 = 42; 106 | uint8_t D5 = 43; 107 | uint8_t D6 = 44; 108 | uint8_t D7 = 45; 109 | uint8_t D8 = 46; 110 | uint8_t D9 = 47; 111 | uint8_t D10 = 48; 112 | uint8_t D11 = 49; 113 | uint8_t D12 = 50; 114 | uint8_t D13 = 51; 115 | uint8_t D14 = 52; 116 | uint8_t D15 = 53; 117 | 118 | //----------------------------------------------------------------------------- 119 | // SPI pins for the 2828 LCD panel driver (used in all modes) 120 | // 121 | // No attempt was made to share this SPI with the RA8876 SPI because I read 122 | // that there are problems with the RA8876 not properly 123 | // tri-stating (disconnecting) its bus pins when it is not selected. 124 | // 125 | // Note that this interface is only used once on powerup to setup the panel 126 | // driver, so it doesnt need to be fast. It uses software (bit bang) SPI. 127 | //----------------------------------------------------------------------------- 128 | 129 | uint8_t CS_2828 = 24; 130 | uint8_t RST_2828 = 25; 131 | uint8_t SDI_2828 = 26; 132 | uint8_t SCLK_2828 = 27; 133 | 134 | //----------------------------------------------------------------------------- 135 | // I2C pins for GT911 touch controller (used in all modes) 136 | // 137 | // This one is also implemented as bit-bang. Thanks, Javen! 138 | //----------------------------------------------------------------------------- 139 | 140 | uint8_t SDA_911 = 28; 141 | uint8_t SCL_911 = 29; 142 | uint8_t PEN_911 = 30; 143 | uint8_t RESET_911 = 31; 144 | 145 | //----------------------------------------------------------------------------- 146 | // The demo code is pretty much verbatim of Javen's original. 147 | //----------------------------------------------------------------------------- 148 | void setup(void) 149 | { 150 | Serial.begin(9600); 151 | Serial.println("Starting in one second..."); 152 | delay(1000); 153 | Serial.println("Starting."); 154 | Serial.println("GT911 touch init"); 155 | TOUCH_Init(); 156 | Serial.println("SSD2828 reset"); 157 | SSD2828_Reset(); 158 | Serial.println("RA8876 IO init"); 159 | RA8876_IO_Init(); 160 | Serial.println("RA8876 HW reset"); 161 | RA8876_HW_Reset(); 162 | Serial.println("SSD2828 init"); 163 | SSD2828_initial(); 164 | Serial.println("RA8876 init"); 165 | RA8876_initial(); 166 | Serial.println("Display ON"); 167 | Display_ON(); 168 | /* Select_Main_Window_16bpp(); 169 | Main_Image_Start_Address(layer1_start_addr); 170 | Main_Image_Width(400); 171 | Main_Window_Start_XY(0,0); 172 | Foreground_color_65k(White); 173 | Line_Start_XY(0,0); 174 | Line_End_XY(399,1279); 175 | Start_Square_Fill(); */ 176 | } 177 | //----------------------------------------------------------------------------- 178 | void loop(void) 179 | { 180 | 181 | // BackLight brightness control : RA8876's PWM0 182 | Serial.println("RA8876 init backlight pwm"); 183 | Enable_PWM0_Interrupt(); 184 | Clear_PWM0_Interrupt_Flag(); 185 | Mask_PWM0_Interrupt_Flag(); 186 | Select_PWM0_Clock_Divided_By_2(); 187 | Select_PWM0(); 188 | Enable_PWM0_Dead_Zone(); 189 | Auto_Reload_PWM0(); 190 | Start_PWM0(); 191 | Set_Timer0_Compare_Buffer(0xffff); 192 | 193 | //Serial.println("TpTest"); 194 | //TPTEST(); 195 | Serial.println("Geometric"); 196 | Geometric(); 197 | Serial.println("Text"); 198 | Text_Demo(); 199 | Serial.println("Mono"); 200 | mono_Demo(); 201 | Serial.println("Gray"); 202 | gray(); 203 | Serial.println("DMA"); 204 | DMA_Demo(); 205 | Serial.println("Pattern fill"); 206 | BTE_Pattern_Fill(); 207 | Serial.println("Color expansion"); 208 | BTE_Color_Expansion(); 209 | Serial.println("Waveform"); 210 | App_Demo_Waveform(); 211 | Serial.println("Scroller"); 212 | App_Demo_Scrolling_Text(); 213 | Serial.println("Slide frame buffer"); 214 | App_Demo_slide_frame_buffer(); 215 | Serial.println("Multi frame buffer"); 216 | App_Demo_multi_frame_buffer(); 217 | } 218 | //----------------------------------------------------------------------------- 219 | void NextStep(void) 220 | { 221 | delay(500); 222 | /* 223 | while(next) 224 | { 225 | Delay100ms(1); 226 | } 227 | Delay100ms(10); 228 | */ 229 | } 230 | //----------------------------------------------------------------------------- 231 | void BTE_Color_Expansion(void) 232 | { 233 | uint16_t i,j; 234 | uint32_t im=1; 235 | 236 | Select_Main_Window_16bpp(); 237 | Main_Image_Start_Address(0); 238 | Main_Image_Width(400); 239 | Main_Window_Start_XY(0,0); 240 | 241 | /* Canvas_Image_Start_address(layer1_start_addr);//Layer 1 242 | Canvas_image_width(400);// 243 | Active_Window_XY(0,0); 244 | Active_Window_WH(400,1280); 245 | 246 | Foreground_color_65k(Black); 247 | Line_Start_XY(0,0); 248 | Line_End_XY(399,1279); 249 | Start_Square_Fill(); 250 | 251 | 252 | 253 | //DMA initial setting 254 | Enable_SFlash_SPI(); 255 | Select_SFI_1(); 256 | Select_SFI_DMA_Mode(); 257 | Select_SFI_24bit_Address(); 258 | 259 | //Select_SFI_Waveform_Mode_0(); 260 | Select_SFI_Waveform_Mode_3(); 261 | 262 | //Select_SFI_0_DummyRead(); //normal read mode 263 | Select_SFI_8_DummyRead(); //1byte dummy cycle 264 | //Select_SFI_16_DummyRead(); 265 | //Select_SFI_24_DummyRead(); 266 | 267 | Select_SFI_Single_Mode(); 268 | //Select_SFI_Dual_Mode0(); 269 | //Select_SFI_Dual_Mode1(); 270 | 271 | SPI_Clock_Period(0); 272 | 273 | 274 | SFI_DMA_Destination_Upper_Left_Corner(0,0); 275 | SFI_DMA_Transfer_Width_Height(400,1280); 276 | SFI_DMA_Source_Width(400);// 277 | 278 | SFI_DMA_Source_Start_Address(im*400*1280*3);// 279 | Start_SFI_DMA(); 280 | Check_Busy_SFI_DMA(); */ 281 | 282 | 283 | 284 | //color expansion and bte memory copy(move) 285 | 286 | j=0; 287 | do 288 | { 289 | for(i=0;i<3;i++) 290 | { 291 | //switch to layer2 update screen, and execute color expansion and copy to layer1 292 | Canvas_Image_Start_address(layer2_start_addr);// 293 | Foreground_color_65k(Black); 294 | Line_Start_XY(0,0); 295 | Line_End_XY(399,1279); 296 | Start_Square_Fill(); 297 | SFI_DMA_Source_Start_Address(0);// 298 | Start_SFI_DMA(); 299 | Check_Busy_SFI_DMA(); 300 | 301 | BTE_S0_Color_16bpp(); 302 | 303 | BTE_S1_Color_16bpp(); 304 | 305 | BTE_Destination_Color_16bpp(); 306 | BTE_Destination_Memory_Start_Address(layer2_start_addr); 307 | BTE_Destination_Image_Width(400); 308 | BTE_Destination_Window_Start_XY(0+70,0+70); 309 | BTE_Window_Size(160,160); 310 | Foreground_color_65k(color65k_blue); 311 | Background_color_65k(color65k_red); 312 | BTE_ROP_Code(15); 313 | BTE_Operation_Code(8); //BTE color expansion 314 | 315 | BTE_Enable(); 316 | LCD_CmdWrite(0x04); 317 | 318 | switch(i) 319 | { 320 | case 0 : 321 | Show_picture(10*160,f1); 322 | Check_Mem_WR_FIFO_Empty(); 323 | Check_BTE_Busy(); 324 | break; 325 | case 1 : 326 | Show_picture(10*160,f2); 327 | Check_Mem_WR_FIFO_Empty(); 328 | Check_BTE_Busy(); 329 | break; 330 | case 2 : 331 | Show_picture(10*160,f3); 332 | Check_Mem_WR_FIFO_Empty(); 333 | Check_BTE_Busy(); 334 | break; 335 | default: 336 | break; 337 | } 338 | 339 | 340 | Foreground_color_65k(White); 341 | Background_color_65k(Black); 342 | CGROM_Select_Internal_CGROM(); 343 | Font_Select_12x24_24x24(); 344 | Goto_Text_XY(274,70); 345 | Show_String("Color Expansion"); 346 | 347 | 348 | 349 | Foreground_color_65k(color65k_blue); 350 | Background_color_65k(color65k_red); 351 | 352 | BTE_Operation_Code(9); //BTE color expansion with chroma key 353 | BTE_Destination_Window_Start_XY(70,460); 354 | BTE_Enable(); 355 | LCD_CmdWrite(0x04); 356 | 357 | switch(i) 358 | { 359 | case 0 : 360 | Show_picture(10*160,f1); 361 | Check_Mem_WR_FIFO_Empty(); 362 | Check_BTE_Busy(); 363 | break; 364 | case 1 : 365 | Show_picture(10*160,f2); 366 | Check_Mem_WR_FIFO_Empty(); 367 | Check_BTE_Busy(); 368 | break; 369 | case 2 : 370 | Show_picture(10*160,f3); 371 | Check_Mem_WR_FIFO_Empty(); 372 | Check_BTE_Busy(); 373 | break; 374 | default: 375 | break; 376 | } 377 | 378 | 379 | Foreground_color_65k(White); 380 | Background_color_65k(Black); 381 | CGROM_Select_Internal_CGROM(); 382 | Font_Select_12x24_24x24(); 383 | Goto_Text_XY(250,450); 384 | Show_String("Color Expansion"); 385 | Goto_Text_XY(274,450); 386 | Show_String("Color With chroma key"); 387 | 388 | Foreground_color_65k(color65k_blue); 389 | Background_color_65k(color65k_red); 390 | 391 | //BTE memory(move) layer2 to layer1 392 | //BTE_S0_Color_16bpp(); 393 | BTE_S0_Memory_Start_Address(layer2_start_addr); 394 | BTE_S0_Image_Width(400); 395 | BTE_S0_Window_Start_XY(0,0); 396 | 397 | //BTE_Destination_Color_16bpp(); 398 | BTE_Destination_Memory_Start_Address(layer1_start_addr); 399 | BTE_Destination_Image_Width(400); 400 | BTE_Destination_Window_Start_XY(0,0); 401 | BTE_Window_Size(400,1280); 402 | 403 | BTE_ROP_Code(12); 404 | BTE_Operation_Code(2); //BTE move 405 | BTE_Enable(); //memory copy s0(layer2) to layer1 406 | Check_BTE_Busy(); 407 | 408 | 409 | j++; 410 | } 411 | 412 | }while(j<8); 413 | 414 | NextStep(); 415 | 416 | } 417 | //----------------------------------------------------------------------------- 418 | void BTE_Pattern_Fill(void) 419 | { uint32_t im=1; 420 | 421 | Select_Main_Window_16bpp(); 422 | Main_Image_Start_Address(0); 423 | Main_Image_Width(400); 424 | Main_Window_Start_XY(0,0); 425 | 426 | Canvas_Image_Start_address(0);//Layer 1 427 | Canvas_image_width(400);// 428 | Active_Window_XY(0,0); 429 | Active_Window_WH(400,1280); 430 | 431 | Foreground_color_65k(Black); 432 | Line_Start_XY(0,0); 433 | Line_End_XY(399,1279); 434 | Start_Square_Fill(); 435 | 436 | 437 | 438 | Foreground_color_65k(White); 439 | Background_color_65k(Blue2); 440 | CGROM_Select_Internal_CGROM(); 441 | Font_Select_12x24_24x24(); 442 | Goto_Text_XY(0,800); 443 | Show_String("Demo BTE Pattern Fill"); 444 | 445 | 446 | //DMA initial setting 447 | Enable_SFlash_SPI(); 448 | Select_SFI_1(); 449 | Select_SFI_DMA_Mode(); 450 | Select_SFI_24bit_Address(); 451 | 452 | //Select_SFI_Waveform_Mode_0(); 453 | Select_SFI_Waveform_Mode_3(); 454 | 455 | //Select_SFI_0_DummyRead(); //normal read mode 456 | Select_SFI_8_DummyRead(); //1byte dummy cycle 457 | //Select_SFI_16_DummyRead(); 458 | //Select_SFI_24_DummyRead(); 459 | 460 | Select_SFI_Single_Mode(); 461 | //Select_SFI_Dual_Mode0(); 462 | //Select_SFI_Dual_Mode1(); 463 | 464 | SPI_Clock_Period(0); 465 | 466 | 467 | SFI_DMA_Destination_Upper_Left_Corner(0,0); 468 | SFI_DMA_Transfer_Width_Height(400,1280); 469 | SFI_DMA_Source_Width(400);// 470 | 471 | SFI_DMA_Source_Start_Address(im*400*1280*2*1);// 472 | Start_SFI_DMA(); 473 | Check_Busy_SFI_DMA(); 474 | 475 | 476 | //write 16x16 pattern to sdram 477 | Pattern_Format_16X16(); 478 | Canvas_Image_Start_address(layer6_start_addr);//any layer 479 | Canvas_image_width(16); 480 | Active_Window_XY(0,0); 481 | Active_Window_WH(16,16); 482 | Goto_Pixel_XY(0,0); 483 | Show_picture(16*16,pattern16x16_16bpp); 484 | 485 | Canvas_Image_Start_address(layer1_start_addr);// 486 | Canvas_image_width(400); 487 | Active_Window_XY(0,0); 488 | Active_Window_WH(400,1280); 489 | 490 | 491 | BTE_S0_Color_16bpp(); 492 | BTE_S0_Memory_Start_Address(layer6_start_addr); 493 | BTE_S0_Image_Width(16); 494 | 495 | BTE_S1_Color_16bpp(); 496 | BTE_S1_Memory_Start_Address(0); 497 | BTE_S1_Image_Width(400); 498 | 499 | BTE_Destination_Color_16bpp(); 500 | BTE_Destination_Memory_Start_Address(layer1_start_addr); 501 | BTE_Destination_Image_Width(400); 502 | 503 | BTE_ROP_Code(0xc); 504 | BTE_Operation_Code(0x06);//pattern fill 505 | 506 | BTE_S1_Window_Start_XY(0,0); 507 | BTE_Destination_Window_Start_XY(0,40); 508 | BTE_Window_Size(300,300); 509 | 510 | BTE_Enable(); 511 | Check_BTE_Busy(); 512 | 513 | Foreground_color_65k(Black); 514 | Background_color_65k(White); 515 | CGROM_Select_Internal_CGROM(); 516 | Font_Select_12x24_24x24(); 517 | Goto_Text_XY(330,100); 518 | Show_String("Pattern Fill"); 519 | 520 | Background_color_65k(color65k_red); 521 | BTE_S1_Window_Start_XY(0,0); 522 | BTE_Destination_Window_Start_XY(0,440); 523 | BTE_Window_Size(300,300); 524 | BTE_Operation_Code(0x07);//pattern fill with chroma key 525 | 526 | BTE_Enable(); 527 | Check_BTE_Busy(); 528 | 529 | Foreground_color_65k(Black); 530 | Background_color_65k(White); 531 | CGROM_Select_Internal_CGROM(); 532 | Font_Select_12x24_24x24(); 533 | Goto_Text_XY(330,450); 534 | Show_String("Pattern Fill With"); 535 | 536 | Foreground_color_65k(Black); 537 | Background_color_65k(White); 538 | CGROM_Select_Internal_CGROM(); 539 | Font_Select_12x24_24x24(); 540 | Goto_Text_XY(354,450); 541 | Show_String("Chroma Key"); 542 | delay(1000); 543 | NextStep(); 544 | } 545 | //----------------------------------------------------------------------------- 546 | void App_Demo_Waveform(void) 547 | { 548 | uint16_t i,h=0; 549 | 550 | uint16_t point1y,point2y; 551 | uint16_t point21y,point22y; 552 | uint16_t point31y,point32y; 553 | point2y = 0; //initial value 554 | point22y = 0; //initial value 555 | point32y = 0; //initial value 556 | 557 | #define grid_width 400 558 | #define grid_high 1280 559 | #define grid_gap 50 560 | 561 | Select_Main_Window_16bpp(); 562 | Main_Image_Start_Address(0); 563 | Main_Image_Width(400); 564 | Main_Window_Start_XY(0,0); 565 | 566 | Canvas_Image_Start_address(0);//Layer 1 567 | Canvas_image_width(400);// 568 | Active_Window_XY(0,0); 569 | Active_Window_WH(400,1280); 570 | 571 | Foreground_color_65k(Blue); 572 | Line_Start_XY(0,0); 573 | Line_End_XY(399,1247); 574 | Start_Square_Fill(); 575 | 576 | Foreground_color_65k(Blue2); 577 | Line_Start_XY(0,1248); 578 | Line_End_XY(399,1279); 579 | Start_Square_Fill(); 580 | 581 | do{ 582 | 583 | Canvas_Image_Start_address(layer2_start_addr);//Layer 2 584 | 585 | 586 | Foreground_color_65k(Black); //clear layer2 to color black 587 | Line_Start_XY(0,0); 588 | Line_End_XY(399,1279); 589 | Start_Square_Fill(); 590 | 591 | 592 | 593 | 594 | for(i=0;i<=grid_width;i+=grid_gap) 595 | { 596 | Foreground_color_65k(color65k_grayscale12); 597 | Line_Start_XY(i,0); 598 | Line_End_XY(i,grid_high-1); 599 | Start_Line(); 600 | } 601 | 602 | for(i=0;i<=grid_high;i+=grid_gap) 603 | { 604 | Foreground_color_65k(color65k_grayscale12); 605 | Line_Start_XY(0,i); 606 | Line_End_XY(grid_width-1,i); 607 | Start_Line(); 608 | } 609 | 610 | Foreground_color_65k(Red); 611 | Background_color_65k(Black); 612 | CGROM_Select_Internal_CGROM(); 613 | Font_Select_12x24_24x24(); 614 | Goto_Text_XY(0,0); 615 | Show_String("Application Demo Waveform www.buydisplay.com"); 616 | 617 | 618 | //BTE memory(move) grid to layer1 619 | BTE_S0_Color_16bpp(); 620 | BTE_S0_Memory_Start_Address(layer2_start_addr); 621 | BTE_S0_Image_Width(400); 622 | BTE_S0_Window_Start_XY(0,0); 623 | 624 | 625 | BTE_Destination_Color_16bpp(); 626 | BTE_Destination_Memory_Start_Address(0); 627 | BTE_Destination_Image_Width(400); 628 | BTE_Destination_Window_Start_XY(0,0); 629 | BTE_Window_Size(400,1280); 630 | 631 | //move with ROP 0 632 | BTE_ROP_Code(12); //memory copy s0(layer2)grid to layer1 633 | BTE_Operation_Code(2); //BTE move 634 | BTE_Enable(); 635 | Check_BTE_Busy(); 636 | 637 | 638 | Canvas_Image_Start_address(0);//Layer 1 639 | 640 | 641 | 642 | for(i=0;i<1280;i+=2) 643 | { 644 | // copy layer2 grid column to layer1 645 | BTE_S0_Window_Start_XY(i,0); 646 | 647 | BTE_Destination_Window_Start_XY(0+i,0); 648 | BTE_Window_Size(0,400); 649 | BTE_Enable(); 650 | Check_BTE_Busy(); 651 | 652 | 653 | point1y = point2y; 654 | point2y = rand()%90;// 655 | 656 | point21y = point22y; 657 | point22y = rand()%99;// 658 | // 659 | point31y = point32y; 660 | point32y = rand()%67;// 661 | 662 | Foreground_color_65k(color65k_yellow);// 663 | // Line_Start_XY(i+10,point1y+80); 664 | // Line_End_XY(i+1+10,point2y+80); 665 | Line_Start_XY(point1y+80,i+10); 666 | Line_End_XY(point2y+80,i+1+10); 667 | Start_Line(); 668 | 669 | Foreground_color_65k(color65k_purple);// 670 | // Line_Start_XY(i+10,point21y+200); 671 | // Line_End_XY(i+1+10,point22y+200); 672 | Line_Start_XY(point21y+200,i+10); 673 | Line_End_XY(point22y+200,i+1+10); 674 | Start_Line(); 675 | // 676 | Foreground_color_65k(color65k_green);// 677 | // Line_Start_XY(i+10,point31y+300); 678 | // Line_End_XY(i+1+10,point32y+300); 679 | 680 | Line_Start_XY(point31y+300,i+10); 681 | Line_End_XY(point32y+300,i+1+10); 682 | Start_Line(); 683 | 684 | 685 | //delay(1000); 686 | } 687 | 688 | 689 | h++; 690 | } 691 | while(h<7); 692 | 693 | NextStep(); 694 | 695 | } 696 | //----------------------------------------------------------------------------- 697 | void App_Demo_Scrolling_Text(void) 698 | { 699 | uint16_t i; 700 | 701 | 702 | 703 | Select_Main_Window_16bpp(); 704 | Main_Image_Start_Address(0); 705 | Main_Image_Width(400); 706 | Main_Window_Start_XY(0,0); 707 | 708 | Canvas_Image_Start_address(layer2_start_addr); 709 | Canvas_image_width(400);// 710 | Active_Window_XY(0,0); 711 | Active_Window_WH(400,1280); 712 | 713 | Foreground_color_65k(Black); 714 | Line_Start_XY(0,0); 715 | Line_End_XY(399,1279); 716 | Start_Square_Fill(); 717 | 718 | 719 | /* 720 | Foreground_color_65k(White); 721 | Background_color_65k(Blue2); 722 | CGROM_Select_Internal_CGROM(); 723 | Font_Select_12x24_24x24(); 724 | Goto_Text_XY(0,Line52); 725 | Show_String("Demo Scrolling Text"); 726 | Foreground_color_65k(White); 727 | Background_color_65k(Black); 728 | Font_Select_12x24_24x24(); 729 | Goto_Text_XY(0,Line51); 730 | Show_String("Used Move BTE with Chroma Key "); 731 | */ 732 | 733 | //DMA initial setting 734 | Enable_SFlash_SPI(); 735 | Select_SFI_1(); 736 | Select_SFI_DMA_Mode(); 737 | Select_SFI_24bit_Address(); 738 | 739 | //Select_SFI_Waveform_Mode_0(); 740 | Select_SFI_Waveform_Mode_3(); 741 | 742 | //Select_SFI_0_DummyRead(); //normal read mode 743 | Select_SFI_8_DummyRead(); //1byte dummy cycle 744 | //Select_SFI_16_DummyRead(); 745 | //Select_SFI_24_DummyRead(); 746 | 747 | Select_SFI_Single_Mode(); 748 | //Select_SFI_Dual_Mode0(); 749 | //Select_SFI_Dual_Mode1(); 750 | 751 | SPI_Clock_Period(0); 752 | 753 | 754 | SFI_DMA_Destination_Upper_Left_Corner(0,0); 755 | SFI_DMA_Transfer_Width_Height(400,1280); 756 | SFI_DMA_Source_Width(400);// 757 | SFI_DMA_Source_Start_Address(0);// 758 | Start_SFI_DMA(); 759 | Check_Busy_SFI_DMA(); 760 | 761 | 762 | //BTE memory(move) layer2 to layer1 763 | BTE_S0_Color_16bpp(); 764 | BTE_S0_Memory_Start_Address(layer2_start_addr); 765 | BTE_S0_Image_Width(400); 766 | BTE_S0_Window_Start_XY(0,0); 767 | 768 | 769 | 770 | BTE_Destination_Color_16bpp(); 771 | BTE_Destination_Memory_Start_Address(layer1_start_addr); 772 | BTE_Destination_Image_Width(400); 773 | BTE_Destination_Window_Start_XY(0,0); 774 | BTE_Window_Size(400,1280); 775 | 776 | BTE_ROP_Code(12); 777 | BTE_Operation_Code(2); //BTE move 778 | BTE_Enable(); //memory copy s0(layer3) to layer1 779 | Check_BTE_Busy(); 780 | 781 | 782 | //write text to layer3 783 | Canvas_Image_Start_address(layer3_start_addr); 784 | Canvas_image_width(400);// 785 | Active_Window_XY(0,0); 786 | Active_Window_WH(400,1280); 787 | 788 | Foreground_color_65k(Red); 789 | Line_Start_XY(0,0); 790 | Line_End_XY(399,1279); 791 | Start_Square_Fill(); 792 | 793 | Foreground_color_65k(Green); 794 | Background_color_65k(Red); 795 | CGROM_Select_Internal_CGROM(); 796 | Font_Select_12x24_24x24(); 797 | Goto_Text_XY(24,10); 798 | Show_String("Demo Scrolling Text"); 799 | 800 | Foreground_color_65k(Yellow); 801 | Background_color_65k(Red); 802 | Goto_Text_XY(48,10); 803 | Show_String("Demo Scrolling Text"); 804 | Foreground_color_65k(Magenta); 805 | Background_color_65k(Red); 806 | Goto_Text_XY(72,10); 807 | Show_String("Demo Scrolling Text"); 808 | Foreground_color_65k(Grey); 809 | Background_color_65k(Red); 810 | Goto_Text_XY(96,10); 811 | Show_String("Demo Scrolling Text"); 812 | 813 | 814 | //Move BTE with chroma key layer3 to layer2 then move layer2 to layer1 to display 815 | 816 | for(i=0;i<200;i+=8) 817 | { 818 | Canvas_Image_Start_address(layer2_start_addr); 819 | Canvas_image_width(400);// 820 | Active_Window_XY(0,0); 821 | Active_Window_WH(400,1280); 822 | 823 | Foreground_color_65k(Black); 824 | Line_Start_XY(0,0); 825 | Line_End_XY(399,1279); 826 | Start_Square_Fill(); 827 | 828 | SFI_DMA_Destination_Upper_Left_Corner(0,0); 829 | SFI_DMA_Transfer_Width_Height(400,1280); 830 | SFI_DMA_Source_Width(400);// 831 | SFI_DMA_Source_Start_Address(0);// 832 | Start_SFI_DMA(); 833 | Check_Busy_SFI_DMA(); 834 | 835 | //BTE memory(move) layer3 to layer2 836 | //BTE_S0_Color_16bpp(); 837 | BTE_S0_Memory_Start_Address(layer3_start_addr); 838 | BTE_S0_Image_Width(400); 839 | BTE_S0_Window_Start_XY(0,0); 840 | 841 | 842 | 843 | //BTE_Destination_Color_16bpp(); 844 | BTE_Destination_Memory_Start_Address(layer2_start_addr); 845 | BTE_Destination_Image_Width(400); 846 | BTE_Destination_Window_Start_XY(391-i,72); 847 | BTE_Window_Size(0+i,24*4); 848 | 849 | Background_color_65k(Red);// 850 | 851 | BTE_ROP_Code(12); 852 | BTE_Operation_Code(5); //BTE move with chroma key 853 | BTE_Enable(); //memory copy s0(layer3) to layer1 854 | Check_BTE_Busy(); 855 | 856 | 857 | 858 | 859 | //BTE memory(move) layer2 to layer1 860 | //BTE_S0_Color_16bpp(); 861 | BTE_S0_Memory_Start_Address(layer2_start_addr); 862 | BTE_S0_Image_Width(400); 863 | BTE_S0_Window_Start_XY(0,0); 864 | 865 | //BTE_Destination_Color_16bpp(); 866 | BTE_Destination_Memory_Start_Address(layer1_start_addr); 867 | BTE_Destination_Image_Width(400); 868 | BTE_Destination_Window_Start_XY(0,0); 869 | BTE_Window_Size(400,1280); 870 | 871 | BTE_ROP_Code(12); 872 | BTE_Operation_Code(2); //BTE move 873 | BTE_Enable(); //memory copy s0(layer2) to layer1 874 | Check_BTE_Busy(); 875 | } 876 | 877 | for(i=0;i<100;i+=8) 878 | { 879 | Canvas_Image_Start_address(layer2_start_addr); 880 | Canvas_image_width(400);// 881 | Active_Window_XY(0,0); 882 | Active_Window_WH(400,1280); 883 | 884 | Foreground_color_65k(Black); 885 | Line_Start_XY(0,0); 886 | Line_End_XY(399,1279); 887 | Start_Square_Fill(); 888 | 889 | SFI_DMA_Destination_Upper_Left_Corner(0,0); 890 | SFI_DMA_Transfer_Width_Height(400,1280); 891 | SFI_DMA_Source_Width(400);// 892 | SFI_DMA_Source_Start_Address(layer4_start_addr);// ?? 893 | Start_SFI_DMA(); 894 | Check_Busy_SFI_DMA(); 895 | 896 | //BTE memory(move) layer3 to layer2 897 | //BTE_S0_Color_16bpp(); 898 | BTE_S0_Memory_Start_Address(layer3_start_addr); 899 | BTE_S0_Image_Width(400); 900 | BTE_S0_Window_Start_XY(i,0); 901 | 902 | 903 | 904 | //BTE_Destination_Color_16bpp(); 905 | BTE_Destination_Memory_Start_Address(layer2_start_addr); 906 | BTE_Destination_Image_Width(400); 907 | BTE_Destination_Window_Start_XY(0,72); 908 | BTE_Window_Size(399-i,24*4); 909 | 910 | Background_color_65k(Red);// 911 | 912 | BTE_ROP_Code(12); 913 | BTE_Operation_Code(5); //BTE move with chroma key 914 | BTE_Enable(); //memory copy s0(layer3) to layer1 915 | Check_BTE_Busy(); 916 | 917 | // Main_Image_Width(800); 918 | // Main_Window_Start_XY(0,0); 919 | // Main_Image_Start_Address(layer2_start_addr);//switch display windows to 920 | // delay(20); 921 | 922 | 923 | //BTE memory(move) layer2 to layer1 924 | //BTE_S0_Color_16bpp(); 925 | BTE_S0_Memory_Start_Address(layer2_start_addr); 926 | BTE_S0_Image_Width(400); 927 | BTE_S0_Window_Start_XY(0,0); 928 | 929 | //BTE_Destination_Color_16bpp(); 930 | BTE_Destination_Memory_Start_Address(layer1_start_addr); 931 | BTE_Destination_Image_Width(400); 932 | BTE_Destination_Window_Start_XY(0,0); 933 | BTE_Window_Size(400,1280); 934 | 935 | BTE_ROP_Code(12); 936 | BTE_Operation_Code(2); //BTE move 937 | BTE_Enable(); //memory copy s0(layer2) to layer1 938 | Check_BTE_Busy(); 939 | } 940 | 941 | NextStep(); 942 | 943 | } 944 | //----------------------------------------------------------------------------- 945 | void App_Demo_multi_frame_buffer(void) 946 | { uint16_t i,j; 947 | uint32_t im=1; 948 | Select_Main_Window_16bpp(); 949 | Main_Image_Start_Address(0); 950 | Main_Image_Width(400); 951 | Main_Window_Start_XY(0,0); 952 | 953 | //DMA initial setting 954 | Enable_SFlash_SPI(); 955 | Select_SFI_1(); 956 | Select_SFI_DMA_Mode(); 957 | Select_SFI_24bit_Address(); 958 | 959 | //Select_SFI_Waveform_Mode_0(); 960 | Select_SFI_Waveform_Mode_3(); 961 | 962 | //Select_SFI_0_DummyRead(); //normal read mode 963 | Select_SFI_8_DummyRead(); //1byte dummy cycle 964 | //Select_SFI_16_DummyRead(); 965 | //Select_SFI_24_DummyRead(); 966 | 967 | Select_SFI_Single_Mode(); 968 | //Select_SFI_Dual_Mode0(); 969 | //Select_SFI_Dual_Mode1(); 970 | 971 | SPI_Clock_Period(0); 972 | 973 | SFI_DMA_Destination_Upper_Left_Corner(0,0); 974 | SFI_DMA_Transfer_Width_Height(400,1280); 975 | SFI_DMA_Source_Width(400);// 976 | 977 | 978 | for(i=0;i<7;i++) 979 | { 980 | 981 | Canvas_Image_Start_address(im*400*1280*2*i);//Layer1~6 982 | Canvas_image_width(400);// 983 | Active_Window_XY(0,0); 984 | Active_Window_WH(400,1280); 985 | 986 | /* Foreground_color_65k(Black); 987 | Line_Start_XY(0,0); 988 | Line_End_XY(399,1247); 989 | Start_Square_Fill(); 990 | 991 | Foreground_color_65k(Blue2); 992 | Line_Start_XY(0,1248); 993 | Line_End_XY(399,1279); 994 | Start_Square_Fill(); 995 | 996 | 997 | Foreground_color_65k(White); 998 | Background_color_65k(Blue2); 999 | CGROM_Select_Internal_CGROM(); 1000 | Font_Select_12x24_24x24(); 1001 | Goto_Text_XY(0,Line52); 1002 | Show_String("Demo Multi Frame Buffer"); 1003 | 1004 | //LCD_DisplayString(0,Line23 ," Demo Mulit Frame Buffer",Black,White); 1005 | 1006 | */ 1007 | 1008 | 1009 | SFI_DMA_Source_Start_Address(im*400*1280*2*i);// 1010 | Start_SFI_DMA(); 1011 | Check_Busy_SFI_DMA(); 1012 | //delay(500); 1013 | delay(100); 1014 | Main_Image_Width(400); 1015 | Main_Window_Start_XY(0,0); 1016 | Main_Image_Start_Address(im*400*1280*2*i);//switch display windows to 1017 | } 1018 | //delay(2000); 1019 | // Color_Bar_ON(); 1020 | 1021 | //set canvas to 8188 1022 | Select_Main_Window_16bpp(); 1023 | Main_Image_Start_Address(0); 1024 | Main_Image_Width(3200); 1025 | Main_Window_Start_XY(0,0); 1026 | Canvas_Image_Start_address(0); 1027 | Canvas_image_width(3200);// 1028 | Active_Window_XY(0,0); 1029 | Active_Window_WH(3200,1280); 1030 | 1031 | for(im=0;im<5;im++) 1032 | { 1033 | Canvas_Image_Start_address(0);//Layer1~6 1034 | 1035 | Foreground_color_65k(Black); 1036 | Line_Start_XY(0+im*400,0); 1037 | Line_End_XY(399+im*400,1255); 1038 | Start_Square_Fill(); 1039 | 1040 | Foreground_color_65k(Blue2); 1041 | Line_Start_XY(0+im*400,1256); 1042 | Line_End_XY(399+im*400,1279); 1043 | Start_Square_Fill(); 1044 | 1045 | 1046 | SFI_DMA_Destination_Upper_Left_Corner(0+im*400,0); 1047 | SFI_DMA_Source_Start_Address(im*1280*400*2);// 1048 | Start_SFI_DMA(); 1049 | Check_Busy_SFI_DMA(); 1050 | delay(5); 1051 | 1052 | /* Foreground_color_65k(White); 1053 | Background_color_65k(Blue2); 1054 | CGROM_Select_Internal_CGROM(); 1055 | Font_Select_12x24_24x24(); 1056 | Goto_Text_XY(i*1024,Line52); 1057 | Show_String("Demo Mulit Frame Buffer"); 1058 | */ 1059 | } 1060 | // Color_Bar_OFF(); 1061 | 1062 | for(j=0;j<4;j++) 1063 | { 1064 | for(i=0;i<400;i++) 1065 | { 1066 | Main_Window_Start_XY(i+j*400,0); 1067 | delay(5); 1068 | } 1069 | delay(30); 1070 | } 1071 | 1072 | for(j=4;j>0;j--) 1073 | { 1074 | for(i=0;i<400;i++) 1075 | { 1076 | Main_Window_Start_XY(j*400-i,0); 1077 | delay(5); 1078 | } 1079 | 1080 | } 1081 | 1082 | delay(500); 1083 | 1084 | NextStep(); 1085 | } 1086 | //----------------------------------------------------------------------------- 1087 | void App_Demo_slide_frame_buffer(void) 1088 | { uint32_t im=1; 1089 | uint16_t i,j; 1090 | 1091 | Select_Main_Window_16bpp(); 1092 | Main_Image_Start_Address(0); 1093 | Main_Image_Width(400); 1094 | Main_Window_Start_XY(0,0); 1095 | 1096 | //DMA initial setting 1097 | Enable_SFlash_SPI(); 1098 | Select_SFI_1(); 1099 | Select_SFI_DMA_Mode(); 1100 | Select_SFI_24bit_Address(); 1101 | 1102 | //Select_SFI_Waveform_Mode_0(); 1103 | Select_SFI_Waveform_Mode_3(); 1104 | 1105 | //Select_SFI_0_DummyRead(); //normal read mode 1106 | Select_SFI_8_DummyRead(); //1byte dummy cycle 1107 | //Select_SFI_16_DummyRead(); 1108 | //Select_SFI_24_DummyRead(); 1109 | 1110 | Select_SFI_Single_Mode(); 1111 | //Select_SFI_Dual_Mode0(); 1112 | //Select_SFI_Dual_Mode1(); 1113 | 1114 | SPI_Clock_Period(0); 1115 | 1116 | SFI_DMA_Destination_Upper_Left_Corner(0,0); 1117 | SFI_DMA_Transfer_Width_Height(400,1280); 1118 | SFI_DMA_Source_Width(400);// 1119 | 1120 | 1121 | //Color_Bar_ON(); 1122 | 1123 | //set canvas to 1600 1124 | Select_Main_Window_16bpp(); 1125 | Main_Image_Start_Address(0); 1126 | Main_Image_Width(800); 1127 | Main_Window_Start_XY(0,0); 1128 | Canvas_Image_Start_address(0); 1129 | Canvas_image_width(800);// 1130 | Active_Window_XY(0,0); 1131 | Active_Window_WH(800,2560); 1132 | 1133 | Canvas_Image_Start_address(0);// 1134 | 1135 | Foreground_color_65k(Black); 1136 | Line_Start_XY(0,0); 1137 | Line_End_XY(799,2559); 1138 | Start_Square_Fill(); 1139 | 1140 | SFI_DMA_Destination_Upper_Left_Corner(0,0); 1141 | SFI_DMA_Source_Start_Address(0);// 1142 | Start_SFI_DMA(); 1143 | Check_Busy_SFI_DMA(); 1144 | 1145 | SFI_DMA_Destination_Upper_Left_Corner(400,0); 1146 | SFI_DMA_Source_Start_Address(im*400*1280*2);// 1147 | Start_SFI_DMA(); 1148 | Check_Busy_SFI_DMA(); 1149 | 1150 | SFI_DMA_Destination_Upper_Left_Corner(0,1280); 1151 | SFI_DMA_Source_Start_Address(im*400*1280*4);// 1152 | Start_SFI_DMA(); 1153 | Check_Busy_SFI_DMA(); 1154 | 1155 | SFI_DMA_Destination_Upper_Left_Corner(400,1280); 1156 | SFI_DMA_Source_Start_Address(im*400*1280*6);// 1157 | Start_SFI_DMA(); 1158 | Check_Busy_SFI_DMA(); 1159 | 1160 | 1161 | 1162 | //Color_Bar_OFF(); 1163 | 1164 | 1165 | for(i=0;i<800-400+1;i++) 1166 | { 1167 | Main_Window_Start_XY(i,0); 1168 | delay(5); 1169 | } 1170 | delay(1); 1171 | 1172 | for(j=0;j<2560-1280+1;j++) 1173 | { 1174 | Main_Window_Start_XY(400,j); 1175 | delay(5); 1176 | } 1177 | delay(1); 1178 | 1179 | 1180 | for(i=800-400;i>0;i--) 1181 | { 1182 | Main_Window_Start_XY(i,1280); 1183 | delay(5); 1184 | } 1185 | Main_Window_Start_XY(0,1280); 1186 | delay(1); 1187 | 1188 | for(j=2560-1280;j>0;j--) 1189 | { 1190 | Main_Window_Start_XY(0,j); 1191 | delay(5); 1192 | } 1193 | Main_Window_Start_XY(0,0); 1194 | delay(5); 1195 | 1196 | 1197 | NextStep(); 1198 | } 1199 | //----------------------------------------------------------------------------- 1200 | void App_Demo_Alpha_Blending(void) 1201 | { uint32_t im=1; 1202 | uint16_t i,j; 1203 | 1204 | Select_Main_Window_16bpp(); 1205 | Main_Image_Start_Address(layer1_start_addr); 1206 | Main_Image_Width(400); 1207 | Main_Window_Start_XY(0,0); 1208 | 1209 | Canvas_Image_Start_address(layer1_start_addr);// 1210 | Main_Image_Width(400); 1211 | Active_Window_XY(0,0); 1212 | Active_Window_WH(400,1280); 1213 | 1214 | 1215 | Foreground_color_65k(Black); 1216 | Line_Start_XY(0,0); 1217 | Line_End_XY(399,1247); 1218 | Start_Square_Fill(); 1219 | 1220 | Foreground_color_65k(Blue2); 1221 | Line_Start_XY(0,1248); 1222 | Line_End_XY(399,1279); 1223 | Start_Square_Fill(); 1224 | 1225 | 1226 | 1227 | Foreground_color_65k(White); 1228 | Background_color_65k(Blue2); 1229 | CGROM_Select_Internal_CGROM(); 1230 | Font_Select_12x24_24x24(); 1231 | Goto_Text_XY(0,Line52); 1232 | Show_String(" Demo Alpha Blending"); 1233 | Foreground_color_65k(White); 1234 | Background_color_65k(Black); 1235 | Font_Select_12x24_24x24(); 1236 | Goto_Text_XY(0,Line51); 1237 | Show_String("Fade in and fade out"); 1238 | 1239 | //DMA initial setting 1240 | Enable_SFlash_SPI(); 1241 | Select_SFI_1(); 1242 | Select_SFI_DMA_Mode(); 1243 | Select_SFI_24bit_Address(); 1244 | 1245 | //Select_SFI_Waveform_Mode_0(); 1246 | Select_SFI_Waveform_Mode_3(); 1247 | 1248 | //Select_SFI_0_DummyRead(); //normal read mode 1249 | Select_SFI_8_DummyRead(); //1byte dummy cycle 1250 | //Select_SFI_16_DummyRead(); 1251 | //Select_SFI_24_DummyRead(); 1252 | 1253 | Select_SFI_Single_Mode(); 1254 | //Select_SFI_Dual_Mode0(); 1255 | //Select_SFI_Dual_Mode1(); 1256 | 1257 | SPI_Clock_Period(0); 1258 | 1259 | 1260 | //Clear layer2 to color black 1261 | Canvas_Image_Start_address(layer2_start_addr);// 1262 | Foreground_color_65k(Black); 1263 | Line_Start_XY(0,0); 1264 | Line_End_XY(399,1279); 1265 | Start_Square_Fill(); 1266 | 1267 | //DMA picture to layer2 1268 | SFI_DMA_Destination_Upper_Left_Corner(0,0); 1269 | SFI_DMA_Transfer_Width_Height(400,1280); 1270 | SFI_DMA_Source_Width(400);// 1271 | SFI_DMA_Source_Start_Address(0);// 1272 | Start_SFI_DMA(); 1273 | Check_Busy_SFI_DMA(); 1274 | 1275 | 1276 | //Clear layer3 to color black 1277 | Canvas_Image_Start_address(layer3_start_addr);// 1278 | Foreground_color_65k(Black); 1279 | Line_Start_XY(0,0); 1280 | Line_End_XY(399,1279); 1281 | Start_Square_Fill(); 1282 | 1283 | //DMA picture to layer3 1284 | SFI_DMA_Destination_Upper_Left_Corner(0,0); 1285 | SFI_DMA_Transfer_Width_Height(400,1280); 1286 | SFI_DMA_Source_Width(400);// 1287 | SFI_DMA_Source_Start_Address(im*400*1280*2);// 1288 | Start_SFI_DMA(); 1289 | Check_Busy_SFI_DMA(); 1290 | 1291 | //BTE move alpha blending by picture 1292 | BTE_Destination_Color_16bpp(); 1293 | BTE_Destination_Memory_Start_Address(layer1_start_addr); 1294 | BTE_Destination_Image_Width(400); 1295 | BTE_Destination_Window_Start_XY(0,0); 1296 | BTE_Window_Size(400,1280); 1297 | 1298 | BTE_S0_Color_16bpp(); 1299 | BTE_S0_Memory_Start_Address(layer2_start_addr); 1300 | BTE_S0_Image_Width(400); 1301 | BTE_S0_Window_Start_XY(0,0); 1302 | 1303 | BTE_S1_Color_16bpp(); 1304 | BTE_S1_Memory_Start_Address(layer3_start_addr); 1305 | BTE_S1_Image_Width(400); 1306 | BTE_S1_Window_Start_XY(0,0); 1307 | 1308 | 1309 | BTE_ROP_Code(15); 1310 | BTE_Operation_Code(10); //BTE move 1311 | 1312 | for(j=0;j<4;j+=2) 1313 | { 1314 | //DMA picture to layer2 1315 | Canvas_Image_Start_address(layer2_start_addr);// 1316 | SFI_DMA_Destination_Upper_Left_Corner(0,0); 1317 | SFI_DMA_Transfer_Width_Height(400,1280); 1318 | SFI_DMA_Source_Width(400);// 1319 | SFI_DMA_Source_Start_Address(im*j*400*1280*2);// 1320 | Start_SFI_DMA(); 1321 | Check_Busy_SFI_DMA(); 1322 | //DMA picture to layer3 1323 | Canvas_Image_Start_address(layer3_start_addr);// 1324 | SFI_DMA_Source_Start_Address(im*(j+1)*400*1280*2);// 1325 | Start_SFI_DMA(); 1326 | Check_Busy_SFI_DMA(); 1327 | 1328 | for(i=0;i<32;i++) 1329 | { 1330 | BTE_Alpha_Blending_Effect(i); 1331 | BTE_Enable(); 1332 | delay(200); 1333 | } 1334 | 1335 | for(i=32;i>0;i--) 1336 | { 1337 | BTE_Alpha_Blending_Effect(i); 1338 | BTE_Enable(); 1339 | delay(200); 1340 | } 1341 | } 1342 | 1343 | NextStep(); 1344 | 1345 | } 1346 | //----------------------------------------------------------------------------- 1347 | void mono_Demo(void) 1348 | { 1349 | 1350 | 1351 | Select_Main_Window_16bpp(); 1352 | Main_Image_Start_Address(0); 1353 | Main_Image_Width(400); 1354 | Main_Window_Start_XY(0,0); 1355 | Canvas_Image_Start_address(0); 1356 | Canvas_image_width(400);// 1357 | Active_Window_XY(0,0); 1358 | Active_Window_WH(400,1280); 1359 | 1360 | 1361 | Foreground_color_65k(Red); 1362 | Line_Start_XY(0,0); 1363 | Line_End_XY(399,1279); 1364 | Start_Square_Fill(); 1365 | NextStep(); 1366 | Foreground_color_65k(Green); 1367 | Line_Start_XY(0,0); 1368 | Line_End_XY(399,1279); 1369 | Start_Square_Fill(); 1370 | NextStep(); 1371 | Foreground_color_65k(Blue); 1372 | Line_Start_XY(0,0); 1373 | Line_End_XY(399,1279); 1374 | Start_Square_Fill(); 1375 | NextStep(); 1376 | Foreground_color_65k(Cyan); 1377 | Line_Start_XY(0,0); 1378 | Line_End_XY(399,1279); 1379 | Start_Square_Fill(); 1380 | NextStep(); 1381 | Foreground_color_65k(Yellow); 1382 | Line_Start_XY(0,0); 1383 | Line_End_XY(399,1279); 1384 | Start_Square_Fill(); 1385 | NextStep(); 1386 | Foreground_color_65k(Magenta); 1387 | Line_Start_XY(0,0); 1388 | Line_End_XY(399,1279); 1389 | Start_Square_Fill(); 1390 | NextStep(); 1391 | Foreground_color_65k(White); 1392 | Line_Start_XY(0,0); 1393 | Line_End_XY(399,1279); 1394 | Start_Square_Fill(); 1395 | NextStep(); 1396 | Foreground_color_65k(Black); 1397 | Line_Start_XY(0,0); 1398 | Line_End_XY(399,1279); 1399 | Start_Square_Fill(); 1400 | NextStep(); 1401 | } 1402 | //----------------------------------------------------------------------------- 1403 | void Text_Demo(void) 1404 | { 1405 | // uint16_t i,j; 1406 | Select_Main_Window_16bpp(); 1407 | Main_Image_Start_Address(0); 1408 | Main_Image_Width(400); 1409 | Main_Window_Start_XY(0,0); 1410 | 1411 | Canvas_Image_Start_address(0);//Layer 1 1412 | Canvas_image_width(400);// 1413 | Active_Window_XY(0,0); 1414 | Active_Window_WH(400,1280); 1415 | 1416 | 1417 | // Color_Bar_ON(); 1418 | // NextStep(); 1419 | // Color_Bar_OFF(); 1420 | 1421 | 1422 | 1423 | Foreground_color_65k(White); 1424 | Line_Start_XY(0,0); 1425 | Line_End_XY(399,1279); 1426 | Start_Square_Fill(); 1427 | 1428 | 1429 | ///////////////////////////////////////////////////////////////////////////// 1430 | // LCD_DisplayString(0,Line48 ,"EastRising Technology",Blue2,White); 1431 | // Foreground_color_65k(White); 1432 | // Background_color_65k(Blue2); 1433 | CGROM_Select_Internal_CGROM(); 1434 | Font_Select_12x24_24x24(); 1435 | Goto_Text_XY(20,1000); 1436 | Show_String("www.buydisplay.ocm"); 1437 | Foreground_color_65k(Blue2); 1438 | Background_color_65k(White); 1439 | Goto_Text_XY(0,850); 1440 | Show_String("7.84 inch TFT Module 400*1280 Dots"); 1441 | delay(1000); 1442 | // NextStep(); 1443 | 1444 | 1445 | 1446 | 1447 | Foreground_color_65k(Black); 1448 | Background_color_65k(White); 1449 | CGROM_Select_Internal_CGROM(); 1450 | Font_Select_8x16_16x16(); 1451 | Goto_Text_XY(0,0); 1452 | Show_String("Embedded 8x16 ASCII Character"); 1453 | 1454 | Font_Select_12x24_24x24(); 1455 | Goto_Text_XY(16,0); 1456 | Show_String("Embedded 12x24 ASCII Character"); 1457 | 1458 | Font_Select_16x32_32x32(); 1459 | Goto_Text_XY(40,0); 1460 | Show_String("Embedded 16x32 ASCII "); 1461 | 1462 | /* 1463 | Font_Width_X2(); 1464 | Goto_Text_XY(0,16); 1465 | Show_String("Character Width Enlarge x2"); 1466 | Font_Width_X1(); 1467 | Font_Height_X2(); 1468 | Goto_Text_XY(0,32); 1469 | Show_String("Character High Enlarge x2"); 1470 | Font_Width_X2(); 1471 | Font_Height_X2(); 1472 | Goto_Text_XY(0,64); 1473 | Show_String("Character Width & High Enlarge x2"); 1474 | */ 1475 | 1476 | Font_Select_8x16_16x16(); 1477 | Font_Width_X1(); 1478 | Font_Height_X1(); 1479 | Goto_Text_XY(100,0); 1480 | Show_String("Supporting Genitop Inc. UNICODE/BIG5/GB etc. Serial Character ROM with 16x16/24x24/32X32 dots Font."); 1481 | Goto_Text_XY(132,0); 1482 | Show_String("The supporting product numbers are GT21L16TW/GT21H16T1W, GT23L16U2W, GT23L24T3Y/GT23H24T3Y, GT23L24M1Z, and GT23L32S4W/GT23H32S4W, GT23L24F6Y, GT23L24S1W."); 1483 | 1484 | 1485 | 1486 | //Foreground_color_65k(color65k_yellow); 1487 | //Background_color_65k(color65k_purple); 1488 | 1489 | //Font_Select_UserDefine_Mode(); 1490 | //CGROM_Select_Internal_CGROM(); 1491 | CGROM_Select_Genitop_FontROM(); 1492 | 1493 | //GTFont_Select_GT21L16TW_GT21H16T1W(); 1494 | //GTFont_Select_GT23L16U2W(); 1495 | GTFont_Select_GT23L24T3Y_GT23H24T3Y(); 1496 | //GTFont_Select_GT23L24M1Z(); 1497 | //GTFont_Select_GT23L32S4W_GT23H32S4W(); 1498 | //GTFont_Select_GT20L24F6Y(); 1499 | //GTFont_Select_GT21L24S1W(); 1500 | //GTFont_Select_GT22L16A1Y(); 1501 | 1502 | 1503 | 1504 | Font_Width_X1(); 1505 | Font_Height_X1(); 1506 | CGROM_Select_Genitop_FontROM(); 1507 | Font_Select_12x24_24x24(); 1508 | Select_SFI_0(); 1509 | Select_SFI_Font_Mode(); 1510 | Select_SFI_24bit_Address(); 1511 | Select_SFI_Waveform_Mode_0(); 1512 | Select_SFI_0_DummyRead(); 1513 | Select_SFI_Single_Mode(); 1514 | SPI_Clock_Period(4); // Freq must setting <=20MHZ 1515 | 1516 | Enable_SFlash_SPI(); 1517 | 1518 | Foreground_color_65k(color65k_green); 1519 | Background_color_65k(color65k_blue); 1520 | 1521 | Set_GTFont_Decoder(0x11); //BIG5 1522 | 1523 | Goto_Text_XY(200,0); 1524 | Show_String("Demo GT23L24T3Y BIG5:"); 1525 | Font_Select_8x16_16x16(); 1526 | Goto_Text_XY(230,0); 1527 | Show_String("¶°³q¤¤¤åÁcÅé16x16:RA8876 TFT ¹Ï§Î±±¨î¾¹"); 1528 | Font_Select_12x24_24x24(); 1529 | Goto_Text_XY(254,0); 1530 | Show_String("¶°³q¤¤¤åÁcÅé24x24:RA8876 TFT ¹Ï§Î±±¨î¾¹"); 1531 | 1532 | 1533 | Foreground_color_65k(color65k_purple); 1534 | Background_color_65k(color65k_yellow); 1535 | Set_GTFont_Decoder(0x01); //GB2312 1536 | Goto_Text_XY(280,0); 1537 | Show_String("Demo GT23L24T3Y GB2312:"); 1538 | Font_Select_8x16_16x16(); 1539 | Goto_Text_XY(304,0); 1540 | Show_String("¼¯Í¨ÖÐÎļòÌå16x16:RA8876 TFT ͼÐοØÖÆÆ÷"); 1541 | Font_Select_12x24_24x24(); 1542 | Goto_Text_XY(328,0); 1543 | Show_String("¼¯Í¨ÖÐÎļòÌå16x16:RA8876 TFT ͼÐοØÖÆÆ÷"); 1544 | 1545 | Set_GTFont_Decoder(0x11); //BIG5 1546 | 1547 | 1548 | Foreground_color_65k(color65k_black); 1549 | Font_Background_select_Transparency();//³]©w­I´º³z©ú¦â 1550 | 1551 | 1552 | Active_Window_XY(0,600); 1553 | Active_Window_WH(80,80); 1554 | Goto_Pixel_XY(0,600); 1555 | Show_picture(80*80,pic_80x80); 1556 | Active_Window_XY(0,0); 1557 | Active_Window_WH(400,1280); 1558 | 1559 | Goto_Text_XY(0,580); 1560 | Show_String("text transparent"); 1561 | 1562 | 1563 | 1564 | Font_Background_select_Color(); //³]©w­I´º¨Ï¥Î³]©wÃC¦â 1565 | Foreground_color_65k(color65k_black); 1566 | Background_color_65k(color65k_white); 1567 | delay(10000); 1568 | 1569 | /* Goto_Text_XY(0,700); 1570 | Show_String("Demo text cursor:"); 1571 | 1572 | Goto_Text_XY(0,724); 1573 | Show_String("0123456789"); 1574 | Text_cursor_initial(); 1575 | delay(1000); 1576 | 1577 | for(i=0;i<14;i++) 1578 | { 1579 | delay(100); 1580 | Text_Cursor_H_V(1+i,15-i); 1581 | } 1582 | delay(2000); 1583 | 1584 | Disable_Text_Cursor(); 1585 | 1586 | CGROM_Select_Internal_CGROM(); 1587 | Font_Select_8x16_16x16(); 1588 | 1589 | Foreground_color_65k(color65k_blue); 1590 | Goto_Text_XY(0,484); 1591 | Show_String("Demo graphic cursor:"); 1592 | 1593 | Set_Graphic_Cursor_Color_1(0xff); 1594 | Set_Graphic_Cursor_Color_2(0x00); 1595 | 1596 | Graphic_cursor_initial(); 1597 | Graphic_Cursor_XY(0,508); 1598 | Select_Graphic_Cursor_1(); 1599 | delay(2000); 1600 | Select_Graphic_Cursor_2(); 1601 | delay(2000); 1602 | Select_Graphic_Cursor_3(); 1603 | delay(2000); 1604 | Select_Graphic_Cursor_4(); 1605 | delay(2000); 1606 | Select_Graphic_Cursor_2(); 1607 | 1608 | for(j=0;j<2;j++) 1609 | { 1610 | for(i=0;i<400;i++) 1611 | { 1612 | Graphic_Cursor_XY(i,508+j*20); 1613 | delay(2); 1614 | } 1615 | } 1616 | Graphic_Cursor_XY(0,508); 1617 | 1618 | delay(200); 1619 | Disable_Graphic_Cursor(); */ 1620 | 1621 | NextStep(); 1622 | 1623 | 1624 | } 1625 | 1626 | //----------------------------------------------------------------------------- 1627 | 1628 | void DMA_Demo(void) 1629 | { 1630 | uint32_t i; 1631 | 1632 | /////////////////////////////////////////////////////////////// 1633 | 1634 | Select_Main_Window_16bpp(); 1635 | Main_Image_Start_Address(0); 1636 | Main_Image_Width(400); 1637 | Main_Window_Start_XY(0,0); 1638 | 1639 | Canvas_Image_Start_address(0);//Layer 1 1640 | Canvas_image_width(400);// 1641 | Active_Window_XY(0,0); 1642 | Active_Window_WH(400,1280); 1643 | 1644 | 1645 | 1646 | 1647 | 1648 | //DMA initial setting 1649 | Enable_SFlash_SPI(); 1650 | Select_SFI_1(); 1651 | Select_SFI_DMA_Mode(); 1652 | Select_SFI_24bit_Address(); 1653 | 1654 | //Select_SFI_Waveform_Mode_0(); 1655 | Select_SFI_Waveform_Mode_3(); 1656 | 1657 | //Select_SFI_0_DummyRead(); //normal read mode 1658 | Select_SFI_8_DummyRead(); //1byte dummy cycle 1659 | //Select_SFI_16_DummyRead(); 1660 | //Select_SFI_24_DummyRead(); 1661 | 1662 | // Select_SFI_Single_Mode(); 1663 | Select_SFI_Dual_Mode0(); 1664 | // Select_SFI_Dual_Mode1(); 1665 | 1666 | SPI_Clock_Period(0); 1667 | 1668 | 1669 | 1670 | //DMA initail normally command setting 1671 | // LCD_CmdWrite(0x01); 1672 | // LCD_DataWrite(0x83); 1673 | // LCD_CmdWrite(0xB7); 1674 | // LCD_DataWrite(0xd4); 1675 | // LCD_CmdWrite(0xBB); 1676 | // LCD_DataWrite(0x00); 1677 | 1678 | /* 1679 | //if used 32bit address Flash ex.256Mbit,512Mbit 1680 | //must be executed following in 24bit address mode to switch to 32bit address mode 1681 | 1682 | //Select_nSS_drive_on_xnsfcs0(); 1683 | Select_nSS_drive_on_xnsfcs1(); 1684 | 1685 | Reset_CPOL(); 1686 | //Set_CPOL(); 1687 | Reset_CPHA(); 1688 | //Set_CPHA(); 1689 | 1690 | //Enter 4-byte mode 1691 | nSS_Active(); 1692 | SPI_Master_FIFO_Data_Put(0xB7); //switch to 32bit address mode 1693 | delayMicroseconds(10); 1694 | nSS_Inactive(); 1695 | 1696 | Select_SFI_32bit_Address(); 1697 | */ 1698 | 1699 | 1700 | SFI_DMA_Destination_Upper_Left_Corner(0,0); 1701 | SFI_DMA_Transfer_Width_Height(400,1280); 1702 | SFI_DMA_Source_Width(400);// 1703 | 1704 | //execute DMA to show 400x1280 picture 1705 | for(i=0;i<7;i++) 1706 | { 1707 | SFI_DMA_Source_Start_Address(i*400*1280*2);// 1708 | Start_SFI_DMA(); 1709 | Check_Busy_SFI_DMA(); 1710 | delay(30); 1711 | NextStep(); 1712 | } 1713 | 1714 | 1715 | } 1716 | //----------------------------------------------------------------------------- 1717 | void Geometric(void) 1718 | { 1719 | uint16_t i; 1720 | Select_Main_Window_16bpp(); 1721 | Main_Image_Start_Address(0); 1722 | Main_Image_Width(400); 1723 | Main_Window_Start_XY(0,0); 1724 | 1725 | Canvas_Image_Start_address(0);//Layer 1 1726 | Canvas_image_width(400);// 1727 | Active_Window_XY(0,0); 1728 | Active_Window_WH(400,1280); 1729 | 1730 | 1731 | 1732 | ///////////////////////////Square 1733 | 1734 | Foreground_color_65k(Black); 1735 | Line_Start_XY(0,0); 1736 | Line_End_XY(399,1279); 1737 | Start_Square_Fill(); 1738 | 1739 | for(i=0;i<=200;i+=8) 1740 | {Foreground_color_65k(Red); 1741 | Line_Start_XY(0+i,0+i); 1742 | Line_End_XY(399-i,1279-i); 1743 | Start_Square(); 1744 | delay(50); 1745 | } 1746 | 1747 | for(i=0;i<=200;i+=8) 1748 | {Foreground_color_65k(Black); 1749 | Line_Start_XY(0+i,0+i); 1750 | Line_End_XY(399-i,1279-i); 1751 | Start_Square(); 1752 | delay(50); 1753 | } 1754 | delay(2000); 1755 | ///////////////////////////Square Of Circle 1756 | Foreground_color_65k(Black); 1757 | Line_Start_XY(0,0); 1758 | Line_End_XY(399,1279); 1759 | Start_Square_Fill(); 1760 | 1761 | for(i=0;i<=160;i+=8) 1762 | {Foreground_color_65k(Green); 1763 | Line_Start_XY(0+i,0+i); 1764 | Line_End_XY(399-i,1279-i); 1765 | Circle_Square_Radius_RxRy(10,10); 1766 | Start_Circle_Square(); 1767 | delay(50); 1768 | } 1769 | 1770 | for(i=0;i<=160;i+=8) 1771 | {Foreground_color_65k(Black); 1772 | Line_Start_XY(0+i,0+i); 1773 | Line_End_XY(399-i,1279-i); 1774 | Circle_Square_Radius_RxRy(10,10); 1775 | Start_Circle_Square(); 1776 | delay(50); 1777 | } 1778 | delay(2000); 1779 | 1780 | ///////////////////////////Circle 1781 | Foreground_color_65k(Black); 1782 | Line_Start_XY(0,0); 1783 | Line_End_XY(399,1279); 1784 | Start_Square_Fill(); 1785 | 1786 | for(i=0;i<=200;i+=8) 1787 | {Foreground_color_65k(Blue); 1788 | Circle_Center_XY(400/2,1280/2); 1789 | Circle_Radius_R(i); 1790 | Start_Circle_or_Ellipse(); 1791 | delay(50); 1792 | } 1793 | 1794 | for(i=0;i<=200;i+=8) 1795 | {Foreground_color_65k(Black); 1796 | Circle_Center_XY(400/2,1280/2); 1797 | Circle_Radius_R(i); 1798 | Start_Circle_or_Ellipse(); 1799 | delay(50); 1800 | } 1801 | delay(2000); 1802 | 1803 | ///////////////////////////Ellipse 1804 | Foreground_color_65k(Black); 1805 | Line_Start_XY(0,0); 1806 | Line_End_XY(399,1279); 1807 | Start_Square_Fill(); 1808 | 1809 | for(i=0;i<=200;i+=8) 1810 | {Foreground_color_65k(White); 1811 | Circle_Center_XY(400/2,1280/2); 1812 | Ellipse_Radius_RxRy(i,i+100); 1813 | Start_Circle_or_Ellipse(); 1814 | delay(50); 1815 | } 1816 | 1817 | for(i=0;i<=200;i+=8) 1818 | {Foreground_color_65k(Black); 1819 | Circle_Center_XY(400/2,1280/2); 1820 | Ellipse_Radius_RxRy(i,i+100); 1821 | Start_Circle_or_Ellipse(); 1822 | delay(50); 1823 | } 1824 | delay(2000); 1825 | 1826 | ////////////////////////////Triangle 1827 | Foreground_color_65k(Black); 1828 | Line_Start_XY(0,0); 1829 | Line_End_XY(399,1279); 1830 | Start_Square_Fill(); 1831 | 1832 | for(i=0;i<=180;i+=8) 1833 | {Foreground_color_65k(Yellow); 1834 | Triangle_Point1_XY(i,1280/2); 1835 | Triangle_Point2_XY(399-i,i*2); 1836 | Triangle_Point3_XY(399-i,1279-i*2); 1837 | Start_Triangle(); 1838 | delay(50); 1839 | } 1840 | 1841 | for(i=0;i<=180;i+=8) 1842 | {Foreground_color_65k(Black); 1843 | Triangle_Point1_XY(i,1280/2); 1844 | Triangle_Point2_XY(399-i,i*2); 1845 | Triangle_Point3_XY(399-i,1279-i*2); 1846 | Start_Triangle(); 1847 | delay(50); 1848 | } 1849 | delay(2000); 1850 | 1851 | 1852 | ////////////////////////////line 1853 | Foreground_color_65k(Black); 1854 | Line_Start_XY(0,0); 1855 | Line_End_XY(399,1279); 1856 | Start_Square_Fill(); 1857 | 1858 | for(i=0;i<=400;i+=8) 1859 | {Foreground_color_65k(Cyan); 1860 | Line_Start_XY(i,0); 1861 | Line_End_XY(399-i,1279); 1862 | Start_Line(); 1863 | //delay(50); 1864 | } 1865 | for(i=0;i<=1280;i+=8) 1866 | {Foreground_color_65k(Cyan); 1867 | Line_Start_XY(0,1279-i); 1868 | Line_End_XY(399,i); 1869 | Start_Line(); 1870 | //delay(50); 1871 | } 1872 | 1873 | /* 1874 | for(i=0;i<=400;i+=8) 1875 | {Foreground_color_65k(Black); 1876 | Line_Start_XY(i,0); 1877 | Line_End_XY(399-i,1279); 1878 | Start_Line(); 1879 | delay(50); 1880 | } 1881 | for(i=0;i<=1280;i+=8) 1882 | {Foreground_color_65k(Black); 1883 | Line_Start_XY(0,1279-i); 1884 | Line_End_XY(399,i); 1885 | Start_Line(); 1886 | delay(50); 1887 | } 1888 | */ 1889 | delay(2000); 1890 | 1891 | 1892 | } 1893 | //----------------------------------------------------------------------------- 1894 | 1895 | void gray(void) 1896 | { 1897 | int i,col,line; 1898 | 1899 | Select_Main_Window_16bpp(); 1900 | Main_Image_Start_Address(0); 1901 | Main_Image_Width(400); 1902 | Main_Window_Start_XY(0,0); 1903 | Canvas_Image_Start_address(0); 1904 | Canvas_image_width(400);// 1905 | Active_Window_XY(0,0); 1906 | Active_Window_WH(400,1280); 1907 | 1908 | 1909 | 1910 | col=0;line=0; 1911 | for(i=0;i<32;i++) 1912 | { Foreground_color_65k(i<<11); 1913 | Line_Start_XY(col,line); 1914 | Line_End_XY(col+12,line+213); 1915 | Start_Square_Fill(); 1916 | col+=12; 1917 | } 1918 | col=0;line=213; 1919 | for(i=31;i>=0;i--) 1920 | { Foreground_color_65k(i<<11); 1921 | Line_Start_XY(col,line); 1922 | Line_End_XY(col+12,line+213); 1923 | Start_Square_Fill(); 1924 | col+=12; 1925 | } 1926 | 1927 | col=0;line=426; 1928 | for(i=0;i<64;i++) 1929 | { Foreground_color_65k(i<<5); 1930 | Line_Start_XY(col,line); 1931 | Line_End_XY(col+6,line+213); 1932 | Start_Square_Fill(); 1933 | col+=6; 1934 | } 1935 | col=0;line=639; 1936 | for(i=63;i>=0;i--) 1937 | { Foreground_color_65k(i<<5); 1938 | Line_Start_XY(col,line); 1939 | Line_End_XY(col+6,line+213); 1940 | Start_Square_Fill(); 1941 | col+=6; 1942 | } 1943 | 1944 | 1945 | col=0;line=852; 1946 | for(i=0;i<32;i++) 1947 | { Foreground_color_65k(i); 1948 | Line_Start_XY(col,line); 1949 | Line_End_XY(col+12,line+213); 1950 | Start_Square_Fill(); 1951 | col+=12; 1952 | } 1953 | col=0;line=1065; 1954 | for(i=31;i>=0;i--) 1955 | { Foreground_color_65k(i); 1956 | Line_Start_XY(col,line); 1957 | Line_End_XY(col+12,line+213); 1958 | Start_Square_Fill(); 1959 | col+=12; 1960 | } 1961 | 1962 | 1963 | delay(1000); 1964 | NextStep(); 1965 | } 1966 | /////////////////////////////////////////////////////////////////////////////// 1967 | /////////////////////////////////////////////////////////////////////////////// 1968 | -------------------------------------------------------------------------------- /src/ER-TFTM0784-1.h: -------------------------------------------------------------------------------- 1 | #ifndef __ERTFT_H__ 2 | #define __ERTFT_H__ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "2828.h" 10 | #include "touch.h" 11 | 12 | // ---------------------------------------------------------------------------- 13 | // Declare the following externs in your sketch to configure your display 14 | // ---------------------------------------------------------------------------- 15 | 16 | // ---------------------------------------------------------------------------- 17 | // this sets the mode of communication with the RA8876 18 | // ---------------------------------------------------------------------------- 19 | 20 | extern uint8_t mode_8876; // 0: Parallel 16 bits 8080 21 | // 1: Parallel 8 bit 8080 22 | // 2: SPI 23 | 24 | // ---------------------------------------------------------------------------- 25 | // Pins used in both serial and parallel modes 26 | // ---------------------------------------------------------------------------- 27 | 28 | extern uint8_t RST_8876; // chip reset 29 | extern uint8_t NEXT_8876; // a button used on the buydisplay C8051 demo board 30 | 31 | // ---------------------------------------------------------------------------- 32 | // pins used in parallel 8/16 bit modes 33 | // ---------------------------------------------------------------------------- 34 | 35 | extern uint8_t RS_8876; 36 | extern uint8_t CS_PAR_8876; 37 | extern uint8_t WR_8876; 38 | extern uint8_t RD_8876; 39 | 40 | extern uint8_t D0; 41 | extern uint8_t D1; 42 | extern uint8_t D2; 43 | extern uint8_t D3; 44 | extern uint8_t D4; 45 | extern uint8_t D5; 46 | extern uint8_t D6; 47 | extern uint8_t D7; 48 | 49 | // ---------------------------------------------------------------------------- 50 | // pins used in parallel 16 bit mode 51 | // ---------------------------------------------------------------------------- 52 | 53 | extern uint8_t D8; 54 | extern uint8_t D9; 55 | extern uint8_t D10; 56 | extern uint8_t D11; 57 | extern uint8_t D12; 58 | extern uint8_t D13; 59 | extern uint8_t D14; 60 | extern uint8_t D15; 61 | 62 | extern volatile uint8_t * data_bus_l_dir; // used in 8 and 16 bit modes 63 | extern volatile uint8_t * data_bus_l; 64 | extern volatile uint8_t * data_bus_l_in; 65 | 66 | extern volatile uint8_t * data_bus_h_dir; // 16 bit mode only 67 | extern volatile uint8_t * data_bus_h; 68 | extern volatile uint8_t * data_bus_h_in; 69 | 70 | // ---------------------------------------------------------------------------- 71 | // pins used in SPI mode 72 | // ---------------------------------------------------------------------------- 73 | extern uint32_t SPI_SPEED_8876; 74 | extern uint8_t CS_SER_8876; 75 | extern uint8_t SDI_8876; 76 | extern uint8_t SDO_8876; 77 | extern uint8_t SCLK_8876; 78 | 79 | /* 80 | 81 | old pin definitions from the original BuyDisplay demo code for C8051 82 | 83 | sbit rs=P1^1; 84 | sbit cs=P1^0; 85 | sbit wr=P1^2; 86 | sbit rd=P1^3; 87 | sbit next =P3^5; //next 88 | sbit rst =P3^7; //next 89 | #define DATA_BUS_L P0 90 | #define DATA_BUS_H P2 91 | */ 92 | 93 | 94 | 95 | //----------------------------// 96 | 97 | /*==== [HW_(3)] SDRAM =====*/ 98 | //#define IS42SM16160D 99 | //#define IS42S16320B 100 | //#define IS42S16400F 101 | //#define M12L32162A 102 | //#define M12L2561616A 103 | //#define W9825G6JH 104 | //#define W9812G6JH 105 | #define W9812G6KH 106 | //#define MT48LC4M16A 107 | //#define K4S641632N 108 | //#define K4S281632K 109 | 110 | //------------------------------------------------------------------------------ 111 | // Software Setting 112 | //------------------------------------------------------------------------------ 113 | /*==== [SW_(1)] PLL =====*/ 114 | #define OSC_FREQ 10 // crystal clcok 115 | #define DRAM_FREQ 100 // SDRAM clock frequency, unti: MHz 116 | #define CORE_FREQ 100 // Core (system) clock frequency, unit: MHz 117 | #define SCAN_FREQ 50 // Panel Scan clock frequency, unit: MHz 118 | 119 | //=====[05h] b3-b1=====// 120 | //#define SCAN_DIVK1 // 000 121 | #define SCAN_DIVK2 // 001 122 | //#define SCAN_DIVK4 // 010 123 | //#define SCAN_DIVK8 // 011 124 | //#define SCAN_DIVK16 // 100 125 | //#define SCAN_DIVK32 // 101 126 | //#define SCAN_DIVK64 // 110 127 | //#define SCAN_DIVK128 // 111 128 | //=====[05h] b0 129 | #define SCAN_DIVM1 // 0 130 | //#define SCAN_DIVM2 // 1 131 | 132 | //=====[07h] b3-b1 133 | //#define DRAM_DIVK1 // 000 134 | #define DRAM_DIVK2 // 001 135 | //#define DRAM_DIVK4 // 010 136 | //#define DRAM_DIVK8 // 011 137 | //=====[07h] b0 138 | //#define DRAM_DIVM1 // 0 139 | //#define DRAM_DIVM2 // 1 140 | 141 | //=====[09h] b3-b1 142 | //#define CORE_DIVK1 // 000 143 | #define CORE_DIVK2 // 001 144 | //#define CORE_DIVK4 // 010 145 | //#define CORE_DIVK8 // 011 146 | //=====[09h] b0 147 | #define CORE_DIVM1 // 0 148 | //#define CORE_DIVM2 // 1 149 | 150 | #define color256_black 0x00 151 | #define color256_white 0xff 152 | #define color256_red 0xe0 153 | #define color256_green 0x1c 154 | #define color256_blue 0x03 155 | #define color256_yellow color256_red|color256_green 156 | #define color256_cyan color256_green|color256_blue 157 | #define color256_purple color256_red|color256_blue 158 | 159 | #define color65k_black 0x0000 160 | #define color65k_white 0xffff 161 | #define color65k_red 0xf800 162 | #define color65k_green 0x07e0 163 | #define color65k_blue 0x001f 164 | #define color65k_yellow color65k_red|color65k_green 165 | #define color65k_cyan color65k_green|color65k_blue 166 | #define color65k_purple color65k_red|color65k_blue 167 | 168 | #define color65k_grayscale1 2113 169 | #define color65k_grayscale2 2113*2 170 | #define color65k_grayscale3 2113*3 171 | #define color65k_grayscale4 2113*4 172 | #define color65k_grayscale5 2113*5 173 | #define color65k_grayscale6 2113*6 174 | #define color65k_grayscale7 2113*7 175 | #define color65k_grayscale8 2113*8 176 | #define color65k_grayscale9 2113*9 177 | #define color65k_grayscale10 2113*10 178 | #define color65k_grayscale11 2113*11 179 | #define color65k_grayscale12 2113*12 180 | #define color65k_grayscale13 2113*13 181 | #define color65k_grayscale14 2113*14 182 | #define color65k_grayscale15 2113*15 183 | #define color65k_grayscale16 2113*16 184 | #define color65k_grayscale17 2113*17 185 | #define color65k_grayscale18 2113*18 186 | #define color65k_grayscale19 2113*19 187 | #define color65k_grayscale20 2113*20 188 | #define color65k_grayscale21 2113*21 189 | #define color65k_grayscale22 2113*22 190 | #define color65k_grayscale23 2113*23 191 | #define color65k_grayscale24 2113*24 192 | #define color65k_grayscale25 2113*25 193 | #define color65k_grayscale26 2113*26 194 | #define color65k_grayscale27 2113*27 195 | #define color65k_grayscale28 2113*28 196 | #define color65k_grayscale29 2113*29 197 | #define color65k_grayscale30 2113*30 198 | 199 | #define color16M_black 0x00000000 200 | #define color16M_white 0x00ffffff 201 | #define color16M_red 0x00ff0000 202 | #define color16M_green 0x0000ff00 203 | #define color16M_blue 0x000000ff 204 | #define color16M_yellow color16M_red|color16M_green 205 | #define color16M_cyan color16M_green|color16M_blue 206 | #define color16M_purple color16M_red|color16M_blue 207 | 208 | #define White 0xFFFF 209 | #define Black 0x0000 210 | #define Grey 0xF7DE 211 | #define Blue 0x001F 212 | #define Blue2 0x051F 213 | #define Red 0xF800 214 | #define Magenta 0xF81F 215 | #define Green 0x07E0 216 | #define Cyan 0x7FFF 217 | #define Yellow 0xFFE0 218 | 219 | #define Line0 0 220 | #define Line1 24 221 | #define Line2 48 222 | #define Line3 72 223 | #define Line4 96 224 | #define Line5 120 225 | #define Line6 144 226 | #define Line7 168 227 | #define Line8 192 228 | #define Line9 216 229 | #define Line10 240 230 | #define Line11 264 231 | #define Line12 288 232 | #define Line13 312 233 | #define Line14 336 234 | #define Line15 360 235 | #define Line16 384 236 | #define Line17 408 237 | #define Line18 432 238 | #define Line19 456 239 | #define Line20 480 240 | #define Line21 504 241 | #define Line22 528 242 | #define Line23 552 243 | #define Line24 576 244 | #define Line25 600 245 | #define Line26 624 246 | #define Line27 648 247 | #define Line28 672 248 | #define Line29 696 249 | #define Line30 720 250 | #define Line31 744 251 | #define Line32 768 252 | #define Line33 792 253 | #define Line34 816 254 | #define Line35 840 255 | #define Line36 864 256 | #define Line37 888 257 | #define Line38 912 258 | #define Line39 936 259 | #define Line40 960 260 | #define Line41 984 261 | #define Line42 1008 262 | #define Line43 1032 263 | #define Line44 1056 264 | #define Line45 1080 265 | #define Line46 1104 266 | #define Line47 1128 267 | #define Line48 1152 268 | #define Line49 1176 269 | #define Line50 1200 270 | #define Line51 1224 271 | #define Line52 1248 272 | 273 | #define cSetb0 0x01 274 | #define cSetb1 0x02 275 | #define cSetb2 0x04 276 | #define cSetb3 0x08 277 | #define cSetb4 0x10 278 | #define cSetb5 0x20 279 | #define cSetb6 0x40 280 | #define cSetb7 0x80 281 | 282 | #define cClrb0 0xfe 283 | #define cClrb1 0xfd 284 | #define cClrb2 0xfb 285 | #define cClrb3 0xf7 286 | #define cClrb4 0xef 287 | #define cClrb5 0xdf 288 | #define cClrb6 0xbf 289 | #define cClrb7 0x7f 290 | 291 | 292 | const uint16_t ASCII_Table[] PROGMEM = 293 | { 294 | /* Space ' ' */ 295 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 296 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 297 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 298 | /* '!' */ 299 | 0x0000, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 300 | 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0000, 0x0000, 301 | 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 302 | /* '"' */ 303 | 0x0000, 0x0000, 0x00CC, 0x00CC, 0x00CC, 0x00CC, 0x00CC, 0x00CC, 304 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 305 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 306 | /* '#' */ 307 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0C60, 0x0C60, 308 | 0x0C60, 0x0630, 0x0630, 0x1FFE, 0x1FFE, 0x0630, 0x0738, 0x0318, 309 | 0x1FFE, 0x1FFE, 0x0318, 0x0318, 0x018C, 0x018C, 0x018C, 0x0000, 310 | /* '$' */ 311 | 0x0000, 0x0080, 0x03E0, 0x0FF8, 0x0E9C, 0x1C8C, 0x188C, 0x008C, 312 | 0x0098, 0x01F8, 0x07E0, 0x0E80, 0x1C80, 0x188C, 0x188C, 0x189C, 313 | 0x0CB8, 0x0FF0, 0x03E0, 0x0080, 0x0080, 0x0000, 0x0000, 0x0000, 314 | /* '%' */ 315 | 0x0000, 0x0000, 0x0000, 0x180E, 0x0C1B, 0x0C11, 0x0611, 0x0611, 316 | 0x0311, 0x0311, 0x019B, 0x018E, 0x38C0, 0x6CC0, 0x4460, 0x4460, 317 | 0x4430, 0x4430, 0x4418, 0x6C18, 0x380C, 0x0000, 0x0000, 0x0000, 318 | /* '&' */ 319 | 0x0000, 0x01E0, 0x03F0, 0x0738, 0x0618, 0x0618, 0x0330, 0x01F0, 320 | 0x00F0, 0x00F8, 0x319C, 0x330E, 0x1E06, 0x1C06, 0x1C06, 0x3F06, 321 | 0x73FC, 0x21F0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 322 | /* ''' */ 323 | 0x0000, 0x0000, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 324 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 325 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 326 | /* '(' */ 327 | 0x0000, 0x0200, 0x0300, 0x0180, 0x00C0, 0x00C0, 0x0060, 0x0060, 328 | 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 329 | 0x0060, 0x0060, 0x00C0, 0x00C0, 0x0180, 0x0300, 0x0200, 0x0000, 330 | /* ')' */ 331 | 0x0000, 0x0020, 0x0060, 0x00C0, 0x0180, 0x0180, 0x0300, 0x0300, 332 | 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 333 | 0x0300, 0x0300, 0x0180, 0x0180, 0x00C0, 0x0060, 0x0020, 0x0000, 334 | /* '*' */ 335 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00C0, 0x00C0, 336 | 0x06D8, 0x07F8, 0x01E0, 0x0330, 0x0738, 0x0000, 0x0000, 0x0000, 337 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 338 | /* '+' */ 339 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0180, 0x0180, 340 | 0x0180, 0x0180, 0x0180, 0x3FFC, 0x3FFC, 0x0180, 0x0180, 0x0180, 341 | 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 342 | /* ',' */ 343 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 344 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 345 | 0x0000, 0x0180, 0x0180, 0x0100, 0x0100, 0x0080, 0x0000, 0x0000, 346 | /* '-' */ 347 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 348 | 0x0000, 0x0000, 0x0000, 0x0000, 0x07E0, 0x07E0, 0x0000, 0x0000, 349 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 350 | /* '.' */ 351 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 352 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 353 | 0x0000, 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 354 | /* '/' */ 355 | 0x0000, 0x0C00, 0x0C00, 0x0600, 0x0600, 0x0600, 0x0300, 0x0300, 356 | 0x0300, 0x0380, 0x0180, 0x0180, 0x0180, 0x00C0, 0x00C0, 0x00C0, 357 | 0x0060, 0x0060, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 358 | /* '0' */ 359 | 0x0000, 0x03E0, 0x07F0, 0x0E38, 0x0C18, 0x180C, 0x180C, 0x180C, 360 | 0x180C, 0x180C, 0x180C, 0x180C, 0x180C, 0x180C, 0x0C18, 0x0E38, 361 | 0x07F0, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 362 | /* '1' */ 363 | 0x0000, 0x0100, 0x0180, 0x01C0, 0x01F0, 0x0198, 0x0188, 0x0180, 364 | 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 365 | 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 366 | /* '2' */ 367 | 0x0000, 0x03E0, 0x0FF8, 0x0C18, 0x180C, 0x180C, 0x1800, 0x1800, 368 | 0x0C00, 0x0600, 0x0300, 0x0180, 0x00C0, 0x0060, 0x0030, 0x0018, 369 | 0x1FFC, 0x1FFC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 370 | /* '3' */ 371 | 0x0000, 0x01E0, 0x07F8, 0x0E18, 0x0C0C, 0x0C0C, 0x0C00, 0x0600, 372 | 0x03C0, 0x07C0, 0x0C00, 0x1800, 0x1800, 0x180C, 0x180C, 0x0C18, 373 | 0x07F8, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 374 | /* '4' */ 375 | 0x0000, 0x0C00, 0x0E00, 0x0F00, 0x0F00, 0x0D80, 0x0CC0, 0x0C60, 376 | 0x0C60, 0x0C30, 0x0C18, 0x0C0C, 0x3FFC, 0x3FFC, 0x0C00, 0x0C00, 377 | 0x0C00, 0x0C00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 378 | /* '5' */ 379 | 0x0000, 0x0FF8, 0x0FF8, 0x0018, 0x0018, 0x000C, 0x03EC, 0x07FC, 380 | 0x0E1C, 0x1C00, 0x1800, 0x1800, 0x1800, 0x180C, 0x0C1C, 0x0E18, 381 | 0x07F8, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 382 | /* '6' */ 383 | 0x0000, 0x07C0, 0x0FF0, 0x1C38, 0x1818, 0x0018, 0x000C, 0x03CC, 384 | 0x0FEC, 0x0E3C, 0x1C1C, 0x180C, 0x180C, 0x180C, 0x1C18, 0x0E38, 385 | 0x07F0, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 386 | /* '7' */ 387 | 0x0000, 0x1FFC, 0x1FFC, 0x0C00, 0x0600, 0x0600, 0x0300, 0x0380, 388 | 0x0180, 0x01C0, 0x00C0, 0x00E0, 0x0060, 0x0060, 0x0070, 0x0030, 389 | 0x0030, 0x0030, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 390 | /* '8' */ 391 | 0x0000, 0x03E0, 0x07F0, 0x0E38, 0x0C18, 0x0C18, 0x0C18, 0x0638, 392 | 0x07F0, 0x07F0, 0x0C18, 0x180C, 0x180C, 0x180C, 0x180C, 0x0C38, 393 | 0x0FF8, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 394 | /* '9' */ 395 | 0x0000, 0x03E0, 0x07F0, 0x0E38, 0x0C1C, 0x180C, 0x180C, 0x180C, 396 | 0x1C1C, 0x1E38, 0x1BF8, 0x19E0, 0x1800, 0x0C00, 0x0C00, 0x0E1C, 397 | 0x07F8, 0x01F0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 398 | /* ':' */ 399 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0180, 0x0180, 400 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 401 | 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 402 | /* ';' */ 403 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0180, 0x0180, 404 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 405 | 0x0180, 0x0180, 0x0100, 0x0100, 0x0080, 0x0000, 0x0000, 0x0000, 406 | /* '<' */ 407 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 408 | 0x1000, 0x1C00, 0x0F80, 0x03E0, 0x00F8, 0x0018, 0x00F8, 0x03E0, 409 | 0x0F80, 0x1C00, 0x1000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 410 | /* '=' */ 411 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 412 | 0x1FF8, 0x0000, 0x0000, 0x0000, 0x1FF8, 0x0000, 0x0000, 0x0000, 413 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 414 | /* '>' */ 415 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 416 | 0x0008, 0x0038, 0x01F0, 0x07C0, 0x1F00, 0x1800, 0x1F00, 0x07C0, 417 | 0x01F0, 0x0038, 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 418 | /* '?' */ 419 | 0x0000, 0x03E0, 0x0FF8, 0x0C18, 0x180C, 0x180C, 0x1800, 0x0C00, 420 | 0x0600, 0x0300, 0x0180, 0x00C0, 0x00C0, 0x00C0, 0x0000, 0x0000, 421 | 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 422 | /* '@' */ 423 | 0x0000, 0x0000, 0x07E0, 0x1818, 0x2004, 0x29C2, 0x4A22, 0x4411, 424 | 0x4409, 0x4409, 0x4409, 0x2209, 0x1311, 0x0CE2, 0x4002, 0x2004, 425 | 0x1818, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 426 | /* 'A' */ 427 | 0x0000, 0x0380, 0x0380, 0x06C0, 0x06C0, 0x06C0, 0x0C60, 0x0C60, 428 | 0x1830, 0x1830, 0x1830, 0x3FF8, 0x3FF8, 0x701C, 0x600C, 0x600C, 429 | 0xC006, 0xC006, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 430 | /* 'B' */ 431 | 0x0000, 0x03FC, 0x0FFC, 0x0C0C, 0x180C, 0x180C, 0x180C, 0x0C0C, 432 | 0x07FC, 0x0FFC, 0x180C, 0x300C, 0x300C, 0x300C, 0x300C, 0x180C, 433 | 0x1FFC, 0x07FC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 434 | /* 'C' */ 435 | 0x0000, 0x07C0, 0x1FF0, 0x3838, 0x301C, 0x700C, 0x6006, 0x0006, 436 | 0x0006, 0x0006, 0x0006, 0x0006, 0x0006, 0x6006, 0x700C, 0x301C, 437 | 0x1FF0, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 438 | /* 'D' */ 439 | 0x0000, 0x03FE, 0x0FFE, 0x0E06, 0x1806, 0x1806, 0x3006, 0x3006, 440 | 0x3006, 0x3006, 0x3006, 0x3006, 0x3006, 0x1806, 0x1806, 0x0E06, 441 | 0x0FFE, 0x03FE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 442 | /* 'E' */ 443 | 0x0000, 0x3FFC, 0x3FFC, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 444 | 0x1FFC, 0x1FFC, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 445 | 0x3FFC, 0x3FFC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 446 | /* 'F' */ 447 | 0x0000, 0x3FF8, 0x3FF8, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 448 | 0x1FF8, 0x1FF8, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 449 | 0x0018, 0x0018, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 450 | /* 'G' */ 451 | 0x0000, 0x0FE0, 0x3FF8, 0x783C, 0x600E, 0xE006, 0xC007, 0x0003, 452 | 0x0003, 0xFE03, 0xFE03, 0xC003, 0xC007, 0xC006, 0xC00E, 0xF03C, 453 | 0x3FF8, 0x0FE0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 454 | /* 'H' */ 455 | 0x0000, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 456 | 0x3FFC, 0x3FFC, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 457 | 0x300C, 0x300C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 458 | /* 'I' */ 459 | 0x0000, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 460 | 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 461 | 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 462 | /* 'J' */ 463 | 0x0000, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 464 | 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0618, 0x0618, 0x0738, 465 | 0x03F0, 0x01E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 466 | /* 'K' */ 467 | 0x0000, 0x3006, 0x1806, 0x0C06, 0x0606, 0x0306, 0x0186, 0x00C6, 468 | 0x0066, 0x0076, 0x00DE, 0x018E, 0x0306, 0x0606, 0x0C06, 0x1806, 469 | 0x3006, 0x6006, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 470 | /* 'L' */ 471 | 0x0000, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 472 | 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 473 | 0x1FF8, 0x1FF8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 474 | /* 'M' */ 475 | 0x0000, 0xE00E, 0xF01E, 0xF01E, 0xF01E, 0xD836, 0xD836, 0xD836, 476 | 0xD836, 0xCC66, 0xCC66, 0xCC66, 0xC6C6, 0xC6C6, 0xC6C6, 0xC6C6, 477 | 0xC386, 0xC386, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 478 | /* 'N' */ 479 | 0x0000, 0x300C, 0x301C, 0x303C, 0x303C, 0x306C, 0x306C, 0x30CC, 480 | 0x30CC, 0x318C, 0x330C, 0x330C, 0x360C, 0x360C, 0x3C0C, 0x3C0C, 481 | 0x380C, 0x300C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 482 | /* 'O' */ 483 | 0x0000, 0x07E0, 0x1FF8, 0x381C, 0x700E, 0x6006, 0xC003, 0xC003, 484 | 0xC003, 0xC003, 0xC003, 0xC003, 0xC003, 0x6006, 0x700E, 0x381C, 485 | 0x1FF8, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 486 | /* 'P' */ 487 | 0x0000, 0x0FFC, 0x1FFC, 0x380C, 0x300C, 0x300C, 0x300C, 0x300C, 488 | 0x180C, 0x1FFC, 0x07FC, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 489 | 0x000C, 0x000C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 490 | /* 'Q' */ 491 | 0x0000, 0x07E0, 0x1FF8, 0x381C, 0x700E, 0x6006, 0xE003, 0xC003, 492 | 0xC003, 0xC003, 0xC003, 0xC003, 0xE007, 0x6306, 0x3F0E, 0x3C1C, 493 | 0x3FF8, 0xF7E0, 0xC000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 494 | /* 'R' */ 495 | 0x0000, 0x0FFE, 0x1FFE, 0x3806, 0x3006, 0x3006, 0x3006, 0x3806, 496 | 0x1FFE, 0x07FE, 0x0306, 0x0606, 0x0C06, 0x1806, 0x1806, 0x3006, 497 | 0x3006, 0x6006, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 498 | /* 'S' */ 499 | 0x0000, 0x03E0, 0x0FF8, 0x0C1C, 0x180C, 0x180C, 0x000C, 0x001C, 500 | 0x03F8, 0x0FE0, 0x1E00, 0x3800, 0x3006, 0x3006, 0x300E, 0x1C1C, 501 | 0x0FF8, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 502 | /* 'T' */ 503 | 0x0000, 0x7FFE, 0x7FFE, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 504 | 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 505 | 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 506 | /* 'U' */ 507 | 0x0000, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 508 | 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x1818, 509 | 0x1FF8, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 510 | /* 'V' */ 511 | 0x0000, 0x6003, 0x3006, 0x3006, 0x3006, 0x180C, 0x180C, 0x180C, 512 | 0x0C18, 0x0C18, 0x0E38, 0x0630, 0x0630, 0x0770, 0x0360, 0x0360, 513 | 0x01C0, 0x01C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 514 | /* 'W' */ 515 | 0x0000, 0x6003, 0x61C3, 0x61C3, 0x61C3, 0x3366, 0x3366, 0x3366, 516 | 0x3366, 0x3366, 0x3366, 0x1B6C, 0x1B6C, 0x1B6C, 0x1A2C, 0x1E3C, 517 | 0x0E38, 0x0E38, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 518 | /* 'X' */ 519 | 0x0000, 0xE00F, 0x700C, 0x3018, 0x1830, 0x0C70, 0x0E60, 0x07C0, 520 | 0x0380, 0x0380, 0x03C0, 0x06E0, 0x0C70, 0x1C30, 0x1818, 0x300C, 521 | 0x600E, 0xE007, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 522 | /* 'Y' */ 523 | 0x0000, 0xC003, 0x6006, 0x300C, 0x381C, 0x1838, 0x0C30, 0x0660, 524 | 0x07E0, 0x03C0, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 525 | 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 526 | /* 'Z' */ 527 | 0x0000, 0x7FFC, 0x7FFC, 0x6000, 0x3000, 0x1800, 0x0C00, 0x0600, 528 | 0x0300, 0x0180, 0x00C0, 0x0060, 0x0030, 0x0018, 0x000C, 0x0006, 529 | 0x7FFE, 0x7FFE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 530 | /* '[' */ 531 | 0x0000, 0x03E0, 0x03E0, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 532 | 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 533 | 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x03E0, 0x03E0, 0x0000, 534 | /* '\' */ 535 | 0x0000, 0x0030, 0x0030, 0x0060, 0x0060, 0x0060, 0x00C0, 0x00C0, 536 | 0x00C0, 0x01C0, 0x0180, 0x0180, 0x0180, 0x0300, 0x0300, 0x0300, 537 | 0x0600, 0x0600, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 538 | /* ']' */ 539 | 0x0000, 0x03E0, 0x03E0, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 540 | 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 541 | 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x03E0, 0x03E0, 0x0000, 542 | /* '^' */ 543 | 0x0000, 0x0000, 0x01C0, 0x01C0, 0x0360, 0x0360, 0x0360, 0x0630, 544 | 0x0630, 0x0C18, 0x0C18, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 545 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 546 | /* '_' */ 547 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 548 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 549 | 0x0000, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 550 | /* ''' */ 551 | 0x0000, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x0000, 552 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 553 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 554 | /* 'a' */ 555 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03F0, 0x07F8, 556 | 0x0C1C, 0x0C0C, 0x0F00, 0x0FF0, 0x0CF8, 0x0C0C, 0x0C0C, 0x0F1C, 557 | 0x0FF8, 0x18F0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 558 | /* 'b' */ 559 | 0x0000, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x03D8, 0x0FF8, 560 | 0x0C38, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x0C38, 561 | 0x0FF8, 0x03D8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 562 | /* 'c' */ 563 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03C0, 0x07F0, 564 | 0x0E30, 0x0C18, 0x0018, 0x0018, 0x0018, 0x0018, 0x0C18, 0x0E30, 565 | 0x07F0, 0x03C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 566 | /* 'd' */ 567 | 0x0000, 0x1800, 0x1800, 0x1800, 0x1800, 0x1800, 0x1BC0, 0x1FF0, 568 | 0x1C30, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1C30, 569 | 0x1FF0, 0x1BC0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 570 | /* 'e' */ 571 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03C0, 0x0FF0, 572 | 0x0C30, 0x1818, 0x1FF8, 0x1FF8, 0x0018, 0x0018, 0x1838, 0x1C30, 573 | 0x0FF0, 0x07C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 574 | /* 'f' */ 575 | 0x0000, 0x0F80, 0x0FC0, 0x00C0, 0x00C0, 0x00C0, 0x07F0, 0x07F0, 576 | 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 577 | 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 578 | /* 'g' */ 579 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0DE0, 0x0FF8, 580 | 0x0E18, 0x0C0C, 0x0C0C, 0x0C0C, 0x0C0C, 0x0C0C, 0x0C0C, 0x0E18, 581 | 0x0FF8, 0x0DE0, 0x0C00, 0x0C0C, 0x061C, 0x07F8, 0x01F0, 0x0000, 582 | /* 'h' */ 583 | 0x0000, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x07D8, 0x0FF8, 584 | 0x1C38, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 585 | 0x1818, 0x1818, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 586 | /* 'i' */ 587 | 0x0000, 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x00C0, 0x00C0, 588 | 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 589 | 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 590 | /* 'j' */ 591 | 0x0000, 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x00C0, 0x00C0, 592 | 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 593 | 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00F8, 0x0078, 0x0000, 594 | /* 'k' */ 595 | 0x0000, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x0C0C, 0x060C, 596 | 0x030C, 0x018C, 0x00CC, 0x006C, 0x00FC, 0x019C, 0x038C, 0x030C, 597 | 0x060C, 0x0C0C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 598 | /* 'l' */ 599 | 0x0000, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 600 | 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 601 | 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 602 | /* 'm' */ 603 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3C7C, 0x7EFF, 604 | 0xE3C7, 0xC183, 0xC183, 0xC183, 0xC183, 0xC183, 0xC183, 0xC183, 605 | 0xC183, 0xC183, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 606 | /* 'n' */ 607 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0798, 0x0FF8, 608 | 0x1C38, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 609 | 0x1818, 0x1818, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 610 | /* 'o' */ 611 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03C0, 0x0FF0, 612 | 0x0C30, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x0C30, 613 | 0x0FF0, 0x03C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 614 | /* 'p' */ 615 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03D8, 0x0FF8, 616 | 0x0C38, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x0C38, 617 | 0x0FF8, 0x03D8, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0000, 618 | /* 'q' */ 619 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1BC0, 0x1FF0, 620 | 0x1C30, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1C30, 621 | 0x1FF0, 0x1BC0, 0x1800, 0x1800, 0x1800, 0x1800, 0x1800, 0x0000, 622 | /* 'r' */ 623 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x07B0, 0x03F0, 624 | 0x0070, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 625 | 0x0030, 0x0030, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 626 | /* 's' */ 627 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03E0, 0x03F0, 628 | 0x0E38, 0x0C18, 0x0038, 0x03F0, 0x07C0, 0x0C00, 0x0C18, 0x0E38, 629 | 0x07F0, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 630 | /* 't' */ 631 | 0x0000, 0x0000, 0x0080, 0x00C0, 0x00C0, 0x00C0, 0x07F0, 0x07F0, 632 | 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 633 | 0x07C0, 0x0780, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 634 | /* 'u' */ 635 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1818, 0x1818, 636 | 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1C38, 637 | 0x1FF0, 0x19E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 638 | /* 'v' */ 639 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x180C, 0x0C18, 640 | 0x0C18, 0x0C18, 0x0630, 0x0630, 0x0630, 0x0360, 0x0360, 0x0360, 641 | 0x01C0, 0x01C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 642 | /* 'w' */ 643 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x41C1, 0x41C1, 644 | 0x61C3, 0x6363, 0x6363, 0x6363, 0x3636, 0x3636, 0x3636, 0x1C1C, 645 | 0x1C1C, 0x1C1C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 646 | /* 'x' */ 647 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x381C, 0x1C38, 648 | 0x0C30, 0x0660, 0x0360, 0x0360, 0x0360, 0x0360, 0x0660, 0x0C30, 649 | 0x1C38, 0x381C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 650 | /* 'y' */ 651 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3018, 0x1830, 652 | 0x1830, 0x1870, 0x0C60, 0x0C60, 0x0CE0, 0x06C0, 0x06C0, 0x0380, 653 | 0x0380, 0x0380, 0x0180, 0x0180, 0x01C0, 0x00F0, 0x0070, 0x0000, 654 | /* 'z' */ 655 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1FFC, 0x1FFC, 656 | 0x0C00, 0x0600, 0x0300, 0x0180, 0x00C0, 0x0060, 0x0030, 0x0018, 657 | 0x1FFC, 0x1FFC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 658 | /* '{' */ 659 | 0x0000, 0x0300, 0x0180, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 660 | 0x00C0, 0x0060, 0x0060, 0x0030, 0x0060, 0x0040, 0x00C0, 0x00C0, 661 | 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x0180, 0x0300, 0x0000, 0x0000, 662 | /* '|' */ 663 | 0x0000, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 664 | 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 665 | 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0000, 666 | /* '}' */ 667 | 0x0000, 0x0060, 0x00C0, 0x01C0, 0x0180, 0x0180, 0x0180, 0x0180, 668 | 0x0180, 0x0300, 0x0300, 0x0600, 0x0300, 0x0100, 0x0180, 0x0180, 669 | 0x0180, 0x0180, 0x0180, 0x0180, 0x00C0, 0x0060, 0x0000, 0x0000, 670 | /* '~' */ 671 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 672 | 0x10F0, 0x1FF8, 0x0F08, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 673 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 674 | }; 675 | 676 | 677 | const uint8_t gImage_busy_im[256] PROGMEM = 678 | { /* 0x00,0x02,0x20,0x00,0x20,0x00, */ 679 | 0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA, 680 | 0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x55,0x55,0x55,0x55,0x6A,0xAA, 681 | 0xAA,0xAA,0x54,0x00,0x00,0x05,0x6A,0xAA,0xAA,0xAA,0x55,0x55,0x55,0x55,0x6A,0xAA, 682 | 0xAA,0xAA,0x94,0x00,0x00,0x05,0xAA,0xAA,0xAA,0xAA,0x94,0x00,0x00,0x05,0xAA,0xAA, 683 | 0xAA,0xAA,0x94,0x44,0x44,0x45,0xAA,0xAA,0xAA,0xAA,0x94,0x11,0x11,0x05,0xAA,0xAA, 684 | 0xAA,0xAA,0x95,0x04,0x44,0x15,0xAA,0xAA,0xAA,0xAA,0xA5,0x41,0x10,0x56,0xAA,0xAA, 685 | 0xAA,0xAA,0xA9,0x50,0x41,0x5A,0xAA,0xAA,0xAA,0xAA,0xAA,0x54,0x05,0x6A,0xAA,0xAA, 686 | 0xAA,0xAA,0xAA,0x94,0x05,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x94,0x05,0xAA,0xAA,0xAA, 687 | 0xAA,0xAA,0xAA,0x94,0x45,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x94,0x05,0xAA,0xAA,0xAA, 688 | 0xAA,0xAA,0xAA,0x50,0x01,0x6A,0xAA,0xAA,0xAA,0xAA,0xA9,0x40,0x40,0x5A,0xAA,0xAA, 689 | 0xAA,0xAA,0xA5,0x00,0x10,0x16,0xAA,0xAA,0xAA,0xAA,0x94,0x00,0x00,0x05,0xAA,0xAA, 690 | 0xAA,0xAA,0x94,0x04,0x44,0x05,0xAA,0xAA,0xAA,0xAA,0x94,0x11,0x11,0x05,0xAA,0xAA, 691 | 0xAA,0xAA,0x94,0x44,0x44,0x45,0xAA,0xAA,0xAA,0xAA,0x95,0x11,0x11,0x15,0xAA,0xAA, 692 | 0xAA,0xAA,0x55,0x55,0x55,0x55,0x6A,0xAA,0xAA,0xAA,0x54,0x00,0x00,0x05,0x6A,0xAA, 693 | 0xAA,0xAA,0x55,0x55,0x55,0x55,0x6A,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA, 694 | 0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA, 695 | }; 696 | 697 | 698 | const uint8_t gImage_no_im[256] PROGMEM = 699 | { /* 0x00,0x02,0x20,0x00,0x20,0x00, */ 700 | 0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA, 701 | 0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x95,0x55,0xAA,0xAA,0xAA, 702 | 0xAA,0xAA,0xA9,0x40,0x00,0x5A,0xAA,0xAA,0xAA,0xAA,0x94,0x00,0x00,0x05,0xAA,0xAA, 703 | 0xAA,0xAA,0x40,0x00,0x00,0x00,0x6A,0xAA,0xAA,0xA9,0x00,0x15,0x55,0x00,0x1A,0xAA, 704 | 0xAA,0xA4,0x00,0x6A,0xAA,0x50,0x06,0xAA,0xAA,0xA4,0x00,0x6A,0xAA,0xA4,0x06,0xAA, 705 | 0xAA,0x90,0x00,0x1A,0xAA,0xA9,0x01,0xAA,0xAA,0x90,0x10,0x06,0xAA,0xA9,0x01,0xAA, 706 | 0xAA,0x40,0x64,0x01,0xAA,0xAA,0x40,0x6A,0xAA,0x40,0x69,0x00,0x6A,0xAA,0x40,0x6A, 707 | 0xAA,0x40,0x6A,0x40,0x1A,0xAA,0x40,0x6A,0xAA,0x40,0x6A,0x90,0x06,0xAA,0x40,0x6A, 708 | 0xAA,0x40,0x6A,0xA4,0x01,0xAA,0x40,0x6A,0xAA,0x40,0x6A,0xA9,0x00,0x6A,0x40,0x6A, 709 | 0xAA,0x40,0x6A,0xAA,0x40,0x1A,0x40,0x6A,0xAA,0x90,0x1A,0xAA,0x90,0x05,0x01,0xAA, 710 | 0xAA,0x90,0x1A,0xAA,0xA4,0x00,0x01,0xAA,0xAA,0xA4,0x06,0xAA,0xA9,0x00,0x06,0xAA, 711 | 0xAA,0xA4,0x01,0x6A,0xAA,0x40,0x06,0xAA,0xAA,0xA9,0x00,0x15,0x55,0x00,0x1A,0xAA, 712 | 0xAA,0xAA,0x40,0x00,0x00,0x00,0x6A,0xAA,0xAA,0xAA,0x94,0x00,0x00,0x05,0xAA,0xAA, 713 | 0xAA,0xAA,0xA9,0x40,0x00,0x5A,0xAA,0xAA,0xAA,0xAA,0xAA,0x95,0x55,0xAA,0xAA,0xAA, 714 | 0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA, 715 | 0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA, 716 | }; 717 | 718 | const uint8_t gImage_arrow_il[256] PROGMEM = 719 | { /* 0x00,0x02,0x20,0x00,0x20,0x00, */ 720 | 0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x6A,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA, 721 | 0x5A,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x46,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA, 722 | 0x41,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x40,0x6A,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA, 723 | 0x40,0x1A,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x40,0x06,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA, 724 | 0x40,0x01,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x40,0x00,0x6A,0xAA,0xAA,0xAA,0xAA,0xAA, 725 | 0x40,0x00,0x1A,0xAA,0xAA,0xAA,0xAA,0xAA,0x40,0x00,0x06,0xAA,0xAA,0xAA,0xAA,0xAA, 726 | 0x40,0x00,0x01,0xAA,0xAA,0xAA,0xAA,0xAA,0x40,0x00,0x00,0x6A,0xAA,0xAA,0xAA,0xAA, 727 | 0x40,0x00,0x00,0x1A,0xAA,0xAA,0xAA,0xAA,0x40,0x00,0x00,0x06,0xAA,0xAA,0xAA,0xAA, 728 | 0x40,0x00,0x00,0x01,0xAA,0xAA,0xAA,0xAA,0x40,0x00,0x00,0x00,0x6A,0xAA,0xAA,0xAA, 729 | 0x40,0x00,0x15,0x55,0x5A,0xAA,0xAA,0xAA,0x40,0x10,0x1A,0xAA,0xAA,0xAA,0xAA,0xAA, 730 | 0x40,0x64,0x06,0xAA,0xAA,0xAA,0xAA,0xAA,0x41,0xA4,0x06,0xAA,0xAA,0xAA,0xAA,0xAA, 731 | 0x46,0xA9,0x01,0xAA,0xAA,0xAA,0xAA,0xAA,0x5A,0xA9,0x01,0xAA,0xAA,0xAA,0xAA,0xAA, 732 | 0x6A,0xAA,0x40,0x6A,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x40,0x6A,0xAA,0xAA,0xAA,0xAA, 733 | 0xAA,0xAA,0x90,0x1A,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x90,0x1A,0xAA,0xAA,0xAA,0xAA, 734 | 0xAA,0xAA,0xA4,0x06,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xA4,0x06,0xAA,0xAA,0xAA,0xAA, 735 | 0xAA,0xAA,0xA9,0x5A,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA, 736 | }; 737 | 738 | const uint8_t gImage_pen_il[256] PROGMEM = 739 | { /* 0x00,0x02,0x20,0x00,0x20,0x00, */ 740 | 0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA, 741 | 0x96,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x91,0x6A,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA, 742 | 0xA4,0x15,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xA4,0x00,0x6A,0xAA,0xAA,0xAA,0xAA,0xAA, 743 | 0xA9,0x01,0x1A,0xAA,0xAA,0xAA,0xAA,0xAA,0xA9,0x00,0x46,0xAA,0xAA,0xAA,0xAA,0xAA, 744 | 0xAA,0x40,0x51,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x90,0x14,0x6A,0xAA,0xAA,0xAA,0xAA, 745 | 0xAA,0xA4,0x05,0x1A,0xAA,0xAA,0xAA,0xAA,0xAA,0xA9,0x01,0x46,0xAA,0xAA,0xAA,0xAA, 746 | 0xAA,0xAA,0x40,0x51,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x90,0x14,0x6A,0xAA,0xAA,0xAA, 747 | 0xAA,0xAA,0xA4,0x05,0x1A,0xAA,0xAA,0xAA,0xAA,0xAA,0xA9,0x01,0x46,0xAA,0xAA,0xAA, 748 | 0xAA,0xAA,0xAA,0x40,0x51,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x90,0x14,0x69,0xAA,0xAA, 749 | 0xAA,0xAA,0xAA,0xA4,0x01,0x14,0x6A,0xAA,0xAA,0xAA,0xAA,0xA9,0x00,0x44,0x1A,0xAA, 750 | 0xAA,0xAA,0xAA,0xAA,0x40,0x11,0x06,0xAA,0xAA,0xAA,0xAA,0xAA,0x90,0x04,0x41,0xAA, 751 | 0xAA,0xAA,0xAA,0xAA,0xA4,0x01,0x10,0x6A,0xAA,0xAA,0xAA,0xAA,0xA9,0x00,0x44,0x1A, 752 | 0xAA,0xAA,0xAA,0xAA,0xAA,0x40,0x11,0x1A,0xAA,0xAA,0xAA,0xAA,0xAA,0x90,0x04,0x1A, 753 | 0xAA,0xAA,0xAA,0xAA,0xAA,0xA4,0x01,0x1A,0xAA,0xAA,0xAA,0xAA,0xAA,0xA9,0x00,0x1A, 754 | 0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x40,0x6A,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x95,0xAA, 755 | 0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA, 756 | }; 757 | 758 | 759 | //-- 760 | 761 | void LCD_DataWrite(uint8_t data); 762 | void LCD_DataWrite16(uint16_t data); 763 | uint16_t LCD_DataRead(void); 764 | void LCD_CmdWrite(uint8_t Cmd); 765 | uint8_t LCD_StatusRead(void); 766 | 767 | void LCD_RegisterWrite(uint8_t Cmd,uint8_t Data); 768 | uint8_t LCD_RegisterRead(uint8_t Cmd); 769 | 770 | 771 | void RA8876_initial(void); 772 | //Set PLL 773 | void RA8876_PLL_Initial(void); 774 | //Set SDRAM 775 | void RA8876_SDRAM_initail(void); 776 | 777 | 778 | 779 | 780 | //**Staus**// 781 | void Check_Mem_WR_FIFO_not_Full(void); 782 | void Check_Mem_WR_FIFO_Empty(void); 783 | void Check_Mem_RD_FIFO_not_Full(void); 784 | void Check_Mem_RD_FIFO_not_Empty(void); 785 | void Check_2D_Busy(void); 786 | void Check_SDRAM_Ready(void); 787 | uint8_t Power_Saving_Status(void); 788 | void Check_Power_is_Normal(void);//�O Normal mode �N���} 789 | void Check_Power_is_Saving(void);//�O Saving mode �N���} 790 | void Check_NO_Interrupt(void);//�S�� Interrupt �N���} 791 | void Check_Interrupt_Occur(void);//�� Interrupt �N���} 792 | 793 | void Check_Busy_Draw(void); 794 | void Check_Busy_SFI_DMA(void); 795 | 796 | //**[00h]**// 797 | void RA8876_SW_Reset(void); 798 | //**[01h]**// 799 | void Enable_PLL(void); 800 | void RA8876_Sleep(void); 801 | void RA8876_WakeUp(void); 802 | void TFT_24bit(void); 803 | void TFT_18bit(void); 804 | void TFT_16bit(void); 805 | void TFT_LVDS(void); 806 | void Key_Scan_Enable(void); 807 | void Key_Scan_Disable(void); 808 | void RA8876_I2CM_Enable(void); 809 | void RA8876_I2CM_Disable(void); 810 | void Enable_SFlash_SPI(void); 811 | void Disable_SFlash_SPI(void); 812 | void Host_Bus_8bit(void); 813 | void Host_Bus_16bit(void); 814 | //**[02h]**// 815 | 816 | void RGB_8b_8bpp(void); 817 | void RGB_8b_16bpp(void); 818 | void RGB_8b_24bpp(void); 819 | 820 | void RGB_16b_8bpp(void); 821 | void RGB_16b_16bpp(void); 822 | void RGB_16b_24bpp_mode1(void); 823 | void RGB_16b_24bpp_mode2(void); 824 | 825 | void MemRead_Left_Right_Top_Down(void); 826 | void MemRead_Right_Left_Top_Down(void); 827 | void MemRead_Top_Down_Left_Right(void); 828 | void MemRead_Down_Top_Left_Right(void); 829 | 830 | void MemWrite_Left_Right_Top_Down(void); 831 | void MemWrite_Right_Left_Top_Down(void); 832 | void MemWrite_Top_Down_Left_Right(void); 833 | void MemWrite_Down_Top_Left_Right(void); 834 | //**[03h]**// 835 | void Interrupt_Active_Low(void); 836 | void Interrupt_Active_High(void); 837 | void ExtInterrupt_Debounce(void); 838 | void ExtInterrupt_Nodebounce(void); 839 | void ExtInterrupt_Input_Low_Level_Trigger(void); 840 | void ExtInterrupt_Input_High_Level_Trigger(void); 841 | void ExtInterrupt_Input_Falling_Edge_Trigger(void); 842 | void ExtInterrupt_Input_Rising_Edge_Trigger(void); 843 | void LVDS_Format1(void); 844 | void LVDS_Format2(void); 845 | void Graphic_Mode(void); 846 | void Text_Mode(void); 847 | void Memory_Select_SDRAM(void); 848 | void Memory_Select_Graphic_Cursor_RAM(void); 849 | void Memory_Select_Color_Palette_RAM(void); 850 | //**[05h]**// 851 | //**[06h]**// 852 | //**[07h]**// 853 | //**[09h]**// 854 | //**[0Ah]**// 855 | //**[0Bh]**// 856 | void Enable_Resume_Interrupt(void); 857 | void Disable_Resume_Interrupt(void); 858 | void Enable_ExtInterrupt_Input(void); 859 | void Disable_ExtInterrupt_Input(void); 860 | void Enable_I2CM_Interrupt(void); 861 | void Disable_I2CM_Interrupt(void); 862 | void Enable_Vsync_Interrupt(void); 863 | void Disable_Vsync_Interrupt(void); 864 | void Enable_KeyScan_Interrupt(void); 865 | void Disable_KeyScan_Interrupt(void); 866 | void Enable_DMA_Draw_BTE_Interrupt(void); 867 | void Disable_DMA_Draw_BTE_Interrupt(void); 868 | void Enable_PWM1_Interrupt(void); 869 | void Disable_PWM1_Interrupt(void); 870 | void Enable_PWM0_Interrupt(void); 871 | void Disable_PWM0_Interrupt(void); 872 | //**[0Ch]**// 873 | uint8_t Read_Interrupt_status(void); 874 | void Clear_Resume_Interrupt_Flag(void); 875 | void Clear_ExtInterrupt_Input_Flag(void); 876 | void Clear_I2CM_Interrupt_Flag(void); 877 | void Clear_Vsync_Interrupt_Flag(void); 878 | void Clear_KeyScan_Interrupt_Flag(void); 879 | void Clear_DMA_Draw_BTE_Interrupt_Flag(void); 880 | void Clear_PWM1_Interrupt_Flag(void); 881 | void Clear_PWM0_Interrupt_Flag(void); 882 | //**[0Dh]**// 883 | void Mask_Resume_Interrupt_Flag(void); 884 | void Mask_ExtInterrupt_Input_Flag(void); 885 | void Mask_I2CM_Interrupt_Flag(void); 886 | void Mask_Vsync_Interrupt_Flag(void); 887 | void Mask_KeyScan_Interrupt_Flag(void); 888 | void Mask_DMA_Draw_BTE_Interrupt_Flag(void); 889 | void Mask_PWM1_Interrupt_Flag(void); 890 | void Mask_PWM0_Interrupt_Flag(void); 891 | // 892 | void Enable_Resume_Interrupt_Flag(void); 893 | void Enable_ExtInterrupt_Input_Flag(void); 894 | void Enable_I2CM_Interrupt_Flag(void); 895 | void Enable_Vsync_Interrupt_Flag(void); 896 | void Enable_KeyScan_Interrupt_Flag(void); 897 | void Enable_DMA_Draw_BTE_Interrupt_Flag(void); 898 | void Enable_PWM1_Interrupt_Flag(void); 899 | void Enable_PWM0_Interrupt_Flag(void); 900 | //**[0Eh]**// 901 | void Enable_GPIOF_PullUp(void); 902 | void Enable_GPIOE_PullUp(void); 903 | void Enable_GPIOD_PullUp(void); 904 | void Enable_GPIOC_PullUp(void); 905 | void Enable_XDB15_8_PullUp(void); 906 | void Enable_XDB7_0_PullUp(void); 907 | void Disable_GPIOF_PullUp(void); 908 | void Disable_GPIOE_PullUp(void); 909 | void Disable_GPIOD_PullUp(void); 910 | void Disable_GPIOC_PullUp(void); 911 | void Disable_XDB15_8_PullUp(void); 912 | void Disable_XDB7_0_PullUp(void); 913 | 914 | //**[0Fh]**// 915 | void XPDAT18_Set_GPIO_D7(void); 916 | void XPDAT18_Set_KOUT4(void); 917 | void XPDAT17_Set_GPIO_D5(void); 918 | void XPDAT17_Set_KOUT2(void); 919 | void XPDAT16_Set_GPIO_D4(void); 920 | void XPDAT16_Set_KOUT1(void); 921 | void XPDAT9_Set_GPIO_D3(void); 922 | void XPDAT9_Set_KOUT3(void); 923 | void XPDAT8_Set_GPIO_D2(void); 924 | void XPDAT8_Set_KIN3(void); 925 | void XPDAT2_Set_GPIO_D6(void); 926 | void XPDAT2_Set_KIN4(void); 927 | void XPDAT1_Set_GPIO_D1(void); 928 | void XPDAT1_Set_KIN2(void); 929 | void XPDAT0_Set_GPIO_D0(void); 930 | void XPDAT0_Set_KIN1(void); 931 | 932 | //**[10h]**// 933 | void Enable_PIP1(void); 934 | void Disable_PIP1(void); 935 | void Enable_PIP2(void); 936 | void Disable_PIP2(void); 937 | void Select_PIP1_Parameter(void); 938 | void Select_PIP2_Parameter(void); 939 | void Select_Main_Window_8bpp(void); 940 | void Select_Main_Window_16bpp(void); 941 | void Select_Main_Window_24bpp(void); 942 | //**[11h]**// 943 | void Select_PIP1_Window_8bpp(void); 944 | void Select_PIP1_Window_16bpp(void); 945 | void Select_PIP1_Window_24bpp(void); 946 | void Select_PIP2_Window_8bpp(void); 947 | void Select_PIP2_Window_16bpp(void); 948 | void Select_PIP2_Window_24bpp(void); 949 | //**[12h]**// 950 | void PCLK_Rising(void); 951 | void PCLK_Falling(void); 952 | void Display_ON(void); 953 | void Display_OFF(void); 954 | void Color_Bar_ON(void); 955 | void Color_Bar_OFF(void); 956 | void HSCAN_L_to_R(void); 957 | void HSCAN_R_to_L(void); 958 | void VSCAN_T_to_B(void); 959 | void VSCAN_B_to_T(void); 960 | void PDATA_Set_RGB(void); 961 | void PDATA_Set_RBG(void); 962 | void PDATA_Set_GRB(void); 963 | void PDATA_Set_GBR(void); 964 | void PDATA_Set_BRG(void); 965 | void PDATA_Set_BGR(void); 966 | void PDATA_IDLE_STATE(void); 967 | 968 | //**[13h]**// 969 | void HSYNC_Low_Active(void); 970 | void HSYNC_High_Active(void); 971 | void VSYNC_Low_Active(void); 972 | void VSYNC_High_Active(void); 973 | void DE_Low_Active(void); 974 | void DE_High_Active(void); 975 | void Idle_DE_Low(void); 976 | void Idle_DE_High(void); 977 | void Idle_PCLK_Low(void); 978 | void Idle_PCLK_High(void); 979 | void Idle_PDAT_Low(void); 980 | void Idle_PDAT_High(void); 981 | void Idle_HSYNC_Low(void); 982 | void Idle_HSYNC_High(void); 983 | void Idle_VSYNC_Low(void); 984 | void Idle_VSYNC_High(void); 985 | //**[14h][15h][1Ah][1Bh]**// 986 | void LCD_HorizontalWidth_VerticalHeight(uint16_t WX,uint16_t HY); 987 | //**[16h][17h]**// 988 | void LCD_Horizontal_Non_Display(uint16_t WX); 989 | //**[18h]**// 990 | void LCD_HSYNC_Start_Position(uint16_t WX); 991 | //**[19h]**// 992 | void LCD_HSYNC_Pulse_Width(uint16_t WX); 993 | //**[1Ch][1Dh]**// 994 | void LCD_Vertical_Non_Display(uint16_t HY); 995 | //**[1Eh]**// 996 | void LCD_VSYNC_Start_Position(uint16_t HY); 997 | //**[1Fh]**// 998 | void LCD_VSYNC_Pulse_Width(uint16_t HY); 999 | //**[20h][21h][22h][23h]**// 1000 | void Main_Image_Start_Address(uint32_t Addr); 1001 | //**[24h][25h]**// 1002 | void Main_Image_Width(uint16_t WX); 1003 | //**[26h][27h][28h][29h]**// 1004 | void Main_Window_Start_XY(uint16_t WX,uint16_t HY); 1005 | //**[2Ah][2Bh][2Ch][2Dh]**// 1006 | void PIP_Display_Start_XY(uint16_t WX,uint16_t HY); 1007 | //**[2Eh][2Fh][30h][31h]**// 1008 | void PIP_Image_Start_Address(uint32_t Addr); 1009 | //**[32h][33h]**// 1010 | void PIP_Image_Width(uint16_t WX); 1011 | //**[34h][35h][36h][37h]**// 1012 | void PIP_Window_Image_Start_XY(uint16_t WX,uint16_t HY); 1013 | //**[38h][39h][3Ah][3Bh]**// 1014 | void PIP_Window_Width_Height(uint16_t WX,uint16_t HY); 1015 | //**[3C]**// 1016 | void Enable_Graphic_Cursor(void); 1017 | void Disable_Graphic_Cursor(void); 1018 | void Select_Graphic_Cursor_1(void); 1019 | void Select_Graphic_Cursor_2(void); 1020 | void Select_Graphic_Cursor_3(void); 1021 | void Select_Graphic_Cursor_4(void); 1022 | void Enable_Text_Cursor(void); 1023 | void Disable_Text_Cursor(void); 1024 | void Enable_Text_Cursor_Blinking(void); 1025 | void Disable_Text_Cursor_Blinking(void); 1026 | //**[3D]**// 1027 | void Blinking_Time_Frames(uint8_t temp); 1028 | //**[3E][3Fh]**// 1029 | void Text_Cursor_H_V(uint16_t WX,uint16_t HY); 1030 | //**[40h][41h][42h][43h]**// 1031 | void Graphic_Cursor_XY(uint16_t WX,uint16_t HY); 1032 | //**[44]**// 1033 | void Set_Graphic_Cursor_Color_1(uint8_t temp); 1034 | //**[45]**// 1035 | void Set_Graphic_Cursor_Color_2(uint8_t temp); 1036 | //**[50h][51h][52h][53h]**// 1037 | void Canvas_Image_Start_address(uint32_t Addr); 1038 | //**[54h][55h]**// 1039 | void Canvas_image_width(uint16_t WX); 1040 | //**[56h][57h][58h][59h]**// 1041 | void Active_Window_XY(uint16_t WX,uint16_t HY); 1042 | //**[5Ah][5Bh][5Ch][5Dh]**// 1043 | void Active_Window_WH(uint16_t WX,uint16_t HY); 1044 | //**[5E]**// 1045 | void Select_Write_Data_Position(void); 1046 | void Select_Read_Data_Position(void); 1047 | void Memory_XY_Mode(void); 1048 | void Memory_Linear_Mode(void); 1049 | void Memory_8bpp_Mode(void); 1050 | void Memory_16bpp_Mode(void); 1051 | void Memory_24bpp_Mode(void); 1052 | //**[5Fh][60h][61h][62h]**// 1053 | void Goto_Pixel_XY(uint16_t WX,uint16_t HY); 1054 | void Goto_Linear_Addr(uint32_t Addr); 1055 | //**[63h][64h][65h][66h]**// 1056 | void Goto_Text_XY(uint16_t WX,uint16_t HY); 1057 | 1058 | //////////////////////////////////////////////////////////////////////// 1059 | ////**** [ Function : Draw ] ****//// 1060 | //**[67h]**// 1061 | void Start_Line(void); 1062 | void Start_Triangle(void); 1063 | void Start_Triangle_Fill(void); 1064 | //**[68h]~[73h]**// 1065 | void Line_Start_XY(uint16_t WX,uint16_t HY); //�u�_�I 1066 | void Line_End_XY(uint16_t WX,uint16_t HY); //�u���I 1067 | void Triangle_Point1_XY(uint16_t WX,uint16_t HY); //�T��-�I1 1068 | void Triangle_Point2_XY(uint16_t WX,uint16_t HY); //�T��-�I2 1069 | void Triangle_Point3_XY (uint16_t WX,uint16_t HY); //�T��-�I3 1070 | void Square_Start_XY(uint16_t WX,uint16_t HY); //��_�I 1071 | void Square_End_XY(uint16_t WX,uint16_t HY); //����I 1072 | //**[76h]**// 1073 | void Start_Circle_or_Ellipse(void); 1074 | void Start_Circle_or_Ellipse_Fill(void); 1075 | void Start_Left_Down_Curve(void); 1076 | void Start_Left_Up_Curve(void); 1077 | void Start_Right_Up_Curve(void); 1078 | void Start_Right_Down_Curve(void); 1079 | void Start_Left_Down_Curve_Fill(void); 1080 | void Start_Left_Up_Curve_Fill(void); 1081 | void Start_Right_Up_Curve_Fill(void); 1082 | void Start_Right_Down_Curve_Fill(void); 1083 | void Start_Square(void); 1084 | void Start_Square_Fill(void); 1085 | void Start_Circle_Square(void); 1086 | void Start_Circle_Square_Fill(void); 1087 | //**[77h]~[7Eh]**// 1088 | void Circle_Center_XY(uint16_t WX,uint16_t HY); //�ꤤ�� 1089 | void Ellipse_Center_XY(uint16_t WX,uint16_t HY); //��ꤤ�� 1090 | void Circle_Radius_R(uint16_t WX); //��b�| 1091 | void Ellipse_Radius_RxRy(uint16_t WX,uint16_t HY); //���b�| 1092 | void Circle_Square_Radius_RxRy(uint16_t WX,uint16_t HY); //����ਤ�b�| 1093 | 1094 | //////////////////////////////////////////////////////////////////////// 1095 | ////**** [ Function : PWM ] ****//// 1096 | //**[84h]**// 1097 | void Set_PWM_Prescaler_1_to_256(uint16_t WX); 1098 | //**[85h]**// 1099 | void Select_PWM1_Clock_Divided_By_1(void); 1100 | void Select_PWM1_Clock_Divided_By_2(void); 1101 | void Select_PWM1_Clock_Divided_By_4(void); 1102 | void Select_PWM1_Clock_Divided_By_8(void); 1103 | void Select_PWM0_Clock_Divided_By_1(void); 1104 | void Select_PWM0_Clock_Divided_By_2(void); 1105 | void Select_PWM0_Clock_Divided_By_4(void); 1106 | void Select_PWM0_Clock_Divided_By_8(void); 1107 | //[85h].[bit3][bit2] 1108 | void Select_PWM1_is_ErrorFlag(void); 1109 | void Select_PWM1(void); 1110 | void Select_PWM1_is_Osc_Clock(void); 1111 | //[85h].[bit1][bit0] 1112 | void Select_PWM0_is_GPIO_C7(void); 1113 | void Select_PWM0(void); 1114 | void Select_PWM0_is_Core_Clock(void); 1115 | //**[86h]**// 1116 | //[86h]PWM1 1117 | void Enable_PWM1_Inverter(void); 1118 | void Disable_PWM1_Inverter(void); 1119 | void Auto_Reload_PWM1(void); 1120 | void One_Shot_PWM1(void); 1121 | void Start_PWM1(void); 1122 | void Stop_PWM1(void); 1123 | //[86h]PWM0 1124 | void Enable_PWM0_Dead_Zone(void); 1125 | void Disable_PWM0_Dead_Zone(void); 1126 | void Enable_PWM0_Inverter(void); 1127 | void Disable_PWM0_Inverter(void); 1128 | void Auto_Reload_PWM0(void); 1129 | void One_Shot_PWM0(void); 1130 | void Start_PWM0(void); 1131 | void Stop_PWM0(void); 1132 | //**[87h]**// 1133 | void Set_Timer0_Dead_Zone_Length(uint8_t temp); 1134 | //**[88h][89h]**// 1135 | void Set_Timer0_Compare_Buffer(uint16_t WX); 1136 | //**[8Ah][8Bh]**// 1137 | void Set_Timer0_Count_Buffer(uint16_t WX); 1138 | //**[8Ch][8Dh]**// 1139 | void Set_Timer1_Compare_Buffer(uint16_t WX); 1140 | //**[8Eh][8Fh]**// 1141 | void Set_Timer1_Count_Buffer(uint16_t WX); 1142 | 1143 | //////////////////////////////////////////////////////////////////////// 1144 | ////**** [ Function : BTE ] ****//// 1145 | //**[90h]**// 1146 | 1147 | //[90h]========================================================================= 1148 | void BTE_Enable(void); 1149 | void BTE_Disable(void); 1150 | 1151 | void Check_BTE_Busy(void); 1152 | 1153 | void Pattern_Format_8X8(void); 1154 | void Pattern_Format_16X16(void); 1155 | 1156 | //[91h]========================================================================= 1157 | void BTE_ROP_Code(uint8_t setx); 1158 | void BTE_Operation_Code(uint8_t setx); 1159 | 1160 | //[92h]========================================================================= 1161 | void BTE_S0_Color_8bpp(void); 1162 | void BTE_S0_Color_16bpp(void); 1163 | void BTE_S0_Color_24bpp(void); 1164 | 1165 | void BTE_S1_Color_8bpp(void); 1166 | void BTE_S1_Color_16bpp(void); 1167 | void BTE_S1_Color_24bpp(void); 1168 | void BTE_S1_Color_Constant(void); 1169 | void BTE_S1_Color_8bit_Alpha(void); 1170 | void BTE_S1_Color_16bit_Alpha(void); 1171 | 1172 | void BTE_Destination_Color_8bpp(void); 1173 | void BTE_Destination_Color_16bpp(void); 1174 | void BTE_Destination_Color_24bpp(void); 1175 | 1176 | //[93h][94h][95h][96h]========================================================================= 1177 | void BTE_S0_Memory_Start_Address(uint32_t Addr); 1178 | 1179 | //[97h][98h]========================================================================= 1180 | void BTE_S0_Image_Width(uint16_t WX); 1181 | 1182 | //[99h][9Ah][9Bh][9Ch]========================================================================= 1183 | void BTE_S0_Window_Start_XY(uint16_t WX,uint16_t HY); 1184 | 1185 | //[9Dh][9Eh][9Fh][A0h]========================================================================= 1186 | void BTE_S1_Memory_Start_Address(uint32_t Addr); 1187 | void S1_Constant_color_256(uint8_t temp); 1188 | void S1_Constant_color_65k(uint16_t temp); 1189 | void S1_Constant_color_16M(uint32_t temp); 1190 | 1191 | //[A1h][A2h]========================================================================= 1192 | void BTE_S1_Image_Width(uint16_t WX); 1193 | 1194 | //[A3h][A4h][A5h][A6h]========================================================================= 1195 | void BTE_S1_Window_Start_XY(uint16_t WX,uint16_t HY); 1196 | 1197 | //[A7h][A8h][A9h][AAh]========================================================================= 1198 | void BTE_Destination_Memory_Start_Address(uint32_t Addr); 1199 | 1200 | //[ABh][ACh]========================================================================= 1201 | void BTE_Destination_Image_Width(uint16_t WX); 1202 | 1203 | //[ADh][AEh][AFh][B0h]========================================================================= 1204 | void BTE_Destination_Window_Start_XY(uint16_t WX,uint16_t HY); 1205 | 1206 | //[B1h][B2h][B3h][B4h]========================================================================= 1207 | void BTE_Window_Size(uint16_t WX, uint16_t WY); 1208 | 1209 | //[B5h]========================================================================= 1210 | void BTE_Alpha_Blending_Effect(uint8_t temp); 1211 | 1212 | 1213 | //**[B5h]**// 1214 | 1215 | //////////////////////////////////////////////////////////////////////// 1216 | ////**** [ Function : Serial Flash ] ****//// 1217 | 1218 | 1219 | //REG[B6h] Serial flash DMA Controller REG (DMA_CTRL) 1220 | void Start_SFI_DMA(void); 1221 | void Check_Busy_SFI_DMA(void); 1222 | 1223 | //REG[B7h] Serial Flash/ROM Controller Register (SFL_CTRL) 1224 | void Select_SFI_0(void); 1225 | void Select_SFI_1(void); 1226 | void Select_SFI_Font_Mode(void); 1227 | void Select_SFI_DMA_Mode(void); 1228 | void Select_SFI_24bit_Address(void); 1229 | void Select_SFI_32bit_Address(void); 1230 | void Select_SFI_Waveform_Mode_0(void); 1231 | void Select_SFI_Waveform_Mode_3(void); 1232 | void Select_SFI_0_DummyRead(void); 1233 | void Select_SFI_8_DummyRead(void); 1234 | void Select_SFI_16_DummyRead(void); 1235 | void Select_SFI_24_DummyRead(void); 1236 | void Select_SFI_Single_Mode(void); 1237 | void Select_SFI_Dual_Mode0(void); 1238 | void Select_SFI_Dual_Mode1(void); 1239 | 1240 | //REG[B8h] SPI master Tx /Rx FIFO Data Register (SPIDR) 1241 | uint8_t SPI_Master_FIFO_Data_Put(uint8_t Data); 1242 | uint8_t SPI_Master_FIFO_Data_Get(void); 1243 | 1244 | //REG[B9h] SPI master Control Register (SPIMCR2) 1245 | void Mask_SPI_Master_Interrupt_Flag(void); 1246 | void Select_nSS_drive_on_xnsfcs0(void); 1247 | void Select_nSS_drive_on_xnsfcs1(void); 1248 | void nSS_Inactive(void); 1249 | void nSS_Active(void); 1250 | void OVFIRQEN_Enable(void); 1251 | void EMTIRQEN_Enable(void); 1252 | void Reset_CPOL(void); 1253 | void Set_CPOL(void); 1254 | void Reset_CPHA(void); 1255 | void Set_CPHA(void); 1256 | 1257 | //REG[BAh] SPI master Status Register (SPIMSR) 1258 | uint8_t Tx_FIFO_Empty_Flag(void); 1259 | uint8_t Tx_FIFO_Full_Flag(void); 1260 | uint8_t Rx_FIFO_Empty_Flag(void); 1261 | uint8_t Rx_FIFO_full_flag(void); 1262 | uint8_t OVFI_Flag(void); 1263 | void Clear_OVFI_Flag(void); 1264 | uint8_t EMTI_Flag(void); 1265 | void Clear_EMTI_Flag(void); 1266 | 1267 | //REG[BB] SPI Clock period (SPIDIV) 1268 | void SPI_Clock_Period(uint8_t temp); 1269 | 1270 | 1271 | //**[BCh][BDh][BEh][BFh]**// 1272 | void SFI_DMA_Source_Start_Address(uint32_t Addr); 1273 | //**[C0h][C1h][C2h][C3h]**// 1274 | void SFI_DMA_Destination_Start_Address(uint32_t Addr); 1275 | void SFI_DMA_Destination_Upper_Left_Corner(uint16_t WX,uint16_t HY); 1276 | //**[C4h][C5h]**// 1277 | void SFI_DMA_Destination_Width(uint16_t WX); 1278 | //**[C6h][C7h][C8h][C9h]**// 1279 | void SFI_DMA_Transfer_Number(uint32_t Addr); 1280 | void SFI_DMA_Transfer_Width_Height(uint16_t WX,uint16_t HY); 1281 | //**[CAh][CBh]**// 1282 | void SFI_DMA_Source_Width(uint16_t WX); 1283 | 1284 | //////////////////////////////////////////////////////////////////////// 1285 | ////**** [ Function : Font ] ****//// 1286 | //**[CCh]**// 1287 | 1288 | void Font_Select_UserDefine_Mode(void); 1289 | void CGROM_Select_Internal_CGROM(void); 1290 | void CGROM_Select_Genitop_FontROM(void); 1291 | void Font_Select_8x16_16x16(void); 1292 | void Font_Select_12x24_24x24(void); 1293 | void Font_Select_16x32_32x32(void); 1294 | void Internal_CGROM_Select_ISOIEC8859_1(void); 1295 | void Internal_CGROM_Select_ISOIEC8859_2(void); 1296 | void Internal_CGROM_Select_ISOIEC8859_3(void); 1297 | void Internal_CGROM_Select_ISOIEC8859_4(void); 1298 | //**[CDh]**// 1299 | void Enable_Font_Alignment(void); 1300 | void Disable_Font_Alignment(void); 1301 | void Font_Background_select_Transparency(void); 1302 | void Font_Background_select_Color(void); 1303 | void Font_0_degree(void); 1304 | void Font_90_degree(void); 1305 | void Font_Width_X1(void); 1306 | void Font_Width_X2(void); 1307 | void Font_Width_X3(void); 1308 | void Font_Width_X4(void); 1309 | void Font_Height_X1(void); 1310 | void Font_Height_X2(void); 1311 | void Font_Height_X3(void); 1312 | void Font_Height_X4(void); 1313 | //**[CEh]**// 1314 | void GTFont_Select_GT21L16TW_GT21H16T1W(void); 1315 | void GTFont_Select_GT23L16U2W(void); 1316 | void GTFont_Select_GT23L24T3Y_GT23H24T3Y(void); 1317 | void GTFont_Select_GT23L24M1Z(void); 1318 | void GTFont_Select_GT23L32S4W_GT23H32S4W(void); 1319 | void GTFont_Select_GT20L24F6Y(void); 1320 | void GTFont_Select_GT21L24S1W(void); 1321 | void GTFont_Select_GT22L16A1Y(void); 1322 | //**[CFh]**// 1323 | void Set_GTFont_Decoder(uint8_t temp); 1324 | //**[D0h]**// 1325 | void Font_Line_Distance(uint8_t temp); 1326 | //**[D1h]**// 1327 | void Set_Font_to_Font_Width(uint8_t temp); 1328 | //**[D2h]~[D4h]**// 1329 | void Foreground_RGB(uint8_t RED,uint8_t GREEN,uint8_t BLUE); 1330 | void Foreground_color_256(uint8_t temp); 1331 | void Foreground_color_65k(uint16_t temp); 1332 | void Foreground_color_16M(uint32_t temp); 1333 | //**[D5h]~[D7h]**// 1334 | void Background_RGB(uint8_t RED,uint8_t GREEN,uint8_t BLUE); 1335 | void Background_color_256(uint8_t temp); 1336 | void Background_color_65k(uint16_t temp); 1337 | void Background_color_16M(uint32_t temp); 1338 | //**[DBh]~[DEh]**// 1339 | void CGRAM_Start_address(uint32_t Addr); 1340 | //**[DFh]**// 1341 | void Power_Normal_Mode(void); 1342 | void Power_Saving_Standby_Mode(void); 1343 | void Power_Saving_Suspend_Mode(void); 1344 | void Power_Saving_Sleep_Mode(void); 1345 | 1346 | //////////////////////////////////////////////////////////////////////// 1347 | ////**** [ Function : SDRAM ] ****//// 1348 | //**[E0h]~[E4h]**// 1349 | // �����g�b RA8876_Select_SDRAM(); 1350 | 1351 | 1352 | //////////////////////////////////////////////////////////////////////// 1353 | ////**** [ Function : I2C ] ****//// 1354 | /*�t�~�إߧ���I2C In/Out ���n��*/ 1355 | //**[E5h]~[EAh]**// 1356 | void RA8876_I2CM_Clock_Prescale(uint16_t WX); 1357 | //**[E7h]**// 1358 | void RA8876_I2CM_Transmit_Data(uint8_t temp); 1359 | //**[E8h]**// 1360 | uint8_t RA8876_I2CM_Receiver_Data(void); 1361 | //**[E9h]**// 1362 | 1363 | void RA8876_I2CM_Read_With_Ack(void); 1364 | void RA8876_I2CM_Read_With_Nack(void); 1365 | void RA8876_I2CM_Write_With_Start(void); 1366 | void RA8876_I2CM_Write(void); 1367 | void RA8876_I2CM_Stop(void); 1368 | 1369 | 1370 | //**[EAh]**// 1371 | uint8_t RA8876_I2CM_Check_Slave_ACK(void); 1372 | uint8_t RA8876_I2CM_Bus_Busy(void); 1373 | uint8_t RA8876_I2CM_transmit_Progress(void); 1374 | uint8_t RA8876_I2CM_Arbitration(void); 1375 | 1376 | 1377 | 1378 | //////////////////////////////////////////////////////////////////////// 1379 | ////**** [ Function : GPIO ] ****//// 1380 | //[F0h][F1h] 1381 | void Set_GPIO_A_In_Out(uint8_t temp); 1382 | void Write_GPIO_A_7_0(uint8_t temp); 1383 | uint8_t Read_GPIO_A_7_0(void); 1384 | //[F2h] 1385 | void Write_GPIO_B_7_4(uint8_t temp); 1386 | uint8_t Read_GPIO_B_7_0(void); 1387 | //[F3h][F4h] 1388 | void Set_GPIO_C_In_Out(uint8_t temp); 1389 | void Write_GPIO_C_7_0(uint8_t temp); 1390 | uint8_t Read_GPIO_C_7_0(void); 1391 | //[F5h][F6h] 1392 | void Set_GPIO_D_In_Out(uint8_t temp); 1393 | void Write_GPIO_D_7_0(uint8_t temp); 1394 | uint8_t Read_GPIO_D_7_0(void); 1395 | //[F7h][F8h] 1396 | void Set_GPIO_E_In_Out(uint8_t temp); 1397 | void Write_GPIO_E_7_0(uint8_t temp); 1398 | uint8_t Read_GPIO_E_7_0(void); 1399 | //[F9h][FAh] 1400 | void Set_GPIO_F_In_Out(uint8_t temp); 1401 | void Write_GPIO_F_7_0(uint8_t temp); 1402 | uint8_t Read_GPIO_F_7_0(void); 1403 | 1404 | 1405 | //////////////////////////////////////////////////////////////////////// 1406 | ////**** [ Function : Key ] ****//// 1407 | //**[FBh]~[FFh]**// 1408 | //[FBh] 1409 | void Long_Key_enable(void); 1410 | void Key_Scan_Freg(uint8_t temp); //set bit2~0 1411 | 1412 | //[FCh] 1413 | void Key_Scan_Wakeup_Function_Enable(void); 1414 | void Long_Key_Timing_Adjustment(uint8_t setx);//set bit5~3 1415 | uint8_t Numbers_of_Key_Hit(void); 1416 | 1417 | //[FDh][FEh][FFh] 1418 | uint8_t Read_Key_Strobe_Data_0(void); 1419 | uint8_t Read_Key_Strobe_Data_1(void); 1420 | uint8_t Read_Key_Strobe_Data_2(void); 1421 | 1422 | void Show_String(char *str); 1423 | void Show_picture(uint32_t numbers,const uint16_t *datap); 1424 | void LCD_Clear(uint16_t Color); 1425 | void LCD_SetCursor(uint16_t Xpos, uint16_t Ypos); 1426 | void LCD_PutChar(uint16_t x,uint16_t y,uint8_t c,uint16_t charColor,uint16_t bkColor); 1427 | void LCD_DisplayString(uint16_t X,uint16_t Y, char *ptr, uint16_t charColor, uint16_t bkColor); 1428 | void LCD_SetPoint(uint16_t x,uint16_t y,uint16_t point); 1429 | void LCD_WriteRAM_Prepare(void); 1430 | void RA8876_HW_Reset(void); 1431 | 1432 | void Graphic_cursor_initial(void); 1433 | void Show_picture(uint32_t numbers,const uint16_t *datap); 1434 | 1435 | void RA8876_IO_Init(void); 1436 | 1437 | #endif 1438 | --------------------------------------------------------------------------------