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

tests/periph_uart: fix for !stdio_uart

Only include `stdio_uart.h` if stdio over UART is used.
This makes it possible to use the default stdio UART0
for the test.

This is needed if e.g. the default stdio of a board is USB CDC ACM.
This commit is contained in:
Benjamin Valentin 2020-04-26 20:30:49 +02:00
parent bb1ff1f635
commit aac593a7c9

View File

@ -28,9 +28,12 @@
#include "msg.h"
#include "ringbuffer.h"
#include "periph/uart.h"
#include "stdio_uart.h"
#include "xtimer.h"
#ifdef MODULE_STDIO_UART
#include "stdio_uart.h"
#endif
#ifndef SHELL_BUFSIZE
#define SHELL_BUFSIZE (128U)
#endif
@ -283,11 +286,15 @@ int main(void)
* value given in STDIO_UART_DEV is not a numeral (depends on the CPU
* implementation), so we rather break the output by printing a
* non-numerical value instead of breaking the UART device descriptor */
sleep_test(STDIO_UART_DEV, STDIO_UART_DEV);
if (STDIO_UART_DEV != UART_UNDEF) {
sleep_test(STDIO_UART_DEV, STDIO_UART_DEV);
}
puts("\nUART INFO:");
printf("Available devices: %i\n", UART_NUMOF);
printf("UART used for STDIO (the shell): UART_DEV(%i)\n\n", STDIO_UART_DEV);
if (STDIO_UART_DEV != UART_UNDEF) {
printf("UART used for STDIO (the shell): UART_DEV(%i)\n\n", STDIO_UART_DEV);
}
/* initialize ringbuffers */
for (unsigned i = 0; i < UART_NUMOF; i++) {