2024-11-16 03:25:55 +08:00
|
|
|
#ifndef I2C_DEVICE_H
|
|
|
|
|
#define I2C_DEVICE_H
|
|
|
|
|
|
|
|
|
|
#include <driver/i2c_master.h>
|
|
|
|
|
|
|
|
|
|
class I2cDevice {
|
|
|
|
|
public:
|
|
|
|
|
I2cDevice(i2c_master_bus_handle_t i2c_bus, uint8_t addr);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
i2c_master_dev_handle_t i2c_device_;
|
|
|
|
|
|
|
|
|
|
void WriteReg(uint8_t reg, uint8_t value);
|
|
|
|
|
uint8_t ReadReg(uint8_t reg);
|
2024-12-26 12:24:53 +08:00
|
|
|
void ReadRegs(uint8_t reg, uint8_t* buffer, size_t length);
|
2024-11-16 03:25:55 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // I2C_DEVICE_H
|