-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Update IDF to aaf1239 breaks Wire library endTransmission() #1725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
While 3rd party s/w can work around this issue, since it is an issue that has been created in the ESP32 Wire code, the proper place to fix it is in ESP32 vs all the 3rd party s/w. |
Official Arduino |
While that reference page uses the words "boolean" and "true" the AVR code that Arduino.cc supplies does not use a C/C++ bool type for endTransmission() While DUE uses a bool type, pretty much all other cores use uint8_t for the type rather than bool. What may also create some issues/confusion is that "boolean" is not a C/C++ type it is an Arduino proprietary type. But the bottom line is that the ESP32 core Wire library now includes both endTransmission(bool) and endTransmission(uint8_t) As of right now, I've not seen any other core or library "Wire" API implementation that fails to compile endTransmission(1) and endTransmisssion(0) other than the ESP32 core. One or the other of the two functions could be removed to ensure that endTransmission(0) and endTransmission(1) continue to work as they have in the past and continues to work in other cores like |
Just to be clear, I'm not asking to change endTransmission(stop) to use a uint8_t parameter, I'm saying that This is because the function was overloaded to take either a uinit8_t or a bool |
The solution to this is to simply remove the uint8_t TwoWire::endTransmission(uint8_t sendStop) The point of having the uint8_t version of the function was to support endTransmission(0) and endTransmission(1) yet by having it and the bool version those calls break. By having only the bool version of the function you get the best of all words.
This allows everything to work. Old/existing code that uses 0 and 1 and new code that uses false and true. Including both versions of the function doesn't solve anything and simply creates several problems.
Currently, the way for code to be compatible with all cores, some of which use uint8_t and some that use bool, is to use endTransmission(0) and endTransmission(1) I'll provide a PR to fix this. |
PR created: #1888 |
* removed uint8_t Wire.endTransmission(uint8_t sendStop) Having both endTransmission(bool) and endTransmission(uint8_t) creates problems. There is no need for endTransmission(uint8_t) endTransmission(1) and endTransmission(0) works with endTransmission(bool). Removing endTransmission(uint8_t) allows the ESP32 code to be compatible with all the other Arduino cores by allowing endTransmission(1) and endTranmission(0) to work as it does on all the other cores. * Wire library version bump for endTransmission() update
The Update IDF to aaf1239 here: a59eafb#diff-f1344d8f8dd31c4411770e150a4425fc
Includes some updates to the Wire library. One of the updates is a new endTransmission(bool) function.
While it would be nice to have this function use a bool instead of a uint8_t , adding it along side of the existing uint8_t functions breaks existing code that calls the existing endTransmission(uint8_t) function with 0 or 1.
i.e. existing applications or libraries that make calls to endTransmission(0) and endTransmission(1) will break since it is ambiguous which endTransmission() function should be called the bool or the uint8_t version.
I have not seen any other Arduino core implement a endTransmission(bool) function.
In order to maintain compatibility with existing 3rd party i2c applications and 3rd party i2c libraries the endTransmission(bool) function will need to be removed.
The text was updated successfully, but these errors were encountered: