46 bool begin(TwoWire &wire, uint8_t addr,
int sda = -1,
int scl = -1)
49 return beginCommon<SensorCommI2C, HalArduino>(
comm,
hal, wire, addr, sda, scl);
53#elif defined(ESP_PLATFORM)
54#if defined(SENSORLIB_USE_I2C_LEGACY)
63 bool begin(i2c_port_t port, uint8_t addr,
int sda = -1,
int scl = -1)
66 return beginCommon<SensorCommI2C, HalEspIDF>(
comm,
hal, port, addr, sda, scl);
76 bool begin(i2c_master_bus_handle_t handle, uint8_t addr)
79 return beginCommon<SensorCommI2C, HalEspIDF>(
comm,
hal, handle, addr);
93 bool begin(SensorCommCustom::CustomCallback cb,
98 return beginCommCustomCallback<SensorCommCustom, SensorCommCustomHal>(
109 if (!
comm || !
hal)
return false;
std::unique_ptr< SensorCommBase > comm
bool beginLifecycle(uint8_t addr, uint8_t iface, uint8_t initParam, CreateComm createComm)
std::unique_ptr< SensorHal > hal
bool ensureValid() const override
Ensure the communication interface is valid.
bool begin(SensorCommCustom::CustomCallback cb, SensorCommCustomHal::CustomHalCallback hal_cb, uint8_t addr)
Initialize the sensor using custom callback interface.
uint32_t(*)(Operation op, void *param1, void *param2) CustomHalCallback