123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- #ifndef APP_BUTTON_H__
- #define APP_BUTTON_H__
- #include <stdint.h>
- #include <stdbool.h>
- #include "nrf.h"
- #include "app_error.h"
- #include "nrf_gpio.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define APP_BUTTON_PUSH 1
- #define APP_BUTTON_RELEASE 0
- #define APP_BUTTON_ACTIVE_HIGH 1
- #define APP_BUTTON_ACTIVE_LOW 0
- typedef void (*app_button_handler_t)(uint8_t pin_no, uint8_t button_action);
- typedef struct
- {
- uint8_t pin_no;
- uint8_t active_state;
- #if defined(BUTTON_HIGH_ACCURACY_ENABLED) && (BUTTON_HIGH_ACCURACY_ENABLED == 1)
- bool hi_accuracy;
- #endif
- nrf_gpio_pin_pull_t pull_cfg;
- app_button_handler_t button_handler;
- } app_button_cfg_t;
- uint32_t app_button_init(app_button_cfg_t const * p_buttons,
- uint8_t button_count,
- uint32_t detection_delay);
- uint32_t app_button_enable(void);
- uint32_t app_button_disable(void);
- bool app_button_is_pushed(uint8_t button_id);
- #ifdef __cplusplus
- }
- #endif
- #endif
|