1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00

Add ability to set interrupt priority for UART/USARTs.

This commit is contained in:
Collin Kidder 2014-12-24 10:36:40 -05:00
parent 2fedb00552
commit eff20deb27
2 changed files with 12 additions and 0 deletions

View File

@ -90,6 +90,16 @@ void UARTClass::end( void )
pmc_disable_periph_clk( _dwId ) ; pmc_disable_periph_clk( _dwId ) ;
} }
void UARTClass::setInterruptPriority(uint32_t priority)
{
NVIC_SetPriority(_dwIrq, priority & 0x0F);
}
uint32_t UARTClass::getInterruptPriority()
{
return NVIC_GetPriority(_dwIrq);
}
int UARTClass::available( void ) int UARTClass::available( void )
{ {
return (uint32_t)(SERIAL_BUFFER_SIZE + _rx_buffer->_iHead - _rx_buffer->_iTail) % SERIAL_BUFFER_SIZE ; return (uint32_t)(SERIAL_BUFFER_SIZE + _rx_buffer->_iHead - _rx_buffer->_iTail) % SERIAL_BUFFER_SIZE ;

View File

@ -48,6 +48,8 @@ class UARTClass : public HardwareSerial
int read( void ) ; int read( void ) ;
void flush( void ) ; void flush( void ) ;
size_t write( const uint8_t c ) ; size_t write( const uint8_t c ) ;
void setInterruptPriority(uint32_t priority);
uint32_t getInterruptPriority();
void IrqHandler( void ) ; void IrqHandler( void ) ;