You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.1 KiB
45 lines
1.1 KiB
4 months ago
|
#include "task_btn.h"
|
||
|
#include "../bsp/bsp_btn.h"
|
||
|
#include "../bsp/bsp_config.h"
|
||
|
#include "../msp/UART0.h"
|
||
|
|
||
|
void task_btn(void)
|
||
|
{
|
||
|
switch(g_Key)
|
||
|
{
|
||
|
case KEY_UP:
|
||
|
if(g_KeyActionFlag == LONG_KEY)
|
||
|
{
|
||
|
L0_uart0_uc('#');
|
||
|
L0_uart0_uchex(g_Key);
|
||
|
L0_uart0_0d0a();
|
||
|
g_Key = KEY_NULL;
|
||
|
g_KeyActionFlag = NULL_KEY;
|
||
|
}
|
||
|
else if(g_KeyActionFlag == SHORT_KEY)
|
||
|
{
|
||
|
L0_uart0_uc('@');
|
||
|
L0_uart0_uchex(g_Key);
|
||
|
L0_uart0_0d0a();
|
||
|
LED1 = ~LED1;
|
||
|
g_Key = KEY_NULL;
|
||
|
g_KeyActionFlag = NULL_KEY;
|
||
|
}
|
||
|
break;
|
||
|
case KEY_DOWN:
|
||
|
LED2 = ~LED2;
|
||
|
L0_uart0_uchex(g_Key);
|
||
|
L0_uart0_0d0a();
|
||
|
g_Key = KEY_NULL;
|
||
|
break;
|
||
|
case KEY_PWR:
|
||
|
LED4 = ~LED4;
|
||
|
L0_uart0_uchex(g_Key);
|
||
|
L0_uart0_0d0a();
|
||
|
g_Key = KEY_NULL;
|
||
|
break;
|
||
|
default: break;
|
||
|
}
|
||
|
}
|
||
|
|