[mw_shl_code=c,true]#include "led.h"
#include "delay.h"
#include "key.h"
#include "sys.h"
#include "lcd.h"
#include "usart.h"
#include "24cxx.h"
#include "flash.h"
#include "touch.h"
void Load_Drow_Dialog(void)
{
LCD_Clear(WHITE);
POINT_COLOR=BLUE;
LCD_ShowString(30,110,200,16,16,"PR0");
LCD_DrawRectangle(30,110,60,140);
}
const u16 POINT_COLOR_TBL[CT_MAX_TOUCH]={RED,GREEN,BLUE,BROWN,GRED};
void rtp_contral(void)
{
u8 key;
LED1=1;
while(1)
{
key=KEY_Scan(0);
tp_dev.scan(0);
if(tp_dev.sta&TP_PRES_DOWN)
{
if(tp_dev.x[0]<lcddev.width&&tp_dev.y[0]<lcddev.height)
{
if(tp_dev.x[0]>(30)&&tp_dev.x[0]<(60)&&tp_dev.y[0]<140&&tp_dev.y[0]>110)
LED1=!LED1;
}
} else delay_ms(10);
if(key==KEY_RIGHT)
{
LCD_Clear(WHITE);//????
TP_Adjust(); //??????×?
TP_Save_Adjdata();
Load_Drow_Dialog();
}
}
}
int main(void)
{
delay_init();
NVIC_Configuration();
uart_init(9600);
LED_Init();
LCD_Init();
KEY_Init();
tp_dev.init();
POINT_COLOR=RED;
LCD_ShowString(30,110,200,16,16,"Press PR0 to control the Compressor");
LCD_ShowString(60,140,200,16,16,"Press KEY0 to Adjust");
delay_ms(1500);
Load_Drow_Dialog();
rtp_contral(); [/mw_shl_code]
这是在原子哥给的例程修改的,结果是有时按一下灯闪亮一下,有时按下灯能保持亮,但关闭时又不灭,需要按几下才有反应,我想达到的结果一按就亮再按就灭。
求大家指正!!
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>