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:
parent
bb1ff1f635
commit
aac593a7c9
@ -28,9 +28,12 @@
|
|||||||
#include "msg.h"
|
#include "msg.h"
|
||||||
#include "ringbuffer.h"
|
#include "ringbuffer.h"
|
||||||
#include "periph/uart.h"
|
#include "periph/uart.h"
|
||||||
#include "stdio_uart.h"
|
|
||||||
#include "xtimer.h"
|
#include "xtimer.h"
|
||||||
|
|
||||||
|
#ifdef MODULE_STDIO_UART
|
||||||
|
#include "stdio_uart.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef SHELL_BUFSIZE
|
#ifndef SHELL_BUFSIZE
|
||||||
#define SHELL_BUFSIZE (128U)
|
#define SHELL_BUFSIZE (128U)
|
||||||
#endif
|
#endif
|
||||||
@ -283,11 +286,15 @@ int main(void)
|
|||||||
* value given in STDIO_UART_DEV is not a numeral (depends on the CPU
|
* value given in STDIO_UART_DEV is not a numeral (depends on the CPU
|
||||||
* implementation), so we rather break the output by printing a
|
* implementation), so we rather break the output by printing a
|
||||||
* non-numerical value instead of breaking the UART device descriptor */
|
* 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:");
|
puts("\nUART INFO:");
|
||||||
printf("Available devices: %i\n", UART_NUMOF);
|
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 */
|
/* initialize ringbuffers */
|
||||||
for (unsigned i = 0; i < UART_NUMOF; i++) {
|
for (unsigned i = 0; i < UART_NUMOF; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user