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:
parent
2fedb00552
commit
eff20deb27
@ -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 ;
|
||||||
|
@ -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 ) ;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user