diff options
Diffstat (limited to '02-usart/src/arch/stm32l4xxx/peripherals/usart.c')
-rw-r--r-- | 02-usart/src/arch/stm32l4xxx/peripherals/usart.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/02-usart/src/arch/stm32l4xxx/peripherals/usart.c b/02-usart/src/arch/stm32l4xxx/peripherals/usart.c index d37eee2..7309b48 100644 --- a/02-usart/src/arch/stm32l4xxx/peripherals/usart.c +++ b/02-usart/src/arch/stm32l4xxx/peripherals/usart.c @@ -97,9 +97,8 @@ void usart_enable_dma(__IO usart_t* usart, usart_enable_t enabled) }; } -void usart_printf(__IO usart_t* usart, const char* fmt, ...) +void usart_vprintf(__IO usart_t* usart, const char* fmt, va_list l) { - va_list l; union { void* ptr; char* str; @@ -107,8 +106,6 @@ void usart_printf(__IO usart_t* usart, const char* fmt, ...) } b; char buf[128]; - va_start(l, fmt); - while (*fmt != 0) { if (*fmt == '%') { switch (*(++fmt)) { @@ -145,3 +142,11 @@ void usart_printf(__IO usart_t* usart, const char* fmt, ...) end: va_end(l); } + +void usart_printf(__IO usart_t* usart, const char* fmt, ...) +{ + va_list l; + va_start(l, fmt); + + usart_vprintf(usart, fmt, l); +} |