diff options
author | Karl Palsson <karlp@tweak.net.au> | 2022-01-31 23:01:02 +0100 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2022-04-16 21:37:28 +0200 |
commit | 56a334b8934597f8ebbcb3cabb00570e21497ad5 (patch) | |
tree | 59e63b7cc00f695a9a0b8a38471e820d59966f61 /uart | |
parent | 6c73ab8da761db34333fe0305a5b6113614f256e (diff) |
stm32_uart: add write_blocking helper
A nice easy basic helper for "I just wannna wite a char now!"
Diffstat (limited to 'uart')
-rw-r--r-- | uart/stm32_uart.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/uart/stm32_uart.h b/uart/stm32_uart.h index 08f93d1..c4ba582 100644 --- a/uart/stm32_uart.h +++ b/uart/stm32_uart.h @@ -44,4 +44,10 @@ template <typename T> class STM32_UART_t : public mmio_ptr<T> { public: using mmio_ptr<T>::ptr; + + void write_blocking(uint8_t data) const { + // wait for TXE/TXFNF + while (!(ptr()->ISR & (1<<7))); + ptr()->TDR = data; + } }; |