aboutsummaryrefslogtreecommitdiff
path: root/03-refactor/src/usart.c
diff options
context:
space:
mode:
Diffstat (limited to '03-refactor/src/usart.c')
-rw-r--r--03-refactor/src/usart.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/03-refactor/src/usart.c b/03-refactor/src/usart.c
index a3b0061..fc58467 100644
--- a/03-refactor/src/usart.c
+++ b/03-refactor/src/usart.c
@@ -41,9 +41,13 @@ void usart_set_enabled(__IO usart_t* usart, usart_enable_t enabled)
usart->c1.ue = 0;
} else {
/* Set the rx enabled. */
- usart->c1.re = !!(enabled & USART_ENABLE_RX);
- usart->c1.te = !!(enabled & USART_ENABLE_TX);
- usart->c1.ue = 1;
+ union USART_CR1 tmp = usart->c1;
+
+ tmp.re = !!(enabled & USART_ENABLE_RX);
+ tmp.te = !!(enabled & USART_ENABLE_TX);
+ tmp.ue = 1;
+
+ usart->c1 = tmp;
}
}