MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / getWireClock

Method getWireClock

libraries/ADS1x15/ADS1X15.cpp:384–402  ·  view source on GitHub ↗

///////////////////////////////////////////////// EXPERIMENTAL see https://github.com/RobTillaart/ADS1X15/issues/22 https://github.com/arduino/Arduino/issues/11457 TODO: get the real clock speed from the I2C interface if possible.

Source from the content-addressed store, hash-verified

382// https://github.com/arduino/Arduino/issues/11457
383// TODO: get the real clock speed from the I2C interface if possible.
384uint32_t ADS1X15::getWireClock()
385{
386// UNO 328 and
387#if defined(__AVR_ATmega328P__) || defined(__AVR_ATmega168__)
388 uint32_t speed = F_CPU / ((TWBR * 2) + 16);
389 return speed;
390
391#elif defined(ESP32)
392 return (uint32_t) _wire->getClock();
393
394// #elif defined(ESP8266)
395// core_esp8266_si2c.cpp holds the data see => void Twi::setClock(
396// not supported.
397// return -1;
398
399#else // best effort is remembering it
400 return _clockSpeed;
401#endif
402}
403
404
405//////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 1

getClockMethod · 0.80

Tested by

no test coverage detected