projects
/
fw
/
altos
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
09f8710
)
altos: Allow buttons to be high when pressed rather than low
author
Keith Packard
<keithp@keithp.com>
Mon, 3 Apr 2017 02:31:45 +0000
(19:31 -0700)
committer
Keith Packard
<keithp@keithp.com>
Mon, 3 Apr 2017 02:31:45 +0000
(19:31 -0700)
Signed-off-by: Keith Packard <keithp@keithp.com>
src/drivers/ao_button.c
patch
|
blob
|
history
diff --git
a/src/drivers/ao_button.c
b/src/drivers/ao_button.c
index 725ac45a762334a6bdbf5a303d1bb028200081e6..07e92c670f3a1c590aed332b875d3f8fc66e46b3 100644
(file)
--- a/
src/drivers/ao_button.c
+++ b/
src/drivers/ao_button.c
@@
-39,8
+39,16
@@
static struct ao_button_state ao_button_state[AO_BUTTON_COUNT];
#define bit(q) AO_BUTTON_ ## q
#define pin(q) AO_BUTTON_ ## q ## _PIN
+#ifndef AO_BUTTON_INVERTED
+#define AO_BUTTON_INVERTED 1
+#endif
+
+#if AO_BUTTON_INVERTED
/* pins are inverted */
#define ao_button_value(b) !ao_gpio_get(port(b), bit(b), pin(b))
+#else
+#define ao_button_value(b) ao_gpio_get(port(b), bit(b), pin(b))
+#endif
static uint8_t
_ao_button_get(uint8_t b)