aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/STM32/LLD/USARTv1/hal_serial_lld.c
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/ports/STM32/LLD/USARTv1/hal_serial_lld.c')
-rw-r--r--os/hal/ports/STM32/LLD/USARTv1/hal_serial_lld.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/os/hal/ports/STM32/LLD/USARTv1/hal_serial_lld.c b/os/hal/ports/STM32/LLD/USARTv1/hal_serial_lld.c
index 17d08b7a3..0321e1669 100644
--- a/os/hal/ports/STM32/LLD/USARTv1/hal_serial_lld.c
+++ b/os/hal/ports/STM32/LLD/USARTv1/hal_serial_lld.c
@@ -115,8 +115,10 @@ static void usart_init(SerialDriver *sdp, const SerialConfig *config) {
/* Correcting USARTDIV when oversampling by 8 instead of 16.
Fraction is still 4 bits wide, but only lower 3 bits used.
Mantissa is doubled, but Fraction is left the same.*/
+#if defined(USART_CR1_OVER8)
if (config->cr1 & USART_CR1_OVER8)
fck = ((fck & ~7) * 2) | (fck & 7);
+#endif
u->BRR = fck;
/* Note that some bits are enforced.*/