summaryrefslogtreecommitdiff
path: root/hw/bsp/samg
diff options
context:
space:
mode:
authorhathach <[email protected]>2026-04-04 13:20:58 +0700
committerhathach <[email protected]>2026-04-04 13:20:58 +0700
commit3c6c87479be6a9fdd04240b8bb1267ef80b1a0e8 (patch)
tree2f0d2aecb4360c71fc760dc8afbe4ac92618b73f /hw/bsp/samg
parente01f1538b74cf3fa535e7d7f4924905b3cd35b1f (diff)
implement board_uart_read()/write() as non-blocking for all families
Diffstat (limited to 'hw/bsp/samg')
-rw-r--r--hw/bsp/samg/family.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/hw/bsp/samg/family.c b/hw/bsp/samg/family.c
index b27134305..519068986 100644
--- a/hw/bsp/samg/family.c
+++ b/hw/bsp/samg/family.c
@@ -134,11 +134,16 @@ int board_uart_read(uint8_t* buf, int len) {
int board_uart_write(void const* buf, int len) {
uint8_t const* buf8 = (uint8_t const*) buf;
- for (int i = 0; i < len; i++) {
- while (!_usart_sync_is_ready_to_send(&edbg_com)) {}
- _usart_sync_write_byte(&edbg_com, buf8[i]);
+ int count = 0;
+ while (count < len) {
+ if (_usart_sync_is_ready_to_send(&edbg_com)) {
+ _usart_sync_write_byte(&edbg_com, buf8[count]);
+ count++;
+ } else {
+ break;
+ }
}
- return len;
+ return count;
}
#if CFG_TUSB_OS == OPT_OS_NONE