arduino / arduino/ArduinoCore-avr
Potential typo/bug in HardwareSerial::_tx_udr_empty_irq?
- Dominant language
- C
- Stars
- 1.5k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
I noticed the following code in `HardwareSerial::_tx_udr_empty_irq`:
https://github.com/arduino/ArduinoCore-avr/blob/855ea0100ba0f6b9036a19a6e71517125473b014/cores/arduino/HardwareSerial.cpp#L103-L107
Shouldn't
```
*_ucsra = ((*_ucsra) & ((1 << U2X0) | (1 << TXC0)));
```
be
```
*_ucsra = ((*_ucsra) & ((1 << U2X0))) | (1 << TXC0);
```
just like the line in `#ifdef MPCM0`?
Because now it preserves the `TXC0` bit instead of setting it?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in cores/arduino/HardwareSerial.cpp at HardwareSerial::_tx_udr_empty_irq and compare the referenced assignments, including the #ifdef MPCM0 variant. Check the AVR register semantics and the open pull request #603 before deciding whether the behavior is incorrect; done means the issue is resolved consistently with the intended TXC0 and U2X0 handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100