From d5ac75385bcff564d7f22a5c419dca2b61eb7ef0 Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Sat, 2 Mar 2024 08:45:11 +1100 Subject: [PATCH] Fix up scanning for Djinn, post-asyncUSB. (#23188) --- keyboards/tzarc/djinn/djinn_portscan_matrix.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/keyboards/tzarc/djinn/djinn_portscan_matrix.c b/keyboards/tzarc/djinn/djinn_portscan_matrix.c index cb73c47def..ac81ad18c1 100644 --- a/keyboards/tzarc/djinn/djinn_portscan_matrix.c +++ b/keyboards/tzarc/djinn/djinn_portscan_matrix.c @@ -1,7 +1,8 @@ // Copyright 2018-2022 Nick Brassel (@tzarc) // SPDX-License-Identifier: GPL-2.0-or-later +#include +#include #include "quantum.h" -#include #include "djinn.h" #define GPIOB_BITMASK (1 << 13 | 1 << 14 | 1 << 15) // B13, B14, B15 @@ -34,6 +35,8 @@ void matrix_wait_for_port(stm32_gpio_t *port, uint32_t target_bitmask) { } } +static void dummy_vt_callback(virtual_timer_t *vtp, void *p) {} + void matrix_init_custom(void) { for (int i = 0; i < MATRIX_ROWS; ++i) { setPinInputHigh(row_pins[i]); @@ -41,6 +44,11 @@ void matrix_init_custom(void) { for (int i = 0; i < MATRIX_COLS; ++i) { setPinInputHigh(col_pins[i]); } + + // Start a virtual timer so we'll still get periodic wakeups, now that USB SOF doesn't wake up the main loop + static virtual_timer_t vt; + chVTObjectInit(&vt); + chVTSetContinuous(&vt, TIME_MS2I(10), dummy_vt_callback, NULL); } bool matrix_scan_custom(matrix_row_t current_matrix[]) {