diff --git a/src/modm/platform/uart/stm32/uart_hal.hpp.in b/src/modm/platform/uart/stm32/uart_hal.hpp.in index 5d6e4ba162..32a5f57c36 100644 --- a/src/modm/platform/uart/stm32/uart_hal.hpp.in +++ b/src/modm/platform/uart/stm32/uart_hal.hpp.in @@ -118,6 +118,10 @@ public: static inline bool isTransmitRegisterEmpty(); + /// Returns true if the transmission of a frame containing data is complete + static inline bool + isTransmissionComplete(); + static inline void enableInterruptVector(bool enable, uint32_t priority); diff --git a/src/modm/platform/uart/stm32/uart_hal_impl.hpp.in b/src/modm/platform/uart/stm32/uart_hal_impl.hpp.in index 623801a7f0..f24d5e9a88 100644 --- a/src/modm/platform/uart/stm32/uart_hal_impl.hpp.in +++ b/src/modm/platform/uart/stm32/uart_hal_impl.hpp.in @@ -210,6 +210,16 @@ bool %% endif } +bool +{{ hal }}::isTransmissionComplete() +{ +%% if extended_driver + return {{ peripheral }}->ISR & USART_ISR_TC; +%% else + return {{ peripheral }}->SR & USART_SR_TC; +%% endif +} + void {{ hal }}::enableInterruptVector(bool enable, uint32_t priority) {