Skip to content

Commit 7baf68d

Browse files
LaurentErneseivindj-nordic
authored andcommitted
lib: bm_buttons: Update trigger configuration for active high button
Fix the button configuration when an active high state is needed. The GPIO trigger is now configured according to `config.active_state` Signed-off-by: Laurent Ernes <[email protected]>
1 parent f5c3eb3 commit 7baf68d

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

doc/nrf-bm/release_notes/release_notes_changelog.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,10 @@ Bluetooth LE Services
242242

243243
* Renamed library from ``event_scheduler`` to ``bm_scheduler``.
244244

245+
* :ref:`lib_bm_buttons` library:
246+
247+
* Fixed the GPIO trigger configuration when the ``active_state`` is ``BM_BUTTONS_ACTIVE_HIGH``
248+
245249
Samples
246250
=======
247251

lib/bm_buttons/bm_buttons.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,16 +340,17 @@ int bm_buttons_init(struct bm_buttons_config const *configs, uint8_t num_configs
340340
global.num_configs = num_configs;
341341
global.detection_delay = detection_delay;
342342

343-
const nrfx_gpiote_trigger_config_t trigger_config = {
344-
.trigger = NRFX_GPIOTE_TRIGGER_HITOLO,
345-
};
346-
347343
const nrfx_gpiote_handler_config_t handler_config = {
348344
.handler = gpiote_evt_handler,
349345
};
350346

351347
for (int i = 0; i < num_configs; i++) {
352348
const nrf_gpio_pin_pull_t pull_config = configs[i].pull_config;
349+
const nrfx_gpiote_trigger_config_t trigger_config = {
350+
.trigger = (configs[i].active_state == BM_BUTTONS_ACTIVE_HIGH)
351+
? NRFX_GPIOTE_TRIGGER_LOTOHI
352+
: NRFX_GPIOTE_TRIGGER_HITOLO
353+
};
353354
const nrfx_gpiote_input_pin_config_t input_config = {
354355
.p_pull_config = &pull_config,
355356
.p_trigger_config = &trigger_config,

0 commit comments

Comments
 (0)