diff --git a/libraries/Wire/src/Wire.cpp b/libraries/Wire/src/Wire.cpp index 1c8775f0871..68d82833be4 100644 --- a/libraries/Wire/src/Wire.cpp +++ b/libraries/Wire/src/Wire.cpp @@ -447,32 +447,40 @@ void TwoWire::flush(void) uint8_t TwoWire::requestFrom(uint8_t address, uint8_t quantity, uint8_t sendStop) { - return requestFrom(static_cast(address), static_cast(quantity), static_cast(sendStop)); + return requestFrom(static_cast(address), static_cast(quantity), static_cast(sendStop)); } uint8_t TwoWire::requestFrom(uint16_t address, uint8_t quantity, uint8_t sendStop) { - return requestFrom(address, static_cast(quantity), static_cast(sendStop)); + return requestFrom(address, static_cast(quantity), static_cast(sendStop)); +} + +/* 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 TwoWire::requestFrom(uint8_t address, size_t len, bool stopBit) +{ + return requestFrom((uint16_t)address, (uint8_t)len, stopBit); } uint8_t TwoWire::requestFrom(uint8_t address, uint8_t quantity) { - return requestFrom(static_cast(address), static_cast(quantity), true); + return requestFrom(static_cast(address), static_cast(quantity), true); } uint8_t TwoWire::requestFrom(uint16_t address, uint8_t quantity) { - return requestFrom(address, static_cast(quantity), true); + return requestFrom(address, static_cast(quantity), true); } uint8_t TwoWire::requestFrom(int address, int quantity) { - return requestFrom(static_cast(address), static_cast(quantity), true); + return requestFrom(static_cast(address), static_cast(quantity), true); } uint8_t TwoWire::requestFrom(int address, int quantity, int sendStop) { - return static_cast(requestFrom(static_cast(address), static_cast(quantity), static_cast(sendStop))); + return static_cast(requestFrom(static_cast(address), static_cast(quantity), static_cast(sendStop))); } void TwoWire::beginTransmission(int address) diff --git a/libraries/Wire/src/Wire.h b/libraries/Wire/src/Wire.h index 892846b3df9..da527b58ba0 100644 --- a/libraries/Wire/src/Wire.h +++ b/libraries/Wire/src/Wire.h @@ -95,6 +95,7 @@ class TwoWire: public Stream uint8_t requestFrom(uint16_t address, uint8_t size, bool sendStop); uint8_t requestFrom(uint16_t address, uint8_t size, uint8_t sendStop); + size_t requestFrom(uint8_t address, size_t len, bool stopBit); uint8_t requestFrom(uint16_t address, uint8_t size); uint8_t requestFrom(uint8_t address, uint8_t size, uint8_t sendStop); uint8_t requestFrom(uint8_t address, uint8_t size);