From: Keith Packard Date: Thu, 28 Jul 2016 04:28:34 +0000 (-0700) Subject: altos: Add 'ao_button_get' to button driver X-Git-Tag: 1.6.8~1^2~32 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=be84201495fa3cabd699012e57e797355e2bd792 altos: Add 'ao_button_get' to button driver This returns the current state of the button; useful to check what the value is at startup. Signed-off-by: Keith Packard --- diff --git a/src/drivers/ao_button.c b/src/drivers/ao_button.c index 1be788a0..725ac45a 100644 --- a/src/drivers/ao_button.c +++ b/src/drivers/ao_button.c @@ -93,6 +93,12 @@ _ao_button_init(uint8_t b) } +uint8_t +ao_button_get(uint8_t b) +{ + return ao_button_state[b].value; +} + static void ao_button_isr(void) { diff --git a/src/drivers/ao_button.h b/src/drivers/ao_button.h index fe5b590e..601472f9 100644 --- a/src/drivers/ao_button.h +++ b/src/drivers/ao_button.h @@ -19,6 +19,9 @@ #ifndef _AO_BUTTON_H_ #define _AO_BUTTON_H_ +uint8_t +ao_button_get(uint8_t b); + void ao_button_init(void);