打印

触屏控制LCD上字的颜色

[复制链接]
239|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
求关注啊|  楼主 | 2019-11-28 17:54 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
根据例程触屏画板修改了一下,,但是发现要显示的字符一直在闪,,想要达到的目的是:触摸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 *)"Time", RED);
          }
        if( po.x >100 | po.x<105 | po.y>100 | po.y<105)   
         {
          LCD_DispStr(50, 50, (uint8_t *)"Time", YELLOW);
          }
   }   
     }
}  
  
}

使用特权

评论回复

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

380

主题

380

帖子

0

粉丝