i2c_m_sync_init

Initialize synchronous I2C interface.

int32_t i2c_m_sync_init(
    struct i2c_m_sync_desc * i2c,
    void * hw
)

This function initializes the given I/O descriptor to be used as a synchronous I2C interface descriptor. It checks if the given hardware is not initialized and if the given hardware is permitted to be initialized.

Parameters

i2c

Type: struct i2c_m_sync_desc Struct *

An I2C descriptor, which is used to communicate through I2C

hw

Type: void *

The pointer to hardware instance

Returns

Type: int32_t

Initialization status.

-1

The passed parameters were invalid or the interface is already initialized

0

The initialization is completed successfully