File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
hardware/arduino/sam/cores/arduino Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -79,14 +79,12 @@ void UARTClass::end( void )
7979 // clear any received data
8080 _rx_buffer->_iHead = _rx_buffer->_iTail ;
8181
82- while (_tx_buffer->_iHead != _tx_buffer->_iTail ); // wait for transmit data to be sent
82+ // Wait for any outstanding data to be sent
83+ flush ();
8384
8485 // Disable UART interrupt in NVIC
8586 NVIC_DisableIRQ ( _dwIrq ) ;
8687
87- // Wait for any outstanding data to be sent
88- flush ();
89-
9088 pmc_disable_periph_clk ( _dwId ) ;
9189}
9290
@@ -134,6 +132,7 @@ int UARTClass::read( void )
134132
135133void UARTClass::flush ( void )
136134{
135+ while (_tx_buffer->_iHead != _tx_buffer->_iTail ); // wait for transmit data to be sent
137136 // Wait for transmission to complete
138137 while ((_pUart->UART_SR & UART_SR_TXRDY) != UART_SR_TXRDY)
139138 ;
You can’t perform that action at this time.
0 commit comments