UART: make IRQ/ISR enabling simpler

Change-Id: Id3742850eb5bac91559e0c2b4144bd7b1ae5b07b
This commit is contained in:
Kevin Redon 2018-07-07 14:51:35 +02:00
parent d44cb80bc5
commit fcf2743552
1 changed files with 4 additions and 8 deletions

View File

@ -150,16 +150,12 @@ extern void UART_PutChar( uint8_t c )
}
/* Only store input if buffer is not full, else drop it */
bool trigger_isr = false;
if (rbuf_is_empty(&uart_tx_buffer)) {
trigger_isr = true;
}
if (!rbuf_is_full(&uart_tx_buffer)) {
rbuf_write(&uart_tx_buffer, c);
}
if (trigger_isr) {
pUart->UART_IER = UART_IER_TXRDY;
CONSOLE_ISR();
if (!(pUart->UART_IMR & UART_IMR_TXRDY)) {
pUart->UART_IER = UART_IER_TXRDY;
CONSOLE_ISR();
}
}
}