From 501b257223b7718d00e61996b86f925579e641a5 Mon Sep 17 00:00:00 2001 From: MrKevinWeiss <weiss.kevin604@gmail.com> Date: Thu, 3 Jan 2019 15:43:15 +0100 Subject: [PATCH] tests/periph_uart: fix baudrate truncation Since some boards an int is 16 bits the atoi truncates values. This commit using a long instead of an int. --- tests/periph_uart/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/periph_uart/main.c b/tests/periph_uart/main.c index fbab5ef4bc..850f6962d5 100644 --- a/tests/periph_uart/main.c +++ b/tests/periph_uart/main.c @@ -133,7 +133,7 @@ static int cmd_init(int argc, char **argv) if (dev < 0) { return 1; } - baud = atoi(argv[2]); + baud = strtol(argv[2], NULL, 0); /* initialize UART */ res = uart_init(UART_DEV(dev), baud, rx_cb, (void *)dev); @@ -145,7 +145,7 @@ static int cmd_init(int argc, char **argv) puts("Error: Unable to initialize UART device\n"); return 1; } - printf("Success: Successfully initialized UART_DEV(%i)\n", dev); + printf("Success: Initialized UART_DEV(%i) at BAUD %"PRIu32"\n", dev, baud); /* also test if poweron() and poweroff() work (or at least don't break * anything) */ -- GitLab