arduino / arduino/ArduinoCore-avr
This magic number constant should be replaced by a #define or const int
- Dominant language
- C
- Stars
- 1.5k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
https://github.com/arduino/ArduinoCore-avr/blob/9f8d27f09f3bbd1da1374b5549a82bda55d45d44/cores/arduino/USBCore.cpp#L404
Was looking at why I'm not able to emulate a keyboard with 8-byte bMaxPacketSize0. Took me a while to hunt this one down, was looking for 64 all over but found 0x3F.
Suggest:
#define bMaxPacketSize0_64 64
Then use (bMaxPacketSize0_64-1) for clarity.
I know it's just my opinion but this USB device stack could use more clarity and documentation. It would make it much easier to expand.
Contributor guide
No contributing guide indexed for this repository
Research direction
Open cores/arduino/USBCore.cpp at the linked line and inspect how the 0x3F value is used in the USB device stack. Replace the unexplained literal with a named constant as suggested, then verify that the relevant expression remains equivalent and that the file builds successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot
- Issue type
- Refactor
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100