Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function to get queue after initialization #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/button.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
6 changes: 5 additions & 1 deletion src/button.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}