1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

tests/periph/uart: print incoming CR as \r

Also the LF is display inside the [...].
Now it is more obvious what characters came in on the RX port of the UART.
Here is an example:

2024-01-20 20:57:41,368 # send 1 ati
2024-01-20 20:57:41,368 # UART_DEV(1) TX: ati
> 2024-01-20 20:57:41,393 # Success: UART_DEV(1) RX: [ati\r\r\n]
2024-01-20 20:57:41,398 # Success: UART_DEV(1) RX: [SARA-N310-00X-00\r\n]
2024-01-20 20:57:41,399 # Success: UART_DEV(1) RX: [\r\n]
2024-01-20 20:57:41,399 # Success: UART_DEV(1) RX: [OK\r\n]
This commit is contained in:
Kees Bakker 2024-01-20 21:43:46 +01:00
parent 504c169346
commit e95211eb14

View File

@ -197,7 +197,10 @@ static void *printer(void *arg)
do {
c = (int)ringbuffer_get_one(&(ctx[dev].rx_buf));
if (c == '\n') {
puts("]\\n");
printf("\\n");
}
else if (c == '\r') {
printf("\\r");
}
else if (c >= ' ' && c <= '~') {
printf("%c", c);
@ -206,6 +209,7 @@ static void *printer(void *arg)
printf("0x%02x", (unsigned char)c);
}
} while (c != '\n');
puts("]");
}
/* this should never be reached */