diff options
author | Keith Packard <keithp@keithp.com> | 2017-04-02 19:31:45 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2017-04-02 19:31:45 -0700 |
commit | 79215de60d3e11b4abd1ecd2fa9575a323b76754 (patch) | |
tree | edde45fc2655b7b9d34a57562b68da9b6ee5bd7c | |
parent | 09f8710eb320f37f20dda8c635497c2b505d25e2 (diff) |
altos: Allow buttons to be high when pressed rather than low
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | src/drivers/ao_button.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/drivers/ao_button.c b/src/drivers/ao_button.c index 725ac45a..07e92c67 100644 --- 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) |