diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-11-24 07:18:14 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-11-24 07:41:48 +1100 |
| commit | 230721cd6271f3239b42e1d2471f8db15bebd712 (patch) | |
| tree | cc27ec975261742dca8c9acf87b806f5933faae8 /src/system_fsm/system_fsm.cpp | |
| parent | 2b095948b81cbde28ac84e7a572d472301a50af1 (diff) | |
| download | tangara-fw-230721cd6271f3239b42e1d2471f8db15bebd712.tar.gz | |
Periodically check int lines instead of relying on interrupts
Diffstat (limited to 'src/system_fsm/system_fsm.cpp')
| -rw-r--r-- | src/system_fsm/system_fsm.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/system_fsm/system_fsm.cpp b/src/system_fsm/system_fsm.cpp index ca191324..9cca7eda 100644 --- a/src/system_fsm/system_fsm.cpp +++ b/src/system_fsm/system_fsm.cpp @@ -6,6 +6,7 @@ #include "system_fsm.hpp" #include "audio_fsm.hpp" +#include "driver/gpio.h" #include "event_queue.hpp" #include "gpios.hpp" #include "relative_wheel.hpp" @@ -23,6 +24,15 @@ std::unique_ptr<drivers::SdStorage> SystemState::sStorage; console::AppConsole* SystemState::sAppConsole; +void check_interrupts_cb(TimerHandle_t timer) { + if (!gpio_get_level(GPIO_NUM_34)) { + events::System().Dispatch(internal::GpioInterrupt{}); + } + if (!gpio_get_level(GPIO_NUM_35)) { + events::System().Dispatch(internal::SamdInterrupt{}); + } +} + void SystemState::react(const FatalError& err) { if (!is_in_state<states::Error>()) { transit<states::Error>(); |
