///////////////////////////////////////////////// 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.
| 382 | // https://github.com/arduino/Arduino/issues/11457 |
| 383 | // TODO: get the real clock speed from the I2C interface if possible. |
| 384 | uint32_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 | ////////////////////////////////////////////////////// |