touch.c

来自「SPI INTERFACE驱动 IC为1289的TFT显示屏」· C语言 代码 · 共 31 行

C
31
字号
								   
//================================= 
void touch_Init(void)
{
    touch_CS=1;
    touch_DCLK=1;
    touch_DIN=1;
}
//================================= 
uint read_trouch (unsigned char cmd) 
{
	uint temp=0;
    uchar i;
	touch_CS=0;

	spi_send(cmd);		//命令
	temp=spi_send(0);	//读数
	i=spi_send(0);
	temp<<=8;
	temp|=i;
	temp>>=3;			 //读数据前有一个空脉冲

	touch_CS=1;
	return temp;
}
//================================= 
 void touch_GetAdXY(uint *x,uint *y) 
{
	*x=read_trouch(CHX);   
    *y=read_trouch(CHY);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?