Data Sheet

©
RVT28AEFNWR00
Rev.1.2
10 INITIAL CODE
#define REG_GPIO 1057936UL
#define REG_GPIO_DIR 1057932UL
//Function which sends SPI (8-bit) data to FT80X
void SPI_FT_Send(uint8_t data)
{
unsigned char m=0x80;
for(i=0;i<8;i++)
{
GPIO_WriteBit(CLK,0);
if(data&m)
{
GPIO_WriteBit(SDO,1);
}
else
{
GPIO_WriteBit(SDO,0);
}
GPIO_WriteBit(CLK,1);
m=m>>1;
GPIO_WriteBit(CLK,0);
}
}
//Function which sets the CS for ILI9341 through FT80X registers
void CS_ILI(uint8_t mode)
{
switch (mode) {
case 0:
GPIO_WriteBit(FT_CS,0);
SPI_FT_Send(((REG_GPIO >> 16) & 0xBF | 0x80));
SPI_FT_Send((REG_GPIO & 0xFF00) >> 8);
SPI_FT_Send((REG_GPIO & 0xFF));
SPI_FT_Send(0x00);
GPIO_WriteBit(FT_CS,1);
break;
case 1:
GPIO_WriteBit(FT_CS,0);
SPI_FT_Send(((REG_GPIO >> 16) & 0xBF | 0x80));
SPI_FT_Send((REG_GPIO & 0xFF00) >> 8);
SPI_FT_Send((REG_GPIO & 0xFF));
SPI_FT_Send(0x83);
GPIO_WriteBit(GPIOA,FT_CS,1);
GPIO_WriteBit(SDO,0);
GPIO_WriteBit(CLK,0);
break;
}
}
//Function which sends SPI (9-bit) data to ILI9341
void ILI_Send(DC type, uint8_t data)
{
unsigned char m=0x80;
uint8_t i, test;
if(type == COMMAND)
{