From 230721cd6271f3239b42e1d2471f8db15bebd712 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Fri, 24 Nov 2023 07:18:14 +1100 Subject: Periodically check int lines instead of relying on interrupts --- src/system_fsm/system_fsm.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/system_fsm/system_fsm.cpp') 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 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()) { transit(); -- cgit v1.2.3