BSP module. More...
Modules |
|
| BSP: ANT Button Module | |
|
Module for controlling ANT behavior through button actions.
|
|
| BSP: BLE Button Module | |
|
Module for controlling BLE behavior through button actions.
|
|
| NFC BSP Module | |
|
Module for setting the NFCT peripheral as a wakeup source.
|
|
Data Structures |
|
| struct | bsp_button_event_cfg_t |
Macros |
|
| #define | BSP_INIT_NONE 0 |
| #define | BSP_INIT_LED (1 << 0) |
| #define | BSP_INIT_BUTTONS (1 << 1) |
| #define | BSP_BUTTON_ACTION_PUSH ( APP_BUTTON_PUSH ) |
| #define | BSP_BUTTON_ACTION_RELEASE ( APP_BUTTON_RELEASE ) |
| #define | BSP_BUTTON_ACTION_LONG_PUSH (2) |
| #define | BSP_INDICATIONS_LIST |
| #define | BSP_BUTTON_ACTION_PUSH ( APP_BUTTON_PUSH ) |
| #define | BSP_BUTTON_ACTION_RELEASE ( APP_BUTTON_RELEASE ) |
| #define | BSP_BUTTON_ACTION_LONG_PUSH (2) |
| #define | BSP_MS_TO_TICK (MS) (m_app_ticks_per_100ms * (MS / 100)) |
| #define | BUTTON_ERASE_BONDING BSP_BUTTON_0_MASK |
| #define | BUTTON_ERASE_ALL BSP_BUTTON_1_MASK |
| #define | BUTTON_ADVERTISE BSP_BUTTON_0_MASK |
| #define | BUTTON_CLEAR_EVT BSP_BUTTON_1_MASK |
| #define | BUTTON_CAPSLOCK BSP_BUTTON_2_MASK |
| #define | BSP_BUTTONS_ALL 0xFFFFFFFF |
| #define | BSP_BUTTONS_NONE 0 |
| #define | BSP_LONG_PUSH_TIMEOUT_MS (1000) |
| #define | ADVERTISING_LED_ON_INTERVAL 200 |
|
Types of BSP initialization.
|
|
| #define | ADVERTISING_LED_OFF_INTERVAL 1800 |
| #define | ADVERTISING_DIRECTED_LED_ON_INTERVAL 200 |
| #define | ADVERTISING_DIRECTED_LED_OFF_INTERVAL 200 |
| #define | ADVERTISING_WHITELIST_LED_ON_INTERVAL 200 |
| #define | ADVERTISING_WHITELIST_LED_OFF_INTERVAL 800 |
| #define | ADVERTISING_SLOW_LED_ON_INTERVAL 400 |
| #define | ADVERTISING_SLOW_LED_OFF_INTERVAL 4000 |
| #define | BONDING_INTERVAL 100 |
| #define | SENT_OK_INTERVAL 100 |
| #define | SEND_ERROR_INTERVAL 500 |
| #define | RCV_OK_INTERVAL 100 |
| #define | RCV_ERROR_INTERVAL 500 |
| #define | ALERT_INTERVAL 200 |
| #define | BSP_LED_INDICATE_SENT_OK BSP_BOARD_LED_1 |
| #define | BSP_LED_INDICATE_SEND_ERROR BSP_BOARD_LED_1 |
| #define | BSP_LED_INDICATE_RCV_OK BSP_BOARD_LED_1 |
| #define | BSP_LED_INDICATE_RCV_ERROR BSP_BOARD_LED_1 |
| #define | BSP_LED_INDICATE_CONNECTED BSP_BOARD_LED_0 |
| #define | BSP_LED_INDICATE_BONDING BSP_BOARD_LED_0 |
| #define | BSP_LED_INDICATE_ADVERTISING_DIRECTED BSP_BOARD_LED_0 |
| #define | BSP_LED_INDICATE_ADVERTISING_SLOW BSP_BOARD_LED_0 |
| #define | BSP_LED_INDICATE_ADVERTISING_WHITELIST BSP_BOARD_LED_0 |
| #define | BSP_LED_INDICATE_INDICATE_ADVERTISING BSP_BOARD_LED_0 |
| #define | BSP_LED_INDICATE_USER_LED1 BSP_BOARD_LED_0 |
| #define | BSP_LED_INDICATE_USER_LED2 BSP_BOARD_LED_1 |
| #define | BSP_LED_INDICATE_USER_LED3 BSP_BOARD_LED_2 |
| #define | BSP_LED_INDICATE_USER_LED4 BSP_BOARD_LED_3 |
| #define | BSP_LED_ALERT BSP_BOARD_LED_2 |
Typedefs |
|
| typedef uint8_t | bsp_button_action_t |
| typedef void(* | bsp_event_callback_t )( bsp_event_t ) |
|
BSP module event callback function type.
More...
|
|
Functions |
|
| uint32_t | bsp_init (uint32_t type, uint32_t ticks_per_100ms, bsp_event_callback_t callback) |
|
Function for initializing BSP.
More...
|
|
| bool | bsp_button_is_pressed (uint32_t button) |
|
Function for checking button states.
More...
|
|
| uint32_t | bsp_event_to_button_action_assign (uint32_t button, bsp_button_action_t action, bsp_event_t event) |
|
Function for assigning a specific event to a button.
More...
|
|
| uint32_t | bsp_indication_set ( bsp_indication_t indicate) |
|
Function for configuring indicators to required state.
More...
|
|
| uint32_t | bsp_buttons_enable (void) |
|
Function for enabling all buttons.
More...
|
|
| uint32_t | bsp_buttons_disable (void) |
|
Function for disabling all buttons.
More...
|
|
| uint32_t | bsp_wakeup_button_enable (uint32_t button_idx) |
|
Function for enabling wakeup from SYSTEM OFF for given button.
More...
|
|
| uint32_t | bsp_wakeup_button_disable (uint32_t button_idx) |
|
Function for disabling wakeup for the given button.
More...
|
|
Detailed Description
BSP module.
This module provides a layer of abstraction from the board. It allows the user to indicate certain states on LEDs in a simple way. Module functionality can be modified by additional defines:
- BSP_SIMPLE reduces functionality of this module to enable and read state of the buttons
- BSP_UART_SUPPORT enables support for UART
This module provides a layer of abstraction from the board. It allows the user to indicate certain states on LEDs in a simple way. Module functionality can be modified by additional defines:
- BSP_SIMPLE - reduces functionality of this module to enable and read state of the buttons.
- BSP_UART_SUPPORT - enables support for UART.
Macro Definition Documentation
| #define BSP_BUTTON_ACTION_LONG_PUSH (2) |
Represents pushing and holding a button for BSP_LONG_PUSH_TIMEOUT_MS milliseconds. See also bsp_button_action_t .
| #define BSP_BUTTON_ACTION_LONG_PUSH (2) |
Represents pushing and holding a button for BSP_LONG_PUSH_TIMEOUT_MS milliseconds. See also bsp_button_action_t .
| #define BSP_BUTTON_ACTION_PUSH ( APP_BUTTON_PUSH ) |
Represents pushing a button. See bsp_button_action_t .
| #define BSP_BUTTON_ACTION_PUSH ( APP_BUTTON_PUSH ) |
Represents pushing a button. See bsp_button_action_t .
| #define BSP_BUTTON_ACTION_RELEASE ( APP_BUTTON_RELEASE ) |
Represents releasing a button. See bsp_button_action_t .
| #define BSP_BUTTON_ACTION_RELEASE ( APP_BUTTON_RELEASE ) |
Represents releasing a button. See bsp_button_action_t .
| #define BSP_INDICATIONS_LIST |
See BSP indication states for a list of how these states are indicated for the PCA10028/PCA10040 board and the PCA10031 dongle.
| #define BSP_INIT_BUTTONS (1 << 1) |
This bit enables buttons during initialization ( bsp_init ).
| #define BSP_INIT_LED (1 << 0) |
This bit enables LEDs during initialization ( bsp_init ).
| #define BSP_INIT_NONE 0 |
This define specifies the type of initialization without support for LEDs and buttons ( bsp_init ).
| #define BSP_LONG_PUSH_TIMEOUT_MS (1000) |
The time to hold for a long push (in milliseconds).
Typedef Documentation
| typedef uint8_t bsp_button_action_t |
The different actions that can be performed on a button.
| typedef void(* bsp_event_callback_t)( bsp_event_t ) |
BSP module event callback function type.
Upon an event in the BSP module, this callback function will be called to notify the application about the event.
- Parameters
-
[in] bsp_event_t BSP event type.
Enumeration Type Documentation
| enum bsp_event_t |
BSP events.
- Note
- Events from BSP_EVENT_KEY_0 to BSP_EVENT_KEY_LAST are by default assigned to buttons.
| enum bsp_indication_t |
BSP indication states.
See BSP indication states for a list of how these states are indicated for the PCA10028/PCA10040 board and the PCA10031 dongle.
| Enumerator | |
|---|---|
| BSP_INDICATE_IDLE |
See BSP_INDICATE_IDLE . |
| BSP_INDICATE_SCANNING |
See BSP_INDICATE_SCANNING . |
| BSP_INDICATE_ADVERTISING |
See BSP_INDICATE_ADVERTISING . |
| BSP_INDICATE_ADVERTISING_WHITELIST | |
| BSP_INDICATE_ADVERTISING_SLOW | |
| BSP_INDICATE_ADVERTISING_DIRECTED | |
| BSP_INDICATE_BONDING |
See BSP_INDICATE_BONDING . |
| BSP_INDICATE_CONNECTED |
See BSP_INDICATE_CONNECTED . |
| BSP_INDICATE_SENT_OK |
See BSP_INDICATE_SENT_OK . |
| BSP_INDICATE_SEND_ERROR |
See BSP_INDICATE_SEND_ERROR . |
| BSP_INDICATE_RCV_OK |
See BSP_INDICATE_RCV_OK . |
| BSP_INDICATE_RCV_ERROR |
See BSP_INDICATE_RCV_ERROR . |
| BSP_INDICATE_FATAL_ERROR |
See BSP_INDICATE_FATAL_ERROR . |
| BSP_INDICATE_ALERT_0 |
See BSP_INDICATE_ALERT_0 . |
| BSP_INDICATE_ALERT_1 |
See BSP_INDICATE_ALERT_1 . |
| BSP_INDICATE_ALERT_2 |
See BSP_INDICATE_ALERT_2 . |
| BSP_INDICATE_ALERT_3 |
See BSP_INDICATE_ALERT_3 . |
| BSP_INDICATE_ALERT_OFF |
See 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 | |
Function Documentation
| bool bsp_button_is_pressed | ( | uint32_t | button | ) |
Function for checking button states.
This function checks if the button is pressed. If the button ID is out of range, the function returns false.
- Parameters
-
[in] button Button ID to check.
- Return values
-
true If the button is pressed. false If the button is not pressed.
| uint32_t bsp_buttons_disable | ( | void | ) |
Function for disabling all buttons.
After calling this function, no buttons will generate events when pressed, and no buttons will be able to wake the system up from sleep mode.
- Return values
-
NRF_SUCCESS If the buttons were successfully disabled. NRF_ERROR_NOT_SUPPORTED If the board has no buttons or BSP_SIMPLE is defined.
- Returns
- A propagated error.
| uint32_t bsp_buttons_enable | ( | void | ) |
Function for enabling all buttons.
After calling this function, all buttons will generate events when pressed, and all buttons will be able to wake the system up from sleep mode.
- Return values
-
NRF_SUCCESS If the buttons were successfully enabled. NRF_ERROR_NOT_SUPPORTED If the board has no buttons or BSP_SIMPLE is defined.
- Returns
- A propagated error.
| uint32_t bsp_event_to_button_action_assign | ( | uint32_t | button , |
| bsp_button_action_t | action , | ||
| bsp_event_t | event | ||
| ) |
Function for assigning a specific event to a button.
This function allows redefinition of standard events assigned to buttons. To unassign events, provide the event BSP_EVENT_NOTHING .
- Parameters
-
[in] button Button ID to be redefined. [in] action Button action to assign event to. [in] event Event to be assigned to button.
- Return values
-
NRF_SUCCESS If the event was successfully assigned to button. NRF_ERROR_INVALID_PARAM If the button ID or button action was invalid.
| uint32_t bsp_indication_set | ( | bsp_indication_t | indicate | ) |
Function for configuring indicators to required state.
This function indicates the required state by means of LEDs (if enabled).
- Note
- Alerts are indicated independently.
- Parameters
-
[in] indicate State to be indicated.
- Return values
-
NRF_SUCCESS If the state was successfully indicated. NRF_ERROR_NO_MEM If the internal timer operations queue was full. NRF_ERROR_INVALID_STATE If the application timer module has not been initialized, or internal timer has not been created.
| uint32_t bsp_init | ( | uint32_t | type , |
| uint32_t | ticks_per_100ms , | ||
| bsp_event_callback_t | callback | ||
| ) |
Function for initializing BSP.
The function initializes the board support package to allow state indication and button reaction. Default events are assigned to buttons.
- Note
-
Before calling this function, you must initiate the following required modules:
- Application Timer for LED support
- GPIOTE Handler for button support
- UART module for UART support
- Parameters
-
[in] type Type of peripherals used. [in] ticks_per_100ms Number of RTC ticks for 100 ms. [in] callback Function to be called when button press/event is detected.
- Return values
-
NRF_SUCCESS If the BSP module was successfully initialized. NRF_ERROR_INVALID_STATE If the application timer module has not been initialized. NRF_ERROR_NO_MEM If the maximum number of timers has already been reached. NRF_ERROR_INVALID_PARAM If GPIOTE has too many users. NRF_ERROR_INVALID_STATE If button or GPIOTE has not been initialized.
| uint32_t bsp_wakeup_button_disable | ( | uint32_t | button_idx | ) |
Function for disabling wakeup for the given button.
- Parameters
-
[in] button_idx index of the button.
- Return values
-
NRF_SUCCESS If the button was successfully disabled. NRF_ERROR_NOT_SUPPORTED If the board has no buttons or BSP_SIMPLE is defined.
| uint32_t bsp_wakeup_button_enable | ( | uint32_t | button_idx | ) |
Function for enabling wakeup from SYSTEM OFF for given button.
After calling this function, button can be used to wake up the chip. This function should only be called immediately before going into sleep.
- Parameters
-
[in] button_idx Index of the button.
- Return values
-
NRF_SUCCESS If the button was successfully enabled. NRF_ERROR_NOT_SUPPORTED If the board has no buttons or BSP_SIMPLE is defined.