arduino / arduino/ArduinoCore-avr
[Request] Add "weak" attribute to UART interrupt in HardwareSerial
- Dominant language
- C
- Stars
- 1.5k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
I want to use hardware flow control for AVR Serial.I think I can do it by inspecting RTS/CTS pins in the transmit/receive interrupt routine, but I can't override the interrupt routine because it is defined in HardwareSerialN.cpp as follows.
```
#if defined(USART_RX_vect)
ISR(USART_RX_vect)
#elif defined(USART0_RX_vect)
ISR(USART0_RX_vect)
#elif defined(USART_RXC_vect)
ISR(USART_RXC_vect) // ATmega8.
#else.
#error "Don't know what the Data Received vector is called for Serial."
#endif
{
Serial._rx_complete_irq();
}
```
If we change this to the following, we can override the interrupts without affecting the existing usage.
```
ISR( vector, __attribute__((weak)) )
{
//behavior
}
```
I hope you'll consider changing this.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in HardwareSerialN.cpp at the USART receive-vector ISR shown in the issue, then inspect how the AVR ISR macro handles attributes and overrides. The change is done when the interrupt can be overridden for hardware flow control without affecting existing Serial usage; no test file is named, so verify the affected interrupt behavior from the surrounding implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100