From 229d8b64ea9f88ba619bd4ac2e5fa7570f61bece Mon Sep 17 00:00:00 2001 From: Jacek Fedorynski Date: Sun, 8 Dec 2024 01:29:15 +0100 Subject: [PATCH] Fallback SOF timer Setup a timer to call manual_sof() again after 1050us in case we stop getting SOFs from host. --- firmware/src/remapper_single.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/firmware/src/remapper_single.cc b/firmware/src/remapper_single.cc index 09dd535..e6966dc 100644 --- a/firmware/src/remapper_single.cc +++ b/firmware/src/remapper_single.cc @@ -123,7 +123,14 @@ void send_out_report() { do_send_out_report(); } +static alarm_id_t fallback_sof_alarm = 0; + static int64_t __no_inline_not_in_flash_func(manual_sof)(alarm_id_t id, void* user_data) { + if (fallback_sof_alarm) { + cancel_alarm(fallback_sof_alarm); + } + fallback_sof_alarm = add_alarm_in_us(1050, manual_sof, NULL, false); + pio_usb_host_frame(); set_tick_pending(); return 0;