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.
 
 
 
 

39 lines
668 B

/**
* 使用定时器来轮询Key_Scan()函数,定时节拍为2ms,
* 状态转换时间为10ms,即每次进入switch case语句的时间差为10ms
* 利用该10ms的间隙跳过按键抖动
*/
#ifndef _bsp_btn_H
#define _bsp_btn_H
// 区分长按和短按
typedef enum
{
NULL_KEY = 0,
SHORT_KEY = 1,
LONG_KEY = 2,
}KEY_TYPE;
// 按键状态:检测、确认、释放
typedef enum
{
KEY_CHECK = 0,
KEY_COMFIRM = 1,
KEY_RELEASE = 2,
}KEY_STATE;
// 按键值
typedef enum
{
KEY_NULL,
KEY_UP,
KEY_DOWN,
KEY_PWR,
}KEY_VALUE;
extern KEY_VALUE g_Key;
extern KEY_TYPE g_KeyActionFlag;
extern void Key_Scan(void);