| 123456789101112131415161718192021222324 |
- #pragma once
- #include <Arduino.h>
- #include <Wire.h>
- #include "config.h"
- // The PCF85063 RTC and the SHTC3 sensor share one bus. Both drivers call this;
- // only the first call does any work.
- inline bool i2cBusBegin()
- {
- static bool started = false;
- if (!started) {
- started = Wire.begin(I2C_SDA_PIN, I2C_SCL_PIN, I2C_FREQ_HZ);
- }
- return started;
- }
- // True if a device acknowledges its address.
- inline bool i2cDevicePresent(uint8_t addr)
- {
- Wire.beginTransmission(addr);
- return Wire.endTransmission() == 0;
- }
|