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.
71 lines
1.5 KiB
71 lines
1.5 KiB
////////////////////////////////////////////////////////////////////////////
|
|
///@copyright Copyright (c) 2018, 传控科技 All rights reserved.
|
|
///-------------------------------------------------------------------------
|
|
/// @file bsp_drv.c
|
|
/// @brief bsp @ driver config
|
|
///-------------------------------------------------------------------------
|
|
/// @version 1.0
|
|
/// @author CC
|
|
/// @date 20180331
|
|
/// @note cc_AS_stc02
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
#include "task_btn.h"
|
|
#include "../app/app_config.h"
|
|
#include "../bsp/bsp_config.h"
|
|
#include "../msp/uart0.h"
|
|
#include "../bsp/bsp_key.h"
|
|
#include "../bsp/bsp_led.h"
|
|
|
|
S_TASK_BTN _s_task_btn;
|
|
static int i;
|
|
static U8 key;
|
|
|
|
void L3_task_btn_init(void)
|
|
{
|
|
L1_task_init(&_s_task_btn.task);
|
|
L3_task_s_go(_s_task_btn,D_task_init);
|
|
}
|
|
|
|
#define D_task_BTN_SET 0x50
|
|
|
|
void L3_task_btn_handler(S_TASK_BTN *s)
|
|
{
|
|
TTSS_Task_init()
|
|
L2_task_go(D_task_BTN_SET);
|
|
|
|
TTSS_Task_step(D_task_BTN_SET)
|
|
key = bsp_key_scan();
|
|
if(key != BSP_KEY_NUM_MAX){
|
|
L0_uart0_uc('#');
|
|
L0_uart0_uchex(key);
|
|
|
|
//功能按键
|
|
if(key == 0)
|
|
{
|
|
R.func_btn = 1;
|
|
}
|
|
else
|
|
{
|
|
//如果不需要授权 or 需要但已经授权
|
|
if(!(R.auth_flag & 0xF0) || (R.auth_flag & 0x0F))
|
|
{
|
|
//L0_uart0_uc('$');
|
|
//L0_uart0_uchex(key);
|
|
|
|
//设置对应的rfid
|
|
L3_new_rfid(R.rfid_table[key], 0, 0xFF);
|
|
|
|
//亮灯
|
|
R.led_status[key] = BLED0_ON;
|
|
}
|
|
}
|
|
}
|
|
L2_task_go_Tdelay(D_task_BTN_SET,0);
|
|
|
|
TTSS_Task_end();
|
|
}
|
|
|
|
|
|
|
|
|
|
|