📄 main.c
字号:
#include "../inc/lib.h"
#include <stdio.h>
#include "../inc/tchScr.h"
#include "../uhal/uhal.h"
#pragma import(__use_no_semihosting_swi) // ensure no functions that use semihosting
#define ADS7843_PIN_PEN (1<<5)//取中断信号
#define GPFDAT (*(volatile unsigned *)0x56000054)
#define TCHSCR_IsPenNotDown (GPFDAT&ADS7843_PIN_PEN)//触摸笔中断
/*************************************************
*TchScr_Test()-应用程序,当有触摸动作时调用
*函数TchScr_GetScrXY(x, y)获得(x,y)坐标
/*************************************************/
void TchScr_Test()
{
int *x,*y;
Uart_Printf(0,"\nplease touch the screen\n");
for(;;){
if(!TCHSCR_IsPenNotDown){
TchScr_GetScrXY(x, y);
Uart_Printf(0,"x=%d,\ty=%d\n",*x,*y);
hudelay(1000);//延时
}
else
continue;
}
}
/////////////////////////////////////////////////////
// Main function. //
////////////////////////////////////////////////////
int main(void)
{
ARMTargetInit(); //目标板初始化
TchScr_init(); //触摸屏初始化
TchScr_Test(); //应用程序
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -