1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- #ifndef SHOCK_SWITH_H__
- #define SHOCK_SWITH_H__
- #include <stdint.h>
- #include <stdbool.h>
- #include "boards.h"
- #include "nrf_drv_gpiote.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define SHOCK_CHECKOUT_INTERVAL 700
-
- typedef enum
- {
- SHOCK_SW_QUEUE_TIME=0,
- SHOCK_SW_QUEUE_INT=1,
- }SHOCK_SW_QUEUE_TYPE;
-
- typedef void (*shock_act_func)(bool stat);
- typedef enum
- {
- SHOCK_STAT_NULL = (uint8_t)0,
- SHOCK_STAT_STATIC = (uint8_t)1,
- SHOCK_STAT_SHOCK = (uint8_t)2,
- SHOCK_STAT_LAST = SHOCK_STAT_SHOCK,
- }shock_stat_e;
-
- typedef struct
- {
- bool shock_int_stat; //震动中断触发开启状态
- bool shock_check_stat; //震动检测状态
- shock_stat_e shock_stat; //当前震动状态
- uint8_t shock_stat_count; //震动触发次数
- shock_act_func shock_act; //震动状态触发
- }shock_struct_s;
- void shock_sw_timers_init(void);
- void Set_Shock_SW_Queue(SHOCK_SW_QUEUE_TYPE type);
- void shock_sw_event_enable(void);
- void shock_sw_event_disable(void);
- void shock_sw_int_init(nrf_drv_gpiote_in_config_t *config,nrfx_gpiote_evt_handler_t evt_handler);
- void shock_event_pro(void);
- bool get_shock_stat(void);
- void set_Shock_act_func(shock_act_func func);
- extern bool shock_stat;
- #ifdef __cplusplus
- }
- #endif
- #endif // SHOCK_BL_2030_H__
- /** @} */
|