aboutsummaryrefslogtreecommitdiff
path: root/src/arch/stm32l4xxx/peripherals/usart.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/stm32l4xxx/peripherals/usart.c')
-rw-r--r--src/arch/stm32l4xxx/peripherals/usart.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/arch/stm32l4xxx/peripherals/usart.c b/src/arch/stm32l4xxx/peripherals/usart.c
index 7309b48..c682671 100644
--- a/src/arch/stm32l4xxx/peripherals/usart.c
+++ b/src/arch/stm32l4xxx/peripherals/usart.c
@@ -1,7 +1,9 @@
#include "arch/stm32l4xxx/peripherals/usart.h"
+
+#include <stdarg.h>
+
#include "kern/delay.h"
#include "kern/lib.h"
-#include <stdarg.h>
void set_usart1_clock_src(__IO rcc_t* rcc, usart_clk_src_t usart_clk_src)
{
@@ -62,10 +64,11 @@ void usart_transmit_byte_sync(__IO usart_t* usart, uint8_t byte)
;
}
-void usart_transmit_bytes_sync(__IO usart_t* usart, const uint8_t* bytes, uint32_t n)
+void usart_transmit_bytes_sync(
+ __IO usart_t* usart, const uint8_t* bytes, uint32_t n)
{
- while (n --) {
- usart_transmit_byte_sync(usart, *(bytes ++));
+ while (n--) {
+ usart_transmit_byte_sync(usart, *(bytes++));
}
}
@@ -75,13 +78,13 @@ void usart_transmit_str_sync(__IO usart_t* usart, const char* str)
if (*str == '\n') {
usart_transmit_byte_sync(usart, '\r');
}
- usart_transmit_byte_sync(usart, *(str ++));
+ usart_transmit_byte_sync(usart, *(str++));
}
}
void usart_enable_dma(__IO usart_t* usart, usart_enable_t enabled)
{
- switch(enabled) {
+ switch (enabled) {
case USART_ENABLE_DISABLED:
regset(usart->c_r3, usart_dmar, 0);
regset(usart->c_r3, usart_dmat, 0);
@@ -130,12 +133,12 @@ void usart_vprintf(__IO usart_t* usart, const char* fmt, va_list l)
b.str = va_arg(l, char*);
usart_transmit_str_sync(usart, b.str);
}
- ++ fmt;
+ ++fmt;
} else {
if (*fmt == '\n') {
usart_transmit_byte_sync(usart, '\r');
}
- usart_transmit_byte_sync(usart, *(fmt ++));
+ usart_transmit_byte_sync(usart, *(fmt++));
}
}