You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
758 B

1 year ago
  1. #include "board_button.h"
  2. #include "app_button.h"
  3. #include "board.h"
  4. #include "znordic.h"
  5. #define BUTTON_DETECTION_DELAY APP_TIMER_TICKS(50)
  6. static board_button_cb_t m_cb;
  7. //
  8. void button_process_handler(uint8_t pin_no, uint8_t button_action) {}
  9. static app_button_cfg_t buttons[] = {
  10. {BUTTON_PIN, false, NRF_GPIO_PIN_PULLUP, button_process_handler},
  11. };
  12. void BoardButton_Init(board_button_cb_t cb) { //
  13. ZASSERT(app_button_init(buttons, ARRAY_SIZE(buttons), BUTTON_DETECTION_DELAY));
  14. }
  15. void BoardButton_load() { ZASSERT(app_button_enable()); }
  16. void BoardButton_unload() { ZASSERT(app_button_disable()); }
  17. void BoardButton_enable_sense() {
  18. app_button_disable();
  19. nrf_gpio_cfg_sense_input(BUTTON_PIN, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);
  20. }