arduino / arduino/ArduinoCore-avr
The Wire library should get its own .readBytes() without timeout.
- Dominant language
- C
- Stars
- 1.5k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
The Stream.readBytes() uses a timeout. In my opinion that does not go well with the Wire library.
The Wire library is the only library in the Stream family that does not use data as a stream. The buffer(s) are cleared and the data is used as packets of data. There is no situation that requires to wait or a timeout.
Therefore I suggest to give the Wire library its own Wire.readBytes() without the timeout.
Almost everyone uses a loop to read the data. I prefer using Wire.readBytes(), but only without the disadvantages of the timeout.
For the Wire library any timeout by accidently reading too much data will only cause a delay, it does not have a purpose. The onReceive() and onRequest() functions are run in a interrupt handler, in that case a useless delay might even influence the whole sketch.
The improved Teensy Wire library by @nox771 should be checked that it will not cause a conflict. [github.com/nox771/i2c_t3](https://github.com/nox771/i2c_t3)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading Stream.readBytes() and the Wire library implementation, including onReceive() and onRequest() handling. Compare the proposed behavior with the linked i2c_t3 library to identify compatibility concerns. Done means the Wire API has a timeout-free readBytes behavior without disrupting packet handling or interrupt callbacks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100