mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2026-01-01 01:41:18 +01:00
cpu/stm32_common/uart: Prevent uart from sending if not initialized
Due to the stdio getting called after periph_init the uart may send before initialized. This adds a simple check so the uart does not get into a locked-up state.
This commit is contained in:
parent
5c4b398c20
commit
96f8438ea2
@ -145,7 +145,12 @@ static inline void wait_for_tx_complete(uart_t uart)
|
||||
void uart_write(uart_t uart, const uint8_t *data, size_t len)
|
||||
{
|
||||
assert(uart < UART_NUMOF);
|
||||
|
||||
#if DEVELHELP
|
||||
/* If tx is not enabled don't try to send */
|
||||
if (!(dev(uart)->CR1 & USART_CR1_TE)) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#ifdef MODULE_PERIPH_DMA
|
||||
if (!len) {
|
||||
return;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user