mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cpu/stm32_common: use correct data bits macro
USART_CR1_M combines both USART_CR1_M0 and USART_CR1_M1 macros affecting bits 12 and 28 on 7 data bits capable UARTs. Whereas for other UARTs USART_CR1_M macro affects only bit 12. This patch fixes wrong data bits usage on 7 data bits capable UARTs with using USART_CR1_M0 macro for modes 8-E-x and 8-O-x. It also simplifies bits unsetting as USART_CR1_M macro clears all data bits related bits for both UART types. Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
This commit is contained in:
parent
0bb0c55cd9
commit
ca8f74a0b0
@ -181,7 +181,11 @@ int uart_mode(uart_t uart, uart_data_bits_t data_bits, uart_parity_t parity,
|
||||
isr_ctx[uart].data_mask = 0x7F;
|
||||
break;
|
||||
case UART_DATA_BITS_8:
|
||||
#ifdef USART_CR1_M0
|
||||
data_bits = USART_CR1_M0;
|
||||
#else
|
||||
data_bits = USART_CR1_M;
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
return UART_NOMODE;
|
||||
@ -196,7 +200,6 @@ int uart_mode(uart_t uart, uart_data_bits_t data_bits, uart_parity_t parity,
|
||||
return UART_INTERR;
|
||||
}
|
||||
dev(uart)->CR1 &= ~(USART_CR1_UE | USART_CR1_TE);
|
||||
dev(uart)->CR1 &= ~USART_CR1_M1;
|
||||
#endif
|
||||
|
||||
dev(uart)->CR2 &= ~USART_CR2_STOP;
|
||||
|
Loading…
Reference in New Issue
Block a user