aboutsummaryrefslogtreecommitdiff
path: root/03-refactor/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to '03-refactor/src/main.c')
-rw-r--r--03-refactor/src/main.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/03-refactor/src/main.c b/03-refactor/src/main.c
index 5af52ed..0545087 100644
--- a/03-refactor/src/main.c
+++ b/03-refactor/src/main.c
@@ -30,9 +30,9 @@ int enable_usart2(uint32_t baud_rate)
// disable USART first to allow setting of other control bits
// This also disables parity checking and enables 16 times oversampling
- USART2.c_r1 = 0;
- USART2.c_r2 = 0;
- USART2.c_r3 = 0;
+ USART2.c1.r = 0;
+ USART2.c2.r = 0;
+ USART2.c3.r = 0;
usart_set_divisor(&USART2, 16000000 / baud_rate);
usart_set_enabled(&USART2, USART_ENABLE_TX | USART_ENABLE_RX);
@@ -60,13 +60,13 @@ int enable_usart1(uint32_t baud_rate)
RCC.apb2rst_r &= ~BIT(14); /* De-assert reset of USART1 */
uint32_t baud_rate_div = 80000000 / baud_rate;
- USART1.c_r1 = 0;
- USART1.c_r2 = 0;
- USART1.c_r3 = 0;
- USART1.br_r = baud_rate_div;
+ USART1.c1.r = 0;
+ USART1.c2.r = 0;
+ USART1.c3.r = 0;
+ USART1.br.v = baud_rate_div;
- USART1.c_r1 |= BIT(3) | BIT(2);
- USART1.c_r1 |= BIT(0);
+ USART1.c1.r |= BIT(3) | BIT(2);
+ USART1.c1.r |= BIT(0);
/* Enable the transmitter and the receiver. */
usart_set_enabled(&USART1, USART_ENABLE_TX);