高级会员
- 积分
- 529
- 金钱
- 529
- 注册时间
- 2014-10-9
- 在线时间
- 145 小时
|
定时器中断
void TIM3_IRQHandler(void) //TIM3????
{
static u8 j=0;
j++;
if(0!=global_t) global_t--;
if (TIM_GetITStatus(TIM3, TIM_IT_Update) != RESET) //?ì?éTIM3?ü??????·??ú??·?
{
TIM_ClearITPendingBit(TIM3, TIM_IT_Update ); //????TIMx?ü??????±ê??
GUI_TOUCH_Exec();
// GUI_Exec();//GUI?????ü??
if(j>=50)
{
LED1=!LED1;
j=0;
}
}
}
ucgui触摸屏配置
#ifndef GUITOUCH_CONF_H
#define GUITOUCH_CONF_H
#include "ili93xx.h"
#define GUI_TOUCH_AD_LEFT 210 //×?×ó±?x?á??A/D?? ·?×?±ê??
#define GUI_TOUCH_AD_RIGHT 3880 //×???±?x?á??A/D?? ·?×?±ê??
#define GUI_TOUCH_AD_TOP 190 //×?×ó±?y?á??A/D?? ·?×?±ê??
#define GUI_TOUCH_AD_BOTTOM 3910 //×???±?y?á??A/D?? ·?×?±ê??
#define GUI_TOUCH_SWAP_XY 1
#define GUI_TOUCH_MIRROR_X 0
#define GUI_TOUCH_MIRROR_Y 1
int GUI_TOUCH_X_MeasureX(void) {
// u16 x,y;
tp_dev.scan(0);//?¨?è
return tp_dev.x[0];
}
int GUI_TOUCH_X_MeasureY(void) {
// u16 x,y;
tp_dev.scan(0);//?¨?è
return tp_dev.y[0];
}
主程序:
U16 global_t=0;
int main(void)
{
delay_init();
NVIC_Configuration();
uart_init(9600);
LED_Init();
KEY_Init();
TP_Init();
TIM3_Int_Init(99,7199);//10Khz,10ms;
GUI_Init();
GUI_SetBkColor(GUI_BLACK);
GUI_SetColor(GUI_WHITE);
GUI_Clear();
GUI_SetFont(&GUI_Font24_ASCII);
GUI_DispStringAt("- - STM32F103ZET6 - -",4,10);
GUI_DispStringAt("- - UCGUI3.98 - -",4,40);
GUI_DispStringAt("- - SUCCESSFULLY - -",4,70);
GUI_DispStringAt("- - 2015/03/30 - -",4,100);
global_t=200;//2S
while(global_t);
GUI_Clear();
GUI_SetFont(&GUI_Font32_ASCII);
GUI_DispStringHCenterAt("Start Test", 160, 100);
GUI_CURSOR_Show();
while(1)
{
LED0=!LED0;
GUI_Exec();
}
}
|
|