From 128b98439c2fdd93d14e0daf2e99a7690e548d0c Mon Sep 17 00:00:00 2001 From: Markus Frey Date: Thu, 17 Feb 2022 11:43:07 +0100 Subject: [PATCH] Add function to get queue after initialization --- include/button.h | 1 + src/button.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/button.h b/include/button.h index 257489a..6762ee9 100644 --- a/include/button.h +++ b/include/button.h @@ -37,6 +37,7 @@ typedef struct { QueueHandle_t button_init(unsigned long long pin_select); QueueHandle_t pulled_button_init(unsigned long long pin_select, gpio_pull_mode_t pull_mode); +QueueHandle_t button_get_queue(void); #ifdef __cplusplus } diff --git a/src/button.c b/src/button.c index ad7a9eb..f1735c1 100644 --- a/src/button.c +++ b/src/button.c @@ -23,7 +23,7 @@ typedef struct { int pin_count = -1; debounce_t * debounce; -QueueHandle_t queue; +QueueHandle_t queue = NULL; static void update_button(debounce_t *d) { d->history = (d->history << 1) | gpio_get_level(d->pin); @@ -140,3 +140,7 @@ QueueHandle_t pulled_button_init(unsigned long long pin_select, gpio_pull_mode_t return queue; } + +QueueHandle_t button_get_queue(void) { + return queue; +}