bsp_key.h 923 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef _BSP_KEY_H
  2. #define _BSP_KEY_H
  3. // Key Property
  4. #define KEY_SCAN_TIMES 6 //按键防抖的扫描次数
  5. #define KEY_UP_TIMES 6 //抬键防抖的扫描次数
  6. #define KEY_LONG_TIMES 150 //长按键的次数
  7. #define KEY_HOLD_TIMES 35 //连按的频率次数
  8. #define KEY_LONG_HOLD_TIMES (KEY_LONG_TIMES + KEY_HOLD_TIMES)
  9. // Key ID
  10. #define KEY_ID_NO 0x00
  11. #define KEY_ID_PP 0x01
  12. #define KEY_ID_K1 0x02
  13. #define KEY_ID_K2 0x03
  14. #define KEY_ID_K3 0x04
  15. #define KEY_ID_K4 0x05
  16. typedef struct {
  17. u16 key_id;
  18. u16 key_press_cnt;
  19. u8 release_debounce_cnt;
  20. u8 power_on_flag;
  21. } key_status_typedef;
  22. void bsp_key_init(void);
  23. u16 bsp_key_scan(u8 mode);
  24. void bsp_key_set_power_on_flag(bool flag);
  25. bool bsp_key_get_power_on_flag(void);
  26. #endif // _BSP_KEY_H