update uart read for lpc18/43 for testing

This commit is contained in:
hathach
2022-11-18 21:50:00 +07:00
parent b00529e287
commit a6001fc8f2
6 changed files with 17 additions and 10 deletions

View File

@@ -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