123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307 |
- extern "C" {
- typedef uint8_t bsp_button_action_t;
- "BSP_INDICATE_IDLE", \
- "BSP_INDICATE_SCANNING", \
- "BSP_INDICATE_ADVERTISING", \
- "BSP_INDICATE_ADVERTISING_WHITELIST", \
- "BSP_INDICATE_ADVERTISING_SLOW", \
- "BSP_INDICATE_ADVERTISING_DIRECTED", \
- "BSP_INDICATE_BONDING", \
- "BSP_INDICATE_CONNECTED", \
- "BSP_INDICATE_SENT_OK", \
- "BSP_INDICATE_SEND_ERROR", \
- "BSP_INDICATE_RCV_OK", \
- "BSP_INDICATE_RCV_ERROR", \
- "BSP_INDICATE_FATAL_ERROR", \
- "BSP_INDICATE_ALERT_0", \
- "BSP_INDICATE_ALERT_1", \
- "BSP_INDICATE_ALERT_2", \
- "BSP_INDICATE_ALERT_3", \
- "BSP_INDICATE_ALERT_OFF", \
- "BSP_INDICATE_USER_STATE_OFF", \
- "BSP_INDICATE_USER_STATE_0", \
- "BSP_INDICATE_USER_STATE_1", \
- "BSP_INDICATE_USER_STATE_2", \
- "BSP_INDICATE_USER_STATE_3", \
- "BSP_INDICATE_USER_STATE_ON" \
- }
- typedef enum
- {
- BSP_INDICATE_FIRST = 0,
- BSP_INDICATE_IDLE = BSP_INDICATE_FIRST,
- BSP_INDICATE_SCANNING,
- BSP_INDICATE_ADVERTISING,
- BSP_INDICATE_ADVERTISING_WHITELIST,
- BSP_INDICATE_ADVERTISING_SLOW,
- BSP_INDICATE_ADVERTISING_DIRECTED,
- BSP_INDICATE_BONDING,
- BSP_INDICATE_CONNECTED,
- BSP_INDICATE_SENT_OK,
- BSP_INDICATE_SEND_ERROR,
- BSP_INDICATE_RCV_OK,
- BSP_INDICATE_RCV_ERROR,
- BSP_INDICATE_FATAL_ERROR,
- BSP_INDICATE_ALERT_0,
- BSP_INDICATE_ALERT_1,
- BSP_INDICATE_ALERT_2,
- BSP_INDICATE_ALERT_3,
- BSP_INDICATE_ALERT_OFF,
- BSP_INDICATE_USER_STATE_OFF,
- BSP_INDICATE_USER_STATE_0,
- BSP_INDICATE_USER_STATE_1,
- BSP_INDICATE_USER_STATE_2,
- BSP_INDICATE_USER_STATE_3,
- BSP_INDICATE_USER_STATE_ON,
- BSP_INDICATE_LAST = BSP_INDICATE_USER_STATE_ON
- } bsp_indication_t;
- typedef enum
- {
- BSP_EVENT_NOTHING = 0,
- BSP_EVENT_DEFAULT,
- BSP_EVENT_CLEAR_BONDING_DATA,
- BSP_EVENT_CLEAR_ALERT,
- BSP_EVENT_DISCONNECT,
- BSP_EVENT_ADVERTISING_START,
- BSP_EVENT_ADVERTISING_STOP,
- BSP_EVENT_WHITELIST_OFF,
- BSP_EVENT_BOND,
- BSP_EVENT_RESET,
- BSP_EVENT_SLEEP,
- BSP_EVENT_WAKEUP,
- BSP_EVENT_SYSOFF,
- BSP_EVENT_DFU,
- BSP_EVENT_KEY_0,
- BSP_EVENT_KEY_1,
- BSP_EVENT_KEY_2,
- BSP_EVENT_KEY_3,
- BSP_EVENT_KEY_4,
- BSP_EVENT_KEY_5,
- BSP_EVENT_KEY_6,
- BSP_EVENT_KEY_7,
- BSP_EVENT_KEY_LAST = BSP_EVENT_KEY_7,
- } bsp_event_t;
- typedef struct
- {
- bsp_event_t push_event
- bsp_event_t long_push_event
- bsp_event_t release_event
- } bsp_button_event_cfg_t;
- typedef void (* bsp_event_callback_t)(bsp_event_t);
- uint32_t bsp_init(uint32_t type, bsp_event_callback_t callback);
- bool bsp_button_is_pressed(uint32_t button);
- uint32_t bsp_event_to_button_action_assign(uint32_t button, bsp_button_action_t action, bsp_event_t event);
- uint32_t bsp_indication_set(bsp_indication_t indicate);
- uint32_t bsp_buttons_enable(void);
- uint32_t bsp_buttons_disable(void);
- uint32_t bsp_wakeup_button_enable(uint32_t button_idx);
- uint32_t bsp_wakeup_button_disable(uint32_t button_idx);
- }
|