diff --git a/app/src/split/wired/central.c b/app/src/split/wired/central.c index 1284d4c7c..157092f78 100644 --- a/app/src/split/wired/central.c +++ b/app/src/split/wired/central.c @@ -119,6 +119,13 @@ static void send_pending_tx_work_cb(struct k_work *work); static K_WORK_DEFINE(wired_central_tx_work, send_pending_tx_work_cb); +static void read_timer_cb(struct k_timer *_timer) { + zmk_split_wired_poll_in(&rx_buf, uart, &publish_events, NULL); + // Check if we found any bytes, read some, or read all the bytes in the RX +} + +static K_TIMER_DEFINE(wired_central_read_timer, read_timer_cb, NULL); + #endif static void begin_tx(void) { @@ -285,13 +292,6 @@ static void send_pending_tx_work_cb(struct k_work *work) { zmk_split_wired_poll_out(&tx_buf, uart); } -static void read_timer_cb(struct k_timer *_timer) { - zmk_split_wired_poll_in(&rx_buf, uart, &publish_events, NULL); - // Check if we found any bytes, read some, or read all the bytes in the RX -} - -static K_TIMER_DEFINE(wired_central_read_timer, read_timer_cb, NULL); - #endif #if HAS_DETECT_GPIO diff --git a/app/src/split/wired/peripheral.c b/app/src/split/wired/peripheral.c index 562da72bf..72300ca50 100644 --- a/app/src/split/wired/peripheral.c +++ b/app/src/split/wired/peripheral.c @@ -105,6 +105,16 @@ static struct zmk_split_wired_async_state async_state = { #endif +#if IS_ENABLED(CONFIG_ZMK_SPLIT_WIRED_UART_MODE_POLLING) + +static void wired_peripheral_read_tick_cb(struct k_timer *timer) { + zmk_split_wired_poll_in(&chosen_rx_buf, uart, NULL, process_tx_cb); +} + +static K_TIMER_DEFINE(wired_peripheral_read_timer, wired_peripheral_read_tick_cb, NULL); + +#endif // IS_ENABLED(CONFIG_ZMK_SPLIT_WIRED_UART_MODE_POLLING) + static void begin_rx(void) { #if IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) pm_device_runtime_get(uart); @@ -117,7 +127,7 @@ static void begin_rx(void) { #elif IS_ENABLED(CONFIG_ZMK_SPLIT_WIRED_UART_MODE_ASYNC) zmk_split_wired_async_rx(&async_state); #else - k_timer_start(&wired_central_read_timer, K_TICKS(CONFIG_ZMK_SPLIT_WIRED_POLLING_RX_PERIOD), + k_timer_start(&wired_peripheral_read_timer, K_TICKS(CONFIG_ZMK_SPLIT_WIRED_POLLING_RX_PERIOD), K_TICKS(CONFIG_ZMK_SPLIT_WIRED_POLLING_RX_PERIOD)); #endif } @@ -130,7 +140,7 @@ static void stop_rx(void) { #elif IS_ENABLED(CONFIG_ZMK_SPLIT_WIRED_UART_MODE_ASYNC) zmk_split_wired_async_rx_cancel(&async_state); #else - k_timer_stop(&wired_central_read_timer); + k_timer_stop(&wired_peripheral_read_timer); #endif #if IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) @@ -177,12 +187,6 @@ static void send_pending_tx_work_cb(struct k_work *work) { static K_WORK_DEFINE(send_pending_tx, send_pending_tx_work_cb); -static void wired_peripheral_read_tick_cb(struct k_timer *timer) { - zmk_split_wired_poll_in(&chosen_rx_buf, uart, NULL, process_tx_cb); -} - -static K_TIMER_DEFINE(wired_peripheral_read_timer, wired_peripheral_read_tick_cb, NULL); - #endif #if HAS_DETECT_GPIO