aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/STM32/LLD/USARTv1
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2018-06-09 17:26:56 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2018-06-09 17:26:56 +0000
commitc2477148f07125ff9432dfda59484b482a7251b4 (patch)
tree9af5052d10248a7f6db008972e04f82e0ec97edc /os/hal/ports/STM32/LLD/USARTv1
parent0f05bc3491150d16a295dd6d42907809742bae1d (diff)
downloadChibiOS-c2477148f07125ff9432dfda59484b482a7251b4.tar.gz
ChibiOS-c2477148f07125ff9432dfda59484b482a7251b4.tar.bz2
ChibiOS-c2477148f07125ff9432dfda59484b482a7251b4.zip
Fixed bug introduced by bug #951 fix.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12084 110e8d01-0319-4d1e-a829-52ad28d1bb01
Diffstat (limited to 'os/hal/ports/STM32/LLD/USARTv1')
-rw-r--r--os/hal/ports/STM32/LLD/USARTv1/hal_serial_lld.c2
-rw-r--r--os/hal/ports/STM32/LLD/USARTv1/hal_uart_lld.c4
2 files changed, 5 insertions, 1 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.*/
diff --git a/os/hal/ports/STM32/LLD/USARTv1/hal_uart_lld.c b/os/hal/ports/STM32/LLD/USARTv1/hal_uart_lld.c
index c10944226..db7ab9250 100644
--- a/os/hal/ports/STM32/LLD/USARTv1/hal_uart_lld.c
+++ b/os/hal/ports/STM32/LLD/USARTv1/hal_uart_lld.c
@@ -216,8 +216,10 @@ static void usart_start(UARTDriver *uartp) {
/* 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 (uartp->config->cr1 & USART_CR1_OVER8)
+#if defined(USART_CR1_OVER8)
+ if (config->cr1 & USART_CR1_OVER8)
fck = ((fck & ~7) * 2) | (fck & 7);
+#endif
u->BRR = fck;
/* Resetting eventual pending status flags.*/