From e1f84de6c5904b8686f4a4cffbc0717201f21038 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Sun, 21 Jun 2020 23:18:31 +0200 Subject: [PATCH] cpu/sam0_common: UART: simplify init sequence We don't need to read-modify-write the CTRLA register to disable the UART. The entire CTRLA register is re-written just a few lines below, so we can just set it to 0 to disable the UART. There is also no need to reset the UART since we re-write all config registers in init. --- cpu/sam0_common/periph/uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu/sam0_common/periph/uart.c b/cpu/sam0_common/periph/uart.c index 992c43cd89..9d4da5f222 100644 --- a/cpu/sam0_common/periph/uart.c +++ b/cpu/sam0_common/periph/uart.c @@ -129,7 +129,7 @@ int uart_init(uart_t uart, uint32_t baudrate, uart_rx_cb_t rx_cb, void *arg) } /* must disable here first to ensure idempotency */ - dev(uart)->CTRLA.reg &= ~(SERCOM_USART_CTRLA_ENABLE); + dev(uart)->CTRLA.reg = 0; #ifdef MODULE_PERIPH_UART_NONBLOCKING /* set up the TX buffer */