altos: Add 'ao_button_get' to button driver
authorKeith Packard <keithp@keithp.com>
Thu, 28 Jul 2016 04:28:34 +0000 (21:28 -0700)
committerKeith Packard <keithp@keithp.com>
Tue, 2 Aug 2016 23:55:11 +0000 (16:55 -0700)
This returns the current state of the button; useful to check what the
value is at startup.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/drivers/ao_button.c
src/drivers/ao_button.h

index 1be788a0c98b040b0c4dc0f211c29640cedb6927..725ac45a762334a6bdbf5a303d1bb028200081e6 100644 (file)
@@ -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)
 {
index fe5b590e3b9ea6cded2abcc9ec8a55a54573fd85..601472f93411dc516055134541a670c3d22de775 100644 (file)
@@ -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);