diff --git a/app/src/split/wired/central.c b/app/src/split/wired/central.c index beee09def02..5346f000c46 100644 --- a/app/src/split/wired/central.c +++ b/app/src/split/wired/central.c @@ -103,6 +103,14 @@ static inline int can_tx(void) { return 0; } #endif +#if IS_ENABLED(CONFIG_ZMK_SPLIT_WIRED_UART_MODE_POLLING) + +static void send_pending_tx_work_cb(struct k_work *work); + +static K_WORK_DEFINE(wired_central_tx_work, send_pending_tx_work_cb); + +#endif + static void begin_tx(void) { #if IS_ENABLED(CONFIG_ZMK_SPLIT_WIRED_UART_MODE_INTERRUPT) uart_irq_tx_enable(uart); @@ -233,11 +241,10 @@ static void send_pending_tx_work_cb(struct k_work *work) { } static void read_timer_cb(struct k_timer *_timer) { - zmk_split_wired_poll_in(&rx_buf, uart, &publish_events, sizeof(struct event_envelope)); + 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_WORK_DEFINE(wired_central_tx_work, send_pending_tx_work_cb); static K_TIMER_DEFINE(wired_central_read_timer, read_timer_cb, NULL); #endif diff --git a/app/src/split/wired/peripheral.c b/app/src/split/wired/peripheral.c index d468da9eedc..aa2a110b0f9 100644 --- a/app/src/split/wired/peripheral.c +++ b/app/src/split/wired/peripheral.c @@ -135,8 +135,7 @@ 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, &publish_commands, - sizeof(struct command_envelope)); + 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); diff --git a/app/src/split/wired/wired.c b/app/src/split/wired/wired.c index 94e2d44c52f..147b3341523 100644 --- a/app/src/split/wired/wired.c +++ b/app/src/split/wired/wired.c @@ -30,8 +30,7 @@ void zmk_split_wired_poll_out(struct ring_buf *tx_buf, const struct device *uart int zmk_split_wired_poll_in(struct ring_buf *rx_buf, const struct device *uart, struct k_work *process_data_work, - zmk_split_wired_process_tx_callback_t process_data_cb, - size_t envelope_size) { + zmk_split_wired_process_tx_callback_t process_data_cb) { uint8_t *buf; uint32_t read = 0; uint32_t claim_len = ring_buf_put_claim(rx_buf, &buf, ring_buf_space_get(rx_buf)); @@ -52,7 +51,7 @@ int zmk_split_wired_poll_in(struct ring_buf *rx_buf, const struct device *uart, ring_buf_put_finish(rx_buf, read); - if (ring_buf_size_get(rx_buf) >= envelope_size) { + if (ring_buf_size_get(rx_buf) >= 0) { if (process_data_work) { k_work_submit(process_data_work); } else if (process_data_cb) { diff --git a/app/src/split/wired/wired.h b/app/src/split/wired/wired.h index d018a1a3534..ab39eb27f11 100644 --- a/app/src/split/wired/wired.h +++ b/app/src/split/wired/wired.h @@ -52,8 +52,7 @@ void zmk_split_wired_poll_out(struct ring_buf *tx_buf, const struct device *uart int zmk_split_wired_poll_in(struct ring_buf *rx_buf, const struct device *uart, struct k_work *process_data_work, - zmk_split_wired_process_tx_callback_t process_data_cb, - size_t envelope_size); + zmk_split_wired_process_tx_callback_t process_data_cb); #endif