| nRF5 SDK v12.0.0 |

Choose documentation: | nRF5 SDK | S130 SoftDevice API | S132 SoftDevice API | S212 SoftDevice API | S332 SoftDevice API

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Typedefs | Functions
BSP: BLE Button Module
Board Support Package

Module for controlling BLE behavior through button actions. More...

## Typedefs
typedef void(* | bsp_btn_ble_error_handler_t )(uint32_t nrf_error)
| BLE Button Module error handler type.

## Functions
uint32_t | bsp_btn_ble_init (bsp_btn_ble_error_handler_t error_handler, bsp_event_t *p_startup_bsp_evt)
| Function for initializing the BLE Button Module. More...
uint32_t | bsp_btn_ble_sleep_mode_prepare (void)
| Function for setting up wakeup buttons before going into sleep mode. More...
void | bsp_btn_ble_on_ble_evt (ble_evt_t *p_ble_evt)
| Function for handling the application's BLE stack events. More...

## Detailed Description

Module for controlling BLE behavior through button actions.

The application must propagate BLE events to the BLE Button Module. Based on these events, the BLE Button Module configures the Board Support Package to generate BSP events for certain button actions. These BSP events should then be handled by the application's BSP event handler.

## Function Documentation

uint32_t bsp_btn_ble_init | ( | bsp_btn_ble_error_handler_t | error_handler,
|  | bsp_event_t * | p_startup_bsp_evt
| ) |  |

Function for initializing the BLE Button Module.

Before calling this function, the BSP module must be initialized with buttons.

Parameters

  [out] | error_handler | Error handler to call in case of internal errors in BLE Button Module.
  [out] | p_startup_bsp_evt | If not a NULL pointer, the value is filled with an event (or BSP_EVENT_NOTHING) derived from the buttons pressed on startup. For example, if the bond delete wakeup button was pressed to wake up the device, *p_startup_bsp_evt is set to BSP_EVENT_CLEAR_BONDING_DATA.

Return values

  NRF_SUCCESS | If initialization was successful. Otherwise, a propagated error code is returned.

void bsp_btn_ble_on_ble_evt | ( | ble_evt_t * | p_ble_evt | ) |

Function for handling the application's BLE stack events.

This function handles all events from the BLE stack that are of interest to this module.

Parameters

  [in] | p_ble_evt | BLE stack event.

uint32_t bsp_btn_ble_sleep_mode_prepare | ( | void |  | ) |

Function for setting up wakeup buttons before going into sleep mode.

Return values

  NRF_SUCCESS | If the buttons were prepared successfully. Otherwise, a propagated error code is returned.