Skip to content

Commit eff20de

Browse files
committed
Add ability to set interrupt priority for UART/USARTs.
1 parent 2fedb00 commit eff20de

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

hardware/arduino/sam/cores/arduino/UARTClass.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,16 @@ void UARTClass::end( void )
9090
pmc_disable_periph_clk( _dwId ) ;
9191
}
9292

93+
void UARTClass::setInterruptPriority(uint32_t priority)
94+
{
95+
NVIC_SetPriority(_dwIrq, priority & 0x0F);
96+
}
97+
98+
uint32_t UARTClass::getInterruptPriority()
99+
{
100+
return NVIC_GetPriority(_dwIrq);
101+
}
102+
93103
int UARTClass::available( void )
94104
{
95105
return (uint32_t)(SERIAL_BUFFER_SIZE + _rx_buffer->_iHead - _rx_buffer->_iTail) % SERIAL_BUFFER_SIZE ;

hardware/arduino/sam/cores/arduino/UARTClass.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ class UARTClass : public HardwareSerial
4848
int read( void ) ;
4949
void flush( void ) ;
5050
size_t write( const uint8_t c ) ;
51+
void setInterruptPriority(uint32_t priority);
52+
uint32_t getInterruptPriority();
5153

5254
void IrqHandler( void ) ;
5355

0 commit comments

Comments
 (0)