ESPHome  2024.10.3
Data Structures | Enumerations | Functions
esphome::i2c Namespace Reference

Data Structures

class  ArduinoI2CBus
 
class  I2CBus
 This Class provides the methods to read and write bytes from an I2CBus. More...
 
class  I2CDevice
 This Class provides the methods to read/write bytes from/to an i2c device. More...
 
class  I2CRegister
 This class is used to create I2CRegister objects that act as proxies to read/write internal registers on an I2C device. More...
 
class  I2CRegister16
 This class is used to create I2CRegister16 objects that act as proxies to read/write internal registers (specified with a 16 bit address) on an I2C device. More...
 
class  IDFI2CBus
 
struct  ReadBuffer
 the ReadBuffer structure stores a pointer to a read buffer and its length More...
 
struct  WriteBuffer
 the WriteBuffer structure stores a pointer to a write buffer and its length More...
 

Enumerations

enum  ErrorCode {
  NO_ERROR = 0, ERROR_OK = 0, ERROR_INVALID_ARGUMENT = 1, ERROR_NOT_ACKNOWLEDGED = 2,
  ERROR_TIMEOUT = 3, ERROR_NOT_INITIALIZED = 4, ERROR_TOO_LARGE = 5, ERROR_UNKNOWN = 6,
  ERROR_CRC = 7
}
 Error codes returned by I2CBus and I2CDevice methods. More...
 
enum  RecoveryCode {
  RECOVERY_FAILED_SCL_LOW, RECOVERY_FAILED_SDA_LOW, RECOVERY_COMPLETED, RECOVERY_FAILED_SCL_LOW,
  RECOVERY_FAILED_SDA_LOW, RECOVERY_COMPLETED
}
 
enum  RecoveryCode {
  RECOVERY_FAILED_SCL_LOW, RECOVERY_FAILED_SDA_LOW, RECOVERY_COMPLETED, RECOVERY_FAILED_SCL_LOW,
  RECOVERY_FAILED_SDA_LOW, RECOVERY_COMPLETED
}
 

Functions

uint16_t i2ctohs (uint16_t i2cshort)
 
uint16_t htoi2cs (uint16_t hostshort)
 

Enumeration Type Documentation

◆ ErrorCode

Error codes returned by I2CBus and I2CDevice methods.

Enumerator
NO_ERROR 

No error found during execution of method.

ERROR_OK 

No error found during execution of method.

ERROR_INVALID_ARGUMENT 

method called invalid argument(s)

ERROR_NOT_ACKNOWLEDGED 

I2C bus acknowledgment not received.

ERROR_TIMEOUT 

timeout while waiting to receive bytes

ERROR_NOT_INITIALIZED 

call method to a not initialized bus

ERROR_TOO_LARGE 

requested a transfer larger than buffers can hold

ERROR_UNKNOWN 

miscellaneous I2C error during execution

ERROR_CRC 

bytes received with a CRC error

Definition at line 11 of file i2c_bus.h.

◆ RecoveryCode [1/2]

Enumerator
RECOVERY_FAILED_SCL_LOW 
RECOVERY_FAILED_SDA_LOW 
RECOVERY_COMPLETED 
RECOVERY_FAILED_SCL_LOW 
RECOVERY_FAILED_SDA_LOW 
RECOVERY_COMPLETED 

Definition at line 12 of file i2c_bus_esp_idf.h.

◆ RecoveryCode [2/2]

Enumerator
RECOVERY_FAILED_SCL_LOW 
RECOVERY_FAILED_SDA_LOW 
RECOVERY_COMPLETED 
RECOVERY_FAILED_SCL_LOW 
RECOVERY_FAILED_SDA_LOW 
RECOVERY_COMPLETED 

Definition at line 12 of file i2c_bus_arduino.h.

Function Documentation

◆ htoi2cs()

uint16_t esphome::i2c::htoi2cs ( uint16_t  hostshort)
inline

Definition at line 129 of file i2c.h.

◆ i2ctohs()

uint16_t esphome::i2c::i2ctohs ( uint16_t  i2cshort)
inline

Definition at line 128 of file i2c.h.