uint16_t tftlcd_readData(void)
{
uint16_t gRamData;
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
GPIO_Init(LCD_DataPort, &GPIO_InitStructure);
LCD_CS(0);
LCD_RS(1);
LCD_RD(0);
LCD_WR(1);
gRamData = GPIO_ReadInputData(LCD_DataPort);
LCD_RD(1);
LCD_CS(1);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure);
return gRamData;
}
uint16_t tftlcd_readIndex(uint16_t cmd)
{
LCD_CS(0);
LCD_RS(0);
LCD_RD(0);
LCD_WR(1);
GPIO_Write(LCD_DataPort, cmd);
LCD_RD(1);
LCD_CS(1);
// return 0; //!
}
static __inline uint16_t tftlcd_readReg(uint16_t cmd)
{
tftlcd_readIndex(cmd);
delay_ms(100);
return tftlcd_readData();
}