bsp_btn_ble.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
  2. *
  3. * The information contained herein is property of Nordic Semiconductor ASA.
  4. * Terms and conditions of usage are described in detail in NORDIC
  5. * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
  6. *
  7. * Licensees are granted free, non-transferable use of the information. NO
  8. * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
  9. * the file.
  10. *
  11. */
  12. /**@file
  13. *
  14. * @defgroup bsp_btn_ble BSP: BLE Button Module
  15. * @{
  16. * @ingroup bsp
  17. *
  18. * @brief Module for controlling BLE behavior through button actions.
  19. *
  20. * @details The application must propagate BLE events to the BLE Button Module.
  21. * Based on these events, the BLE Button Module configures the Board Support Package
  22. * to generate BSP events for certain button actions. These BSP events should then be
  23. * handled by the application's BSP event handler.
  24. *
  25. */
  26. #ifndef BSP_BTN_BLE_H__
  27. #define BSP_BTN_BLE_H__
  28. #include <stdint.h>
  29. #include "ble.h"
  30. #include "bsp.h"
  31. /**@brief BLE Button Module error handler type. */
  32. typedef void (*bsp_btn_ble_error_handler_t) (uint32_t nrf_error);
  33. /**@brief Function for initializing the BLE Button Module.
  34. *
  35. * Before calling this function, the BSP module must be initialized with buttons.
  36. *
  37. * @param[out] error_handler Error handler to call in case of internal errors in BLE Button
  38. * Module.
  39. * @param[out] p_startup_bsp_evt If not a NULL pointer, the value is filled with an event
  40. * (or BSP_EVENT_NOTHING) derived from the buttons pressed on
  41. * startup. For example, if the bond delete wakeup button was pressed
  42. * to wake up the device, *p_startup_bsp_evt is set to
  43. * @ref BSP_EVENT_CLEAR_BONDING_DATA.
  44. *
  45. * @retval NRF_SUCCESS If initialization was successful. Otherwise, a propagated error code is
  46. * returned.
  47. */
  48. uint32_t bsp_btn_ble_init(bsp_btn_ble_error_handler_t error_handler, bsp_event_t * p_startup_bsp_evt);
  49. /**@brief Function for setting up wakeup buttons before going into sleep mode.
  50. *
  51. * @retval NRF_SUCCESS If the buttons were prepared successfully. Otherwise, a propagated error
  52. * code is returned.
  53. */
  54. uint32_t bsp_btn_ble_sleep_mode_prepare(void);
  55. /**@brief Function for handling the application's BLE stack events.
  56. *
  57. * @details This function handles all events from the BLE stack that are of interest to this module.
  58. *
  59. * @param[in] p_ble_evt BLE stack event.
  60. */
  61. void bsp_btn_ble_on_ble_evt(ble_evt_t * p_ble_evt);
  62. #endif /* BSP_BTN_BLE_H__ */
  63. /** @} */