main.c
来自「博创2410的实验代码」· C语言 代码 · 共 44 行
C
44 行
#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 + =
减小字号Ctrl + -
显示快捷键?