Open RobTillaart opened 3 years ago
Just to mention I implemented a related workaround in this library - https://github.com/RobTillaart/AGS02MA This sensor has an I2C bus working at 30KHz. Setting the bus to this value would slow down all other I2C devices quite a bit.
Having a WIre.getClock() would make live definitely easier.
One might add a define like ARDUINOI2CGETCLOCK so it can be tested compile-time if function exists.
The Wire library has a function void setClock(uint32_t frequency) to set the I2C clock frequency.
It would be useful for (library) developers to be able to read the current clock frequency so I could drive a device at maximum frequency and reset the I2C bus afterwards.
The ESP32 does already support a getClock() function,
For AVR based devices it could look like
FILE: Wire.h
FILE: Wire.cpp
Yes the value may not be exact what was set by setClock() but it would be the actual frequency.