fix(split): Compile and run properly in wired polling mode. (#3012)

Fixes for regressions from split refactors that broke polling mode
specifically.

Co-authored-by: honorless <86894501+lesshonor@users.noreply.github.com>
Co-authored-by: Cem Aksoylar <caksoylar@users.noreply.github.com>
This commit is contained in:
Pete Johanson 2025-07-31 15:09:25 -06:00 committed by GitHub
parent 1530ae36c2
commit 2ae5185419
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 15 deletions

View File

@ -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 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 #endif
static void begin_tx(void) { 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); 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 #endif
#if HAS_DETECT_GPIO #if HAS_DETECT_GPIO

View File

@ -105,6 +105,16 @@ static struct zmk_split_wired_async_state async_state = {
#endif #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) { static void begin_rx(void) {
#if IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) #if IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)
pm_device_runtime_get(uart); pm_device_runtime_get(uart);
@ -117,7 +127,7 @@ static void begin_rx(void) {
#elif IS_ENABLED(CONFIG_ZMK_SPLIT_WIRED_UART_MODE_ASYNC) #elif IS_ENABLED(CONFIG_ZMK_SPLIT_WIRED_UART_MODE_ASYNC)
zmk_split_wired_async_rx(&async_state); zmk_split_wired_async_rx(&async_state);
#else #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)); K_TICKS(CONFIG_ZMK_SPLIT_WIRED_POLLING_RX_PERIOD));
#endif #endif
} }
@ -130,7 +140,7 @@ static void stop_rx(void) {
#elif IS_ENABLED(CONFIG_ZMK_SPLIT_WIRED_UART_MODE_ASYNC) #elif IS_ENABLED(CONFIG_ZMK_SPLIT_WIRED_UART_MODE_ASYNC)
zmk_split_wired_async_rx_cancel(&async_state); zmk_split_wired_async_rx_cancel(&async_state);
#else #else
k_timer_stop(&wired_central_read_timer); k_timer_stop(&wired_peripheral_read_timer);
#endif #endif
#if IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) #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 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 #endif
#if HAS_DETECT_GPIO #if HAS_DETECT_GPIO