diff options
| author | hathach <[email protected]> | 2022-11-21 15:49:38 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2022-11-21 15:49:38 +0700 |
| commit | 460bef9dbb40d1c6990c1bfd2f8da48978550932 (patch) | |
| tree | 0324f30682b7fdbac33074cd382be2bf85f1287a /hw/bsp/board.h | |
| parent | ba9f88f18c222d9e74e483340ade4a420ad49f01 (diff) | |
host msc example work well with rp2040 pio-usb
Diffstat (limited to 'hw/bsp/board.h')
| -rw-r--r-- | hw/bsp/board.h | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/hw/bsp/board.h b/hw/bsp/board.h index 0826d7786..52c64a1cc 100644 --- a/hw/bsp/board.h +++ b/hw/bsp/board.h @@ -132,15 +132,11 @@ static inline void board_delay(uint32_t ms) } } +// stdio getchar() is blocking, this is non-blocking version for uart static inline int board_uart_getchar(void) { uint8_t c; - return board_uart_read(&c, 1) ? (int) c : (-1); -} - -static inline int board_uart_putchar(uint8_t c) -{ - return board_uart_write(&c, 1); + return ( board_uart_read(&c, 1) > 0 ) ? (int) c : (-1); } #ifdef __cplusplus |
