nRF Connect SDK Bare Metal API 2.0.99
Loading...
Searching...
No Matches

◆ bm_buttons_init()

int bm_buttons_init ( const struct bm_buttons_config * configs,
uint8_t num_configs,
uint32_t detection_delay )

#include <bm_buttons.h>

Initialize buttons.

This function will initialize the specified pins as buttons, and configure them.

Note
After this function returns, the configs configurations will still be referenced internally by the library. It is the user's responsibility to ensure that the configs configurations remain valid and exist until the end of the program or until bm_buttons_deinit is called. If the configs configurations are altered or destroyed prematurely, it will result in undefined behavior.
The bm_buttons_enable function must be called in order to enable the button detection.
Parameters
[in]configsArray of button configurations to be used.
[in]num_configsNumber of button configurations.
[in]detection_delayDelay (in microseconds) from a GPIOTE event until a button is reported as pressed. Must be higher than BM_BUTTONS_DETECTION_DELAY_MIN_US.
Return values
0on success.
-EPERMIf the bm_buttons library is already initialized.
-EINVALIf input data is invalid.
-EIOIf an error occurred.