diff options
| author | hathach <[email protected]> | 2022-11-18 21:50:00 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2022-11-18 21:50:00 +0700 |
| commit | a6001fc8f2cfe0db2cf5ba410b49961781ce1803 (patch) | |
| tree | 41a393d762fe6ee46197d097a24487f60815aae9 /hw/bsp/board.c | |
| parent | b00529e287c13197f80787f5126626b0d08c06a1 (diff) | |
update uart read for lpc18/43 for testing
Diffstat (limited to 'hw/bsp/board.c')
| -rw-r--r-- | hw/bsp/board.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/bsp/board.c b/hw/bsp/board.c index e208624ba..a22b462d9 100644 --- a/hw/bsp/board.c +++ b/hw/bsp/board.c @@ -103,7 +103,8 @@ TU_ATTR_USED int sys_write (int fhdl, const void *buf, size_t count) TU_ATTR_USED int sys_read (int fhdl, char *buf, size_t count) { (void) fhdl; - return SEGGER_RTT_Read(0, buf, count); + int rd = (int) SEGGER_RTT_Read(0, buf, count); + return (rd > 0) ? rd : -1; } #endif @@ -143,7 +144,8 @@ TU_ATTR_USED int sys_write (int fhdl, const void *buf, size_t count) TU_ATTR_USED int sys_read (int fhdl, char *buf, size_t count) { (void) fhdl; - return board_uart_read((uint8_t*) buf, (int) count); + int rd = board_uart_read((uint8_t*) buf, (int) count); + return (rd > 0) ? rd : -1; } #endif |
