X-Git-Url: https://git.gag.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Fdrivers%2Fao_button.c;h=4c18400a406d175725e599d2c62ca78b2f9989c2;hb=c49bd3cb0c31a51fae79ddc92237cc309be9a242;hp=c8103e884d3cd47bfacb5909a0034acafa41a325;hpb=0686a7b8aec524d81bda4c572549a3a068ce0eed;p=fw%2Faltos diff --git a/src/drivers/ao_button.c b/src/drivers/ao_button.c index c8103e88..4c18400a 100644 --- a/src/drivers/ao_button.c +++ b/src/drivers/ao_button.c @@ -19,6 +19,7 @@ #include #include #include +#include #if AO_EVENT #include #define ao_button_queue(b,v) ao_event_put_isr(AO_EVENT_BUTTON, b, v) @@ -124,7 +125,7 @@ _ao_button_check(uint8_t b) static void _ao_button_init(uint8_t b) { - uint8_t m = ao_arch_irqsave(); + uint32_t m = ao_arch_irqsave(); uint8_t value = _ao_button_get(b); ao_button_state[b].value = value; ao_button_state[b].time = ao_time(); @@ -149,12 +150,7 @@ ao_button_isr(void) } #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) @@ -212,4 +208,6 @@ ao_button_init(void) #if AO_BUTTON_COUNT > 16 #error too many buttons #endif + ao_fast_timer_init(); + ao_fast_timer_on(ao_button_isr); }