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

#include <i2c.h>

Inheritance diagram for esphome::i2c::I2CDevice:
esphome::ade7953::ADE7953 esphome::ads1115::ADS1115Component esphome::aht10::AHT10Component esphome::am2320::AM2320Component esphome::apds9960::APDS9960 esphome::as3935_i2c::I2CAS3935Component esphome::bh1750::BH1750Sensor esphome::bme280::BME280Component esphome::bme680::BME680Component esphome::bme680_bsec::BME680BSECComponent esphome::bmp085::BMP085Component esphome::bmp280::BMP280Component esphome::cap1188::CAP1188Component esphome::ccs811::CCS811Component esphome::dht12::DHT12Component esphome::ds1307::DS1307Component esphome::ezo::EZOSensor esphome::hdc1080::HDC1080Component esphome::hm3301::HM3301Component esphome::hmc5883l::HMC5883LComponent esphome::htu21d::HTU21DComponent esphome::ina219::INA219Component esphome::ina226::INA226Component esphome::ina3221::INA3221Component esphome::inkplate6::Inkplate6 esphome::lcd_pcf8574::PCF8574LCDDisplay esphome::ltr390::LTR390Component esphome::mcp23008::MCP23008 esphome::mcp23016::MCP23016 esphome::mcp23017::MCP23017 esphome::mcp4725::MCP4725 esphome::mcp9808::MCP9808Sensor esphome::mpr121::MPR121Component esphome::mpu6050::MPU6050Component esphome::ms5611::MS5611Component esphome::pca9685::PCA9685Output esphome::pcf8574::PCF8574Component esphome::pmsa003i::PMSA003IComponent esphome::pn532_i2c::PN532I2C esphome::qmc5883l::QMC5883LComponent esphome::rc522_i2c::RC522I2C esphome::scd30::SCD30Component esphome::scd4x::SCD4XComponent esphome::sdp3x::SDP3XComponent esphome::sgp30::SGP30Component esphome::sgp40::SGP40Component esphome::sht3xd::SHT3XDComponent esphome::sht4x::SHT4XComponent esphome::shtcx::SHTCXComponent esphome::sps30::SPS30Component esphome::ssd1306_i2c::I2CSSD1306 esphome::ssd1327_i2c::I2CSSD1327 esphome::sts3x::STS3XComponent esphome::sx1509::SX1509Component esphome::tca9548a::TCA9548AComponent esphome::tcs34725::TCS34725Component esphome::tlc59208f::TLC59208FOutput esphome::tmp102::TMP102Component esphome::tmp117::TMP117Component esphome::tof10120::TOF10120Sensor esphome::tsl2561::TSL2561Sensor esphome::tsl2591::TSL2591Component esphome::ttp229_lsf::TTP229LSFComponent esphome::vl53l0x::VL53L0XSensor

Public Member Functions

 I2CDevice ()=default
 
void set_i2c_address (uint8_t address)
 
void set_i2c_bus (I2CBus *bus)
 
I2CRegister reg (uint8_t a_register)
 
ErrorCode read (uint8_t *data, size_t len)
 
ErrorCode read_register (uint8_t a_register, uint8_t *data, size_t len)
 
ErrorCode write (const uint8_t *data, uint8_t len)
 
ErrorCode write_register (uint8_t a_register, const uint8_t *data, size_t len)
 
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)
 
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 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 write_byte_16 (uint8_t a_register, uint16_t data)
 

Protected Attributes

uint8_t address_ {0x00}
 
I2CBusbus_ {nullptr}
 

Detailed Description

Definition at line 39 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 48 of file i2c.h.

◆ read_byte() [1/2]

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

Definition at line 96 of file i2c.h.

◆ read_byte() [2/2]

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

Definition at line 98 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 105 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 68 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 73 of file i2c.h.

◆ read_bytes_16()

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

Definition at line 88 of file i2c.h.

◆ read_bytes_raw() [1/2]

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

Definition at line 71 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 80 of file i2c.h.

◆ read_register()

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

Definition at line 49 of file i2c.h.

◆ reg()

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

Definition at line 46 of file i2c.h.

◆ set_i2c_address()

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

Definition at line 43 of file i2c.h.

◆ set_i2c_bus()

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

Definition at line 44 of file i2c.h.

◆ write()

ErrorCode esphome::i2c::I2CDevice::write ( const uint8_t *  data,
uint8_t  len 
)
inline

Definition at line 56 of file i2c.h.

◆ write_byte()

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

Definition at line 121 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 123 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 
)
inline

Definition at line 107 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 111 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 115 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 10 of file i2c.cpp.

◆ write_register()

ErrorCode esphome::i2c::I2CDevice::write_register ( uint8_t  a_register,
const uint8_t *  data,
size_t  len 
)
inline

Definition at line 57 of file i2c.h.

Field Documentation

◆ address_

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

Definition at line 126 of file i2c.h.

◆ bus_

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

Definition at line 127 of file i2c.h.


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