This PR enhances the Wire library to support std::function–based callbacks for I2C slave mode, enabling the use of lambdas and captured contexts.
- Replaces raw function pointers in TwoWire and HardwareI2C with std::function for onRequest and onReceive
- Updates constructors, method signatures, and default initializations to use std::function
- Adds new example sketch, CI config, and documentation updates demonstrating the functional callback API
* Fix ambiguous for TwoWire::requestFrom() methods.
* Remove TwoWire::begin(int) overload
Inside the function, this overload truncated the data type to a shorter one. This could break some users' hopes.
* Rewrite TwoWire with using HardwareI2C
- implement proposal https://github.com/espressif/arduino-esp32/pull/8818#issuecomment-1792191815
to bring the HARDWARE interface into compliance
* Fix TwoWire::end() return type.
* Fix TwoWire::setClock() return type.
* Fix no return statement in the TwoWire::requestFrom.
* fix(libraries/Wire): fix bad return-statement
Remove non-void values of the return-statements in function returning 'void'.
* style(libraries/Wire): replace tabs with spaces
* refactor(libraries/Wire): use slave without support
TwoWire::begin(uint8_t address) should be available without slave
support by SoC?
* refactor(libraries/Wire): remove unused variables
Compiler reports "Wire.cpp:393:15: error: variable 'err' set but not used [-Werror=unused-but-set-variable]".
* refactor(libraries/Wire): remove unused variables
Compiler reports "Wire.cpp:337:15: error: variable 'err' set but not used [-Werror=unused-but-set-variable]".
* fix(libraries/Wire): hide slave support elements
TwoWire::user_onRequest is used only in conjunction with slave support?
* refactor(libraries/Wire): remove temporary comment
* fix(libraries/Wire): restore an accidentally deleted implementation
TwoWire::endTransmission() was accidentally deleted from a cpp file.
* refactor(libraries/Wire): return return types
In TwoWire class return return types.
* fix(libraries/Wire): fix return type
* refactor(libraries/Wire): add return statement if slave isn't supported
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
* refactor(libraries/Wire): fix indentation
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
* refactor(libraries/Wire): fix indentation
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
* refactor(libraries/Wire): fix indentation
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
* refactor(libraries/Wire): remove unnecessary empty lines
---------
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>