Skip to content

File syn_port_i2c_async.h

FileList > port > syn_port_i2c_async.h

Go to the source code of this file

Async I2C port interface — implement these for your platform. More...

Detailed Description

Provides non-blocking, callback-based I2C transactions alongside the existing blocking API in syn_port_i2c.h. The callback fires from ISR context.

** **

static void on_i2c_done(uint8_t bus, SYN_Status result, void *ctx) {
    // Access rx_buf — data is ready
}

uint8_t reg = 0xD0;
uint8_t val;
SYN_I2C_Xfer xfer = {
    .bus       = 0,
    .addr      = 0x76,
    .tx_data   = &reg,
    .tx_len    = 1,
    .rx_data   = &val,
    .rx_len    = 1,
    .callback  = on_i2c_done,
    .user_data = NULL,
};
syn_port_i2c_xfer_async(&xfer);

The documentation for this class was generated from the following file src/syntropic/port/syn_port_i2c_async.h