-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Add another Wire requestFrom function signature #5768
Add another Wire requestFrom function signature #5768
Conversation
Actually this change still does not work with the ArduinoECCX08 library and gives this compile error:
My C++ isn't up to this, is there some way to do the overloaded requestFrom functions in the ESP32 so that the ArduinoECCX08 code will compile? The ArduinoECCX08 code line is this:
The ESP32 Wire.h requestFrom functions are:
(I have suggested conditional code in the ArduinoECCX08 library but they don't want to do that.) |
libraries/Wire/src/Wire.cpp
Outdated
/* Added to match the Arduino function definition: https://github.com/arduino/ArduinoCore-API/blob/173e8eadced2ad32eeb93bcbd5c49f8d6a055ea6/api/HardwareI2C.h#L39 | ||
* See: https://github.com/arduino-libraries/ArduinoECCX08/issues/25 | ||
*/ | ||
size_t requestFrom(uint8_t address, size_t len, bool stopBit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are missing TwoWire::
here
libraries/Wire/src/Wire.cpp
Outdated
*/ | ||
size_t requestFrom(uint8_t address, size_t len, bool stopBit) | ||
{ | ||
return requestFrom(address, (uint8_t)len, stopBit); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add cast (uint16_t)address
Thanks @me-no-dev , I will go give those a try! |
fix the other casts |
libraries/Wire/src/Wire.cpp
Outdated
@@ -455,6 +455,14 @@ uint8_t TwoWire::requestFrom(uint16_t address, uint8_t quantity, uint8_t sendSto | |||
return requestFrom(address, static_cast<size_t>(quantity), static_cast<bool>(sendStop)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
everywhere that you see static_cast<size_t>(quantity)
needs to change to static_cast<uint8_t>(quantity)
OK thats better, I now need to go try it with the the ArduinoECCX08 library... |
Thanks @torntrousers @me-no-dev |
Arduino HardwareI2C defines a requestFrom function
whereas the ESP32 Wire doesn't include any requestFrom using size_t types, so this can cause a compile error, eg when using the Arduino ATECC608 library with an ESP32, see arduino-libraries/ArduinoECCX08#25