bsp_tkey.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef _BSP_TKEY_H
  2. #define _BSP_TKEY_H
  3. #define TKC_MAX_BITS 2
  4. #define TKC_MAX_SIZE (1 << TKC_MAX_BITS)
  5. typedef struct {
  6. u32 anov_thres;
  7. u8 sta;
  8. u8 stable_cnt;
  9. u16 cnt;
  10. } te_cali_cb_t;
  11. extern te_cali_cb_t te_cali_cb;
  12. ///请勿修改spp_tkcb_t结构体
  13. typedef struct {
  14. u16 tk_buf[16];
  15. u16 te_buf[16];
  16. char spp_buf[128];
  17. u8 tk_idx;
  18. u8 ch;
  19. volatile u8 tk_print_sta;
  20. u32 ticks;
  21. } spp_tkcb_t;
  22. extern spp_tkcb_t spp_tkcb;
  23. extern u16 tkcnt_tmr[4];
  24. void bsp_tkey_init(void);
  25. bool bsp_tkey_wakeup_en(void);
  26. u8 tkey_get_key(void);
  27. u8 tkey_is_inear(void); //入耳检测,0:无效,1:入耳,2:出耳
  28. u8 tkey_wakeup_status(void);
  29. void tkey_inear_disable(void);
  30. void bsp_tkey_spp_tx(void);
  31. void bsp_tkey_str_spp_tx(char *str);
  32. u8 touchear_is_online(void);
  33. bool touchear_is_wakeup(void);
  34. bool tkey_is_pressed(void);
  35. void bsp_bcnt_temp_calibration_start(void);
  36. void bsp_bcnt_temp_calibration(void);
  37. void bsp_bcnt_temp_calibration_stop(void);
  38. void tkey_press_timeout_clr(void);
  39. void tkey_press_timeout_process(void);
  40. #if USER_TKEY
  41. void bsp_charge_bcnt_calibration(u32 min_avg_cnt);
  42. void bsp_charge_tebcnt_calibration(void);
  43. void bsp_charge_tebcnt_calibration_stop(void);
  44. #else
  45. #define bsp_charge_bcnt_calibration(x)
  46. #define bsp_charge_tebcnt_calibration()
  47. #define bsp_charge_tebcnt_calibration_stop()
  48. #endif // USER_TKEY
  49. #endif