📄 touch.c
字号:
/**************************************************************************************
* 名 称:
* 功 能:
* 参 数:
* 返 回 值:
*
* 修改历史:
* 版本 日期 作者
* ----------------------------------------------------
* 1.0 2008.8.13 孙逸洁 www.http://shop35330111.taobao.com
**************************************************************************************/
void touch_Init(void)
{
touch_CS=1;
touch_DCLK=1;
touch_DIN=1;
}
/**************************************************************************************
* 名 称:
* 功 能:
* 参 数:
* 返 回 值:
*
* 修改历史:
* 版本 日期 作者
* ----------------------------------------------------
* 1.0 2008.8.13 孙逸洁 www.http://shop35330111.taobao.com
**************************************************************************************/
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;
}
/**************************************************************************************
* 名 称:
* 功 能:
* 参 数:
* 返 回 值:
*
* 修改历史:
* 版本 日期 作者
* ----------------------------------------------------
* 1.0 2008.8.13 孙逸洁 www.http://shop35330111.taobao.com
**************************************************************************************/
void touch_GetAdXY(uint *x,uint *y)
{
*x=read_trouch(CHX);
*y=read_trouch(CHY);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -