adafruit / adafruit/Adafruit_Arduino_Boards
TinyWireM code requestFrom() incompatible with Wire requestFrom()
- Dominant language
- C
- Stars
- 52
- Forks
- 35
- PR merge metrics
- No merged PRs in 30d
Description
The Wire library function requestFrom() function returns the number of bytes transferred.
The TinyWireM library code function requestFrom() returns a status where zero means success.
The TinyWireM requestFrom() is fundamentally incompatible with the Wire library requestFrom().
Code that expects the Wire API behavior and checks and uses the return value, breaks.
Given that the Adafruit tiny core provides a Wire wrapper for TinyWireM, the API functions need to behave the same as Wire.
The fix is pretty simple and isolated to the requestFrom() code in TinyWireM.cpp
I'm not sure if there is any concern about breaking any existing code that is depending on the current behavior.
Unfortunately, there is no magic bullet fix, either code that works with Wire breaks or code the depends on existing TinyWireM behavior of requestFrom() breaks when the code is fixed.
Note that this same issue/bug also affects the TinyWireM library:
https://github.com/adafruit/TinyWireM
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the requestFrom() implementation in TinyWireM.cpp and compare its return behavior with the Arduino Wire library contract. Review the Adafruit tiny core Wire wrapper and the related TinyWireM issue; done means TinyWireM returns the number of bytes transferred like Wire while accounting for compatibility concerns.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- arduino, c
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100