From ee45fc7533d97904edc5698a79f1159c24c5e7f2 Mon Sep 17 00:00:00 2001 From: Ian Martin Date: Sat, 22 Mar 2014 10:22:11 -0400 Subject: [PATCH] Change uart_set_baudrate() to a do-while statement. --- cpu/cc2538/dev/uart.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cpu/cc2538/dev/uart.h b/cpu/cc2538/dev/uart.h index 8e9d79f3d..fbc18fc18 100644 --- a/cpu/cc2538/dev/uart.h +++ b/cpu/cc2538/dev/uart.h @@ -77,10 +77,11 @@ #define BAUD2BRD(baud) DIV_ROUND(UART_CLOCK_RATE << (UART_CTL_HSE_VALUE + 2), (baud)) -#define uart_set_baudrate(baud) ( \ - REG(UART_BASE | UART_IBRD) = BAUD2BRD(baud) >> 6, \ - REG(UART_BASE | UART_FBRD) = BAUD2BRD(baud) & 0x3f, \ - REG(UART_BASE | UART_LCRH) = REG(UART_BASE | UART_LCRH) ) +#define uart_set_baudrate(baud) do { \ + REG(UART_BASE | UART_IBRD) = BAUD2BRD(baud) >> 6; \ + REG(UART_BASE | UART_FBRD) = BAUD2BRD(baud) & 0x3f; \ + REG(UART_BASE | UART_LCRH) = REG(UART_BASE | UART_LCRH); \ +} while(0) /** @} */ /*---------------------------------------------------------------------------*/