File syn_i2c.h¶
FileList > drivers > syn_i2c.h
Go to the source code of this file
Hardware-decoupled I2C driver supporting Master/Slave roles & register access.
#include "../common/syn_defs.h"#include "../port/syn_port_i2c.h"
Classes¶
| Type | Name |
|---|---|
| struct | SYN_I2C I2C driver handle structure. |
| struct | SYN_I2C_Config I2C driver instance configuration parameters. |
Public Types¶
| Type | Name |
|---|---|
| enum | SYN_I2C_Role I2C operational mode role. |
Public Functions¶
| Type | Name |
|---|---|
| SYN_Status | syn_i2c_deinit (SYN_I2C * i2c) De-initialize an I2C instance. |
| SYN_Status | syn_i2c_init (SYN_I2C * i2c, const SYN_I2C_Config * cfg) Initialize an I2C instance. |
| SYN_Status | syn_i2c_read_reg (SYN_I2C * i2c, uint16_t addr, uint8_t reg, uint8_t * val) Read an 8-bit register from a slave device. |
| SYN_Status | syn_i2c_transfer (SYN_I2C * i2c, uint16_t addr, const uint8_t * tx, size_t tx_len, uint8_t * rx, size_t rx_len) Perform raw buffer transfer (Write, Read, or Write-Read restart). |
| SYN_Status | syn_i2c_write_reg (SYN_I2C * i2c, uint16_t addr, uint8_t reg, uint8_t val) Write an 8-bit register on a slave device. |
Public Types Documentation¶
enum SYN_I2C_Role¶
I2C operational mode role.
Public Functions Documentation¶
function syn_i2c_deinit¶
De-initialize an I2C instance.
Parameters:
i2cPointer to SYN_I2C handle.
Returns:
SYN_OK on success.
function syn_i2c_init¶
Initialize an I2C instance.
Parameters:
i2cPointer to SYN_I2C handle.cfgConfiguration structure.
Returns:
SYN_OK on success.
function syn_i2c_read_reg¶
Read an 8-bit register from a slave device.
Parameters:
i2cPointer to initialized I2C handle.addr7-bit slave address.regRegister index byte.valPointer to store output register byte.
Returns:
SYN_OK on success.
function syn_i2c_transfer¶
Perform raw buffer transfer (Write, Read, or Write-Read restart).
SYN_Status syn_i2c_transfer (
SYN_I2C * i2c,
uint16_t addr,
const uint8_t * tx,
size_t tx_len,
uint8_t * rx,
size_t rx_len
)
Parameters:
i2cPointer to initialized I2C handle.addrTarget 7-bit slave address.txTX data buffer (can be NULL).tx_lenTX byte count.rxRX data buffer (can be NULL).rx_lenRX byte count.
Returns:
SYN_OK on success.
function syn_i2c_write_reg¶
Write an 8-bit register on a slave device.
Parameters:
i2cPointer to initialized I2C handle.addr7-bit slave address.regRegister index byte.valByte to write into register.
Returns:
SYN_OK on success.
The documentation for this class was generated from the following file src/syntropic/drivers/syn_i2c.h