projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update load cell channel based on repaired board and 1T load cell
[fw/altos]
/
src
/
drivers
/
ao_button.c
diff --git
a/src/drivers/ao_button.c
b/src/drivers/ao_button.c
index f6a9676bc481ad934b6d794625092a84f531f5d0..53728bceef47d99c26b54fe6ad58a637dc985c8c 100644
(file)
--- a/
src/drivers/ao_button.c
+++ b/
src/drivers/ao_button.c
@@
-19,6
+19,7
@@
#include <ao.h>
#include <ao_button.h>
#include <ao_exti.h>
#include <ao.h>
#include <ao_button.h>
#include <ao_exti.h>
+#include <ao_fast_timer.h>
#if AO_EVENT
#include <ao_event.h>
#define ao_button_queue(b,v) ao_event_put_isr(AO_EVENT_BUTTON, b, v)
#if AO_EVENT
#include <ao_event.h>
#define ao_button_queue(b,v) ao_event_put_isr(AO_EVENT_BUTTON, b, v)
@@
-37,7
+38,6
@@
static struct ao_button_state ao_button_state[AO_BUTTON_COUNT];
#define port(q) AO_BUTTON_ ## q ## _PORT
#define bit(q) AO_BUTTON_ ## q
#define port(q) AO_BUTTON_ ## q ## _PORT
#define bit(q) AO_BUTTON_ ## q
-#define pin(q) AO_BUTTON_ ## q ## _PIN
#ifndef AO_BUTTON_INVERTED
#define AO_BUTTON_INVERTED 1
#ifndef AO_BUTTON_INVERTED
#define AO_BUTTON_INVERTED 1
@@
-45,9
+45,9
@@
static struct ao_button_state ao_button_state[AO_BUTTON_COUNT];
#if AO_BUTTON_INVERTED
/* pins are inverted */
#if AO_BUTTON_INVERTED
/* pins are inverted */
-#define ao_button_value(b) !ao_gpio_get(port(b), bit(b)
, pin(b)
)
+#define ao_button_value(b) !ao_gpio_get(port(b), bit(b))
#else
#else
-#define ao_button_value(b) ao_gpio_get(port(b), bit(b)
, pin(b)
)
+#define ao_button_value(b) ao_gpio_get(port(b), bit(b))
#endif
static uint8_t
#endif
static uint8_t
@@
-150,12
+150,7
@@
ao_button_isr(void)
}
#define init(b) do { \
}
#define init(b) do { \
- ao_enable_port(port(b)); \
- \
- ao_exti_setup(port(b), bit(b), \
- AO_BUTTON_MODE|AO_EXTI_MODE_FALLING|AO_EXTI_MODE_RISING|AO_EXTI_PRIORITY_MED, \
- ao_button_isr); \
- ao_exti_enable(port(b), bit(b)); \
+ ao_enable_input(port(b), bit(b), AO_BUTTON_MODE); \
_ao_button_init(b); \
} while (0)
_ao_button_init(b); \
} while (0)
@@
-213,4
+208,6
@@
ao_button_init(void)
#if AO_BUTTON_COUNT > 16
#error too many buttons
#endif
#if AO_BUTTON_COUNT > 16
#error too many buttons
#endif
+ ao_fast_timer_init();
+ ao_fast_timer_on(ao_button_isr);
}
}