replace usart_get_interrupt_source with usart_get_flag to match libopencm3 update

This commit is contained in:
King Kévin 2017-06-27 15:38:00 +02:00
parent 30c2e473ee
commit b5001670e4
1 changed files with 2 additions and 2 deletions

View File

@ -125,7 +125,7 @@ void usart_putchar_nonblocking(char c)
/** USART interrupt service routine called when data has been transmitted or received */
void USART_ISR(USART_ID)(void)
{
if (usart_get_interrupt_source(USART(USART_ID), USART_SR_TXE)) { // data has been transmitted
if (usart_get_flag(USART(USART_ID), USART_SR_TXE)) { // data has been transmitted
if (!tx_used) { // no data in the buffer to transmit
usart_disable_tx_interrupt(USART(USART_ID)); // disable transmit interrupt
} else {
@ -134,7 +134,7 @@ void USART_ISR(USART_ID)(void)
tx_used--; // update used size
}
}
if (usart_get_interrupt_source(USART(USART_ID), USART_SR_RXNE)) { // data has been received
if (usart_get_flag(USART(USART_ID), USART_SR_RXNE)) { // data has been received
// only save data if there is space in the buffer
while (rx_used>=LENGTH(rx_buffer)) { // if buffer is full
rx_i = (rx_i+1)%LENGTH(rx_buffer); // drop oldest data