ESPHome  2023.11.6
Public Member Functions | Protected Attributes
esphome::i2c::I2CDevice Class Reference

#include <i2c.h>

Inheritance diagram for esphome::i2c::I2CDevice:
esphome::ade7953_i2c::AdE7953I2c esphome::ads1115::ADS1115Component esphome::aht10::AHT10Component esphome::am2320::AM2320Component esphome::apds9960::APDS9960 esphome::as3935_i2c::I2CAS3935Component esphome::as7341::AS7341Component esphome::bh1750::BH1750Sensor esphome::bme280::BME280Component esphome::bme680::BME680Component esphome::bme680_bsec::BME680BSECComponent esphome::bmi160::BMI160Component esphome::bmp085::BMP085Component esphome::bmp280::BMP280Component esphome::bmp3xx::BMP3XXComponent esphome::bmp581::BMP581Component esphome::cap1188::CAP1188Component esphome::ccs811::CCS811Component esphome::dac7678::DAC7678Output esphome::dht12::DHT12Component esphome::dps310::DPS310Component esphome::ds1307::DS1307Component esphome::ee895::EE895Component esphome::ektf2232::EKTF2232Touchscreen esphome::emc2101::Emc2101Component esphome::ens210::ENS210Component esphome::ezo::EZOSensor esphome::ezo_pmp::EzoPMP esphome::fs3000::FS3000Component esphome::gp8403::GP8403 esphome::grove_tb6612fng::GroveMotorDriveTB6612FNG esphome::hdc1080::HDC1080Component esphome::hm3301::HM3301Component esphome::hmc5883l::HMC5883LComponent esphome::honeywellabp2_i2c::HONEYWELLABP2Sensor esphome::hte501::HTE501Component esphome::htu21d::HTU21DComponent esphome::hyt271::HYT271Component esphome::iaqcore::IAQCore esphome::ina219::INA219Component esphome::ina226::INA226Component esphome::ina260::INA260Component esphome::ina3221::INA3221Component esphome::inkplate6::Inkplate6 esphome::kmeteriso::KMeterISOComponent esphome::lcd_pcf8574::PCF8574LCDDisplay esphome::lilygo_t5_47::LilygoT547Touchscreen esphome::ltr390::LTR390Component esphome::max44009::MAX44009Sensor esphome::max6956::MAX6956 esphome::max9611::MAX9611Component esphome::mcp23008::MCP23008 esphome::mcp23016::MCP23016 esphome::mcp23017::MCP23017 esphome::mcp4725::MCP4725 esphome::mcp4728::MCP4728Component esphome::mcp47a1::MCP47A1 esphome::mcp9600::MCP9600Component esphome::mcp9808::MCP9808Sensor esphome::mics_4514::MICS4514Component esphome::mlx90393::MLX90393Cls esphome::mlx90614::MLX90614Component esphome::mmc5603::MMC5603Component esphome::mmc5983::MMC5983Component esphome::mpl3115a2::MPL3115A2Component esphome::mpr121::MPR121Component esphome::mpu6050::MPU6050Component esphome::mpu6886::MPU6886Component esphome::ms5611::MS5611Component esphome::pca6416a::PCA6416AComponent esphome::pca9554::PCA9554Component esphome::pca9685::PCA9685Output esphome::pcf85063::PCF85063Component esphome::pcf8563::PCF8563Component esphome::pcf8574::PCF8574Component esphome::pmsa003i::PMSA003IComponent esphome::pmwcs3::PMWCS3Component esphome::pn532_i2c::PN532I2C esphome::qmc5883l::QMC5883LComponent esphome::qmp6988::QMP6988Component esphome::qwiic_pir::QwiicPIRComponent esphome::rc522_i2c::RC522I2C esphome::sen0321_sensor::Sen0321Sensor esphome::sen21231_sensor::Sen21231Sensor esphome::sensirion_common::SensirionI2CDevice esphome::ssd1306_i2c::I2CSSD1306 esphome::ssd1327_i2c::I2CSSD1327 esphome::sx1509::SX1509Component esphome::tca9548a::TCA9548AComponent esphome::tcs34725::TCS34725Component esphome::tee501::TEE501Component esphome::tlc59208f::TLC59208FOutput esphome::tmp102::TMP102Component esphome::tmp1075::TMP1075Sensor esphome::tmp117::TMP117Component esphome::tof10120::TOF10120Sensor esphome::tsl2561::TSL2561Sensor esphome::tsl2591::TSL2591Component esphome::tt21100::TT21100Touchscreen esphome::ttp229_lsf::TTP229LSFComponent esphome::ufire_ec::UFireECComponent esphome::ufire_ise::UFireISEComponent esphome::vl53l0x::VL53L0XSensor esphome::xgzp68xx::XGZP68XXComponent esphome::xl9535::XL9535Component esphome::zio_ultrasonic::ZioUltrasonicComponent

Public Member Functions

 I2CDevice ()=default
 
void set_i2c_address (uint8_t address)
 
void set_i2c_bus (I2CBus *bus)
 
I2CRegister reg (uint8_t a_register)
 
I2CRegister16 reg16 (uint16_t a_register)
 
ErrorCode read (uint8_t *data, size_t len)
 
ErrorCode read_register (uint8_t a_register, uint8_t *data, size_t len, bool stop=true)
 
ErrorCode read_register16 (uint16_t a_register, uint8_t *data, size_t len, bool stop=true)
 
ErrorCode write (const uint8_t *data, uint8_t len, bool stop=true)
 
ErrorCode write_register (uint8_t a_register, const uint8_t *data, size_t len, bool stop=true)
 
ErrorCode write_register16 (uint16_t a_register, const uint8_t *data, size_t len, bool stop=true)
 
bool read_bytes (uint8_t a_register, uint8_t *data, uint8_t len)
 
bool read_bytes_raw (uint8_t *data, uint8_t len)
 
template<size_t N>
optional< std::array< uint8_t, N > > read_bytes (uint8_t a_register)
 
template<size_t N>
optional< std::array< uint8_t, N > > read_bytes_raw ()
 
bool read_bytes_16 (uint8_t a_register, uint16_t *data, uint8_t len)
 
bool read_byte (uint8_t a_register, uint8_t *data, bool stop=true)
 
optional< uint8_t > read_byte (uint8_t a_register)
 
bool read_byte_16 (uint8_t a_register, uint16_t *data)
 
bool write_bytes (uint8_t a_register, const uint8_t *data, uint8_t len, bool stop=true)
 
bool write_bytes (uint8_t a_register, const std::vector< uint8_t > &data)
 
template<size_t N>
bool write_bytes (uint8_t a_register, const std::array< uint8_t, N > &data)
 
bool write_bytes_16 (uint8_t a_register, const uint16_t *data, uint8_t len)
 
bool write_byte (uint8_t a_register, uint8_t data, bool stop=true)
 
bool write_byte_16 (uint8_t a_register, uint16_t data)
 

Protected Attributes

uint8_t address_ {0x00}
 
I2CBusbus_ {nullptr}
 

Detailed Description

Definition at line 58 of file i2c.h.

Constructor & Destructor Documentation

◆ I2CDevice()

esphome::i2c::I2CDevice::I2CDevice ( )
default

Member Function Documentation

◆ read()

ErrorCode esphome::i2c::I2CDevice::read ( uint8_t *  data,
size_t  len 
)
inline

Definition at line 68 of file i2c.h.

◆ read_byte() [1/2]

bool esphome::i2c::I2CDevice::read_byte ( uint8_t  a_register,
uint8_t *  data,
bool  stop = true 
)
inline

Definition at line 100 of file i2c.h.

◆ read_byte() [2/2]

optional<uint8_t> esphome::i2c::I2CDevice::read_byte ( uint8_t  a_register)
inline

Definition at line 104 of file i2c.h.

◆ read_byte_16()

bool esphome::i2c::I2CDevice::read_byte_16 ( uint8_t  a_register,
uint16_t *  data 
)
inline

Definition at line 111 of file i2c.h.

◆ read_bytes() [1/2]

bool esphome::i2c::I2CDevice::read_bytes ( uint8_t  a_register,
uint8_t *  data,
uint8_t  len 
)
inline

Definition at line 78 of file i2c.h.

◆ read_bytes() [2/2]

template<size_t N>
optional<std::array<uint8_t, N> > esphome::i2c::I2CDevice::read_bytes ( uint8_t  a_register)
inline

Definition at line 83 of file i2c.h.

◆ read_bytes_16()

bool esphome::i2c::I2CDevice::read_bytes_16 ( uint8_t  a_register,
uint16_t *  data,
uint8_t  len 
)

Definition at line 44 of file i2c.cpp.

◆ read_bytes_raw() [1/2]

bool esphome::i2c::I2CDevice::read_bytes_raw ( uint8_t *  data,
uint8_t  len 
)
inline

Definition at line 81 of file i2c.h.

◆ read_bytes_raw() [2/2]

template<size_t N>
optional<std::array<uint8_t, N> > esphome::i2c::I2CDevice::read_bytes_raw ( )
inline

Definition at line 90 of file i2c.h.

◆ read_register()

ErrorCode esphome::i2c::I2CDevice::read_register ( uint8_t  a_register,
uint8_t *  data,
size_t  len,
bool  stop = true 
)

Definition at line 10 of file i2c.cpp.

◆ read_register16()

ErrorCode esphome::i2c::I2CDevice::read_register16 ( uint16_t  a_register,
uint8_t *  data,
size_t  len,
bool  stop = true 
)

Definition at line 17 of file i2c.cpp.

◆ reg()

I2CRegister esphome::i2c::I2CDevice::reg ( uint8_t  a_register)
inline

Definition at line 65 of file i2c.h.

◆ reg16()

I2CRegister16 esphome::i2c::I2CDevice::reg16 ( uint16_t  a_register)
inline

Definition at line 66 of file i2c.h.

◆ set_i2c_address()

void esphome::i2c::I2CDevice::set_i2c_address ( uint8_t  address)
inline

Definition at line 62 of file i2c.h.

◆ set_i2c_bus()

void esphome::i2c::I2CDevice::set_i2c_bus ( I2CBus bus)
inline

Definition at line 63 of file i2c.h.

◆ write()

ErrorCode esphome::i2c::I2CDevice::write ( const uint8_t *  data,
uint8_t  len,
bool  stop = true 
)
inline

Definition at line 72 of file i2c.h.

◆ write_byte()

bool esphome::i2c::I2CDevice::write_byte ( uint8_t  a_register,
uint8_t  data,
bool  stop = true 
)
inline

Definition at line 127 of file i2c.h.

◆ write_byte_16()

bool esphome::i2c::I2CDevice::write_byte_16 ( uint8_t  a_register,
uint16_t  data 
)
inline

Definition at line 131 of file i2c.h.

◆ write_bytes() [1/3]

bool esphome::i2c::I2CDevice::write_bytes ( uint8_t  a_register,
const uint8_t *  data,
uint8_t  len,
bool  stop = true 
)
inline

Definition at line 113 of file i2c.h.

◆ write_bytes() [2/3]

bool esphome::i2c::I2CDevice::write_bytes ( uint8_t  a_register,
const std::vector< uint8_t > &  data 
)
inline

Definition at line 117 of file i2c.h.

◆ write_bytes() [3/3]

template<size_t N>
bool esphome::i2c::I2CDevice::write_bytes ( uint8_t  a_register,
const std::array< uint8_t, N > &  data 
)
inline

Definition at line 121 of file i2c.h.

◆ write_bytes_16()

bool esphome::i2c::I2CDevice::write_bytes_16 ( uint8_t  a_register,
const uint16_t *  data,
uint8_t  len 
)

Definition at line 52 of file i2c.cpp.

◆ write_register()

ErrorCode esphome::i2c::I2CDevice::write_register ( uint8_t  a_register,
const uint8_t *  data,
size_t  len,
bool  stop = true 
)

Definition at line 25 of file i2c.cpp.

◆ write_register16()

ErrorCode esphome::i2c::I2CDevice::write_register16 ( uint16_t  a_register,
const uint8_t *  data,
size_t  len,
bool  stop = true 
)

Definition at line 34 of file i2c.cpp.

Field Documentation

◆ address_

uint8_t esphome::i2c::I2CDevice::address_ {0x00}
protected

Definition at line 134 of file i2c.h.

◆ bus_

I2CBus* esphome::i2c::I2CDevice::bus_ {nullptr}
protected

Definition at line 135 of file i2c.h.


The documentation for this class was generated from the following files: