根据例程触屏画板修改了一下,,但是发现要显示的字符一直在闪,,想要达到的目的是:触摸TIME字符,,字符变色,,,触摸OK,TIME字符变回原色,,我觉得给触屏的划定区域,然后点在区域内就应该有效果的,,不知道为什么不对,,
#include "stm32f10x.h"
#include "bsp_ili9341_lcd.h"
#include "bsp_SysTick.h"
#include "bsp_touch.h"
extern volatile unsigned char touch_flag;
struct POINT po;
int main(void)
{
SysTick_Init();
LCD_Init();
Lcd_GramScan(2);
LCD_Clear(0, 0, 320, 240, BACKGROUND);
/*------------------------------------------------------------------------------------------------------*/
Touch_Init();
while(Touch_Calibrate() !=0);
Palette_Init();
LCD_DispStr(50, 50, (uint8_t *)"Time", YELLOW);
LCD_DispStr(100, 100, (uint8_t *)"OK", YELLOW);
LCD_Clear(100, 180, 40, 30, YELLOW);
while( 1 )
{
if(touch_flag == 1)
{
if(Get_touch_point(&display, Read_2046_2(), &touch_para ) !=DISABLE)
{
if( po.x >50 | po.x<55 | po.y>50 | po.y<55)
{
LCD_DispStr(50, 50, (uint8_t *)&quot;Time&quot;, RED);
}
if( po.x >100 | po.x<105 | po.y>100 | po.y<105)
{
LCD_DispStr(50, 50, (uint8_t *)&quot;Time&quot;, YELLOW);
}
}
}
}
} |