File syn_port_i2c.h¶
FileList > port > syn_port_i2c.h
Go to the source code of this file
I2C port interface — implement these for your platform.
#include "../common/syn_defs.h"#include <stddef.h>#include <stdint.h>
Classes¶
| Type | Name |
|---|---|
| struct | SYN_I2C_Config I2C bus configuration. |
Public Functions¶
| Type | Name |
|---|---|
| SYN_Status | syn_port_i2c_deinit (uint8_t bus) Deinitialize an I2C bus. |
| SYN_Status | syn_port_i2c_init (const SYN_I2C_Config * cfg) Initialize an I2C bus. |
| SYN_Status | syn_port_i2c_read (uint8_t bus, uint8_t addr, uint8_t * data, size_t len) Read data from an I2C device. |
| SYN_Status | syn_port_i2c_write (uint8_t bus, uint8_t addr, const uint8_t * data, size_t len) Write data to an I2C device. |
| SYN_Status | syn_port_i2c_write_read (uint8_t bus, uint8_t addr, const uint8_t * tx_data, size_t tx_len, uint8_t * rx_data, size_t rx_len) Write then read (register access pattern). |
Public Functions Documentation¶
function syn_port_i2c_deinit¶
Deinitialize an I2C bus.
Parameters:
busI2C bus index.
Returns:
SYN_OK on success.
function syn_port_i2c_init¶
Initialize an I2C bus.
Parameters:
cfgI2C configuration.
Returns:
SYN_OK on success.
function syn_port_i2c_read¶
Read data from an I2C device.
Parameters:
busI2C bus index.addr7-bit device address.dataBuffer to receive data.lenNumber of bytes to read.
Returns:
SYN_OK on ACK, SYN_ERROR on NACK/timeout.
function syn_port_i2c_write¶
Write data to an I2C device.
Parameters:
busI2C bus index.addr7-bit device address.dataData to write.lenNumber of bytes.
Returns:
SYN_OK on ACK, SYN_ERROR on NACK/timeout.
function syn_port_i2c_write_read¶
Write then read (register access pattern).
SYN_Status syn_port_i2c_write_read (
uint8_t bus,
uint8_t addr,
const uint8_t * tx_data,
size_t tx_len,
uint8_t * rx_data,
size_t rx_len
)
Sends a write (typically a register address) followed by a repeated start and read. This is the most common I2C transaction pattern.
Parameters:
busI2C bus index.addr7-bit device address.tx_dataData to write (e.g., register address).tx_lenWrite length.rx_dataBuffer for read data.rx_lenRead length.
Returns:
SYN_OK on success.
The documentation for this class was generated from the following file src/syntropic/port/syn_port_i2c.h