Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
|
Public APIs for the I2C drivers. More...
Go to the source code of this file.
Data Structures | |
struct | i2c_dt_spec |
Complete I2C DT information. More... | |
struct | i2c_msg |
One I2C Message. More... | |
struct | i2c_slave_callbacks |
Structure providing callbacks to be implemented for devices that supports the I2C slave API. More... | |
struct | i2c_slave_config |
Structure describing a device that supports the I2C slave API. More... | |
struct | i2c_client_config |
Macros | |
#define | I2C_SPEED_STANDARD (0x1U) |
#define | I2C_SPEED_FAST (0x2U) |
#define | I2C_SPEED_FAST_PLUS (0x3U) |
#define | I2C_SPEED_HIGH (0x4U) |
#define | I2C_SPEED_ULTRA (0x5U) |
#define | I2C_SPEED_SHIFT (1U) |
#define | I2C_SPEED_SET(speed) |
#define | I2C_SPEED_MASK (0x7U << I2C_SPEED_SHIFT) /* 3 bits */ |
#define | I2C_SPEED_GET(cfg) |
#define | I2C_ADDR_10_BITS BIT(0) |
#define | I2C_MODE_MASTER BIT(4) |
#define | I2C_DT_SPEC_GET(node_id) |
Structure initializer for i2c_dt_spec from devicetree. More... | |
#define | I2C_DT_SPEC_INST_GET(inst) I2C_DT_SPEC_GET(DT_DRV_INST(inst)) |
Structure initializer for i2c_dt_spec from devicetree instance. More... | |
#define | I2C_MSG_WRITE (0U << 0U) |
#define | I2C_MSG_READ BIT(0) |
#define | I2C_MSG_STOP BIT(1) |
#define | I2C_MSG_RESTART BIT(2) |
#define | I2C_MSG_ADDR_10_BITS BIT(3) |
#define | I2C_SLAVE_FLAGS_ADDR_10_BITS BIT(0) |
#define | I2C_DECLARE_CLIENT_CONFIG struct i2c_client_config i2c_client |
#define | I2C_CLIENT(_master, _addr) |
#define | I2C_GET_MASTER(_conf) ((_conf)->i2c_client.i2c_master) |
#define | I2C_GET_ADDR(_conf) ((_conf)->i2c_client.i2c_addr) |
Typedefs | |
typedef int(* | i2c_slave_write_requested_cb_t) (struct i2c_slave_config *config) |
Function called when a write to the device is initiated. More... | |
typedef int(* | i2c_slave_write_received_cb_t) (struct i2c_slave_config *config, uint8_t val) |
Function called when a write to the device is continued. More... | |
typedef int(* | i2c_slave_read_requested_cb_t) (struct i2c_slave_config *config, uint8_t *val) |
Function called when a read from the device is initiated. More... | |
typedef int(* | i2c_slave_read_processed_cb_t) (struct i2c_slave_config *config, uint8_t *val) |
Function called when a read from the device is continued. More... | |
typedef int(* | i2c_slave_stop_cb_t) (struct i2c_slave_config *config) |
Function called when a stop condition is observed after a start condition addressed to a particular device. More... | |
Functions | |
int | i2c_configure (const struct device *dev, uint32_t dev_config) |
Configure operation of a host controller. More... | |
int | i2c_transfer (const struct device *dev, struct i2c_msg *msgs, uint8_t num_msgs, uint16_t addr) |
Perform data transfer to another I2C device in master mode. More... | |
static int | i2c_transfer_dt (const struct i2c_dt_spec *spec, struct i2c_msg *msgs, uint8_t num_msgs) |
Perform data transfer to another I2C device in master mode. More... | |
int | i2c_recover_bus (const struct device *dev) |
Recover the I2C bus. More... | |
static int | i2c_slave_register (const struct device *dev, struct i2c_slave_config *cfg) |
Registers the provided config as Slave device of a controller. More... | |
static int | i2c_slave_unregister (const struct device *dev, struct i2c_slave_config *cfg) |
Unregisters the provided config as Slave device. More... | |
int | i2c_slave_driver_register (const struct device *dev) |
Instructs the I2C Slave device to register itself to the I2C Controller. More... | |
int | i2c_slave_driver_unregister (const struct device *dev) |
Instructs the I2C Slave device to unregister itself from the I2C Controller. More... | |
static int | i2c_write (const struct device *dev, const uint8_t *buf, uint32_t num_bytes, uint16_t addr) |
Write a set amount of data to an I2C device. More... | |
static int | i2c_write_dt (const struct i2c_dt_spec *spec, const uint8_t *buf, uint32_t num_bytes) |
Write a set amount of data to an I2C device. More... | |
static int | i2c_read (const struct device *dev, uint8_t *buf, uint32_t num_bytes, uint16_t addr) |
Read a set amount of data from an I2C device. More... | |
static int | i2c_read_dt (const struct i2c_dt_spec *spec, uint8_t *buf, uint32_t num_bytes) |
Read a set amount of data from an I2C device. More... | |
static int | i2c_write_read (const struct device *dev, uint16_t addr, const void *write_buf, size_t num_write, void *read_buf, size_t num_read) |
Write then read data from an I2C device. More... | |
static int | i2c_write_read_dt (const struct i2c_dt_spec *spec, const void *write_buf, size_t num_write, void *read_buf, size_t num_read) |
Write then read data from an I2C device. More... | |
static int | i2c_burst_read (const struct device *dev, uint16_t dev_addr, uint8_t start_addr, uint8_t *buf, uint32_t num_bytes) |
Read multiple bytes from an internal address of an I2C device. More... | |
static int | i2c_burst_read_dt (const struct i2c_dt_spec *spec, uint8_t start_addr, uint8_t *buf, uint32_t num_bytes) |
Read multiple bytes from an internal address of an I2C device. More... | |
static int | i2c_burst_write (const struct device *dev, uint16_t dev_addr, uint8_t start_addr, const uint8_t *buf, uint32_t num_bytes) |
Write multiple bytes to an internal address of an I2C device. More... | |
static int | i2c_burst_write_dt (const struct i2c_dt_spec *spec, uint8_t start_addr, const uint8_t *buf, uint32_t num_bytes) |
Write multiple bytes to an internal address of an I2C device. More... | |
static int | i2c_reg_read_byte (const struct device *dev, uint16_t dev_addr, uint8_t reg_addr, uint8_t *value) |
Read internal register of an I2C device. More... | |
static int | i2c_reg_read_byte_dt (const struct i2c_dt_spec *spec, uint8_t reg_addr, uint8_t *value) |
Read internal register of an I2C device. More... | |
static int | i2c_reg_write_byte (const struct device *dev, uint16_t dev_addr, uint8_t reg_addr, uint8_t value) |
Write internal register of an I2C device. More... | |
static int | i2c_reg_write_byte_dt (const struct i2c_dt_spec *spec, uint8_t reg_addr, uint8_t value) |
Write internal register of an I2C device. More... | |
static int | i2c_reg_update_byte (const struct device *dev, uint8_t dev_addr, uint8_t reg_addr, uint8_t mask, uint8_t value) |
Update internal register of an I2C device. More... | |
static int | i2c_reg_update_byte_dt (const struct i2c_dt_spec *spec, uint8_t reg_addr, uint8_t mask, uint8_t value) |
Update internal register of an I2C device. More... | |
void | i2c_dump_msgs (const char *name, const struct i2c_msg *msgs, uint8_t num_msgs, uint16_t addr) |
Dump out an I2C message. More... | |
Public APIs for the I2C drivers.