sub_i2c_read

Top  Previous  Next
Got to SUB-20 page

Synopsis

int sub_i2c_read( sub_handle hndl, int sa, int ma, int ma_sz,

                                                                 char* buf, int sz )

 

Perform complete I2C master read transaction with optional memory address write. Transaction will have following format:

 

sub_i2c_read

 

If ma_sz is zero "Memory Address Write" stage will be skipped.

Function has no limitation of the read data size - sz parameter. However internal organization of the I2C slave device being read should be considered.  

Parameters

sa - Slave Address

ma - Memory Address. Will be shifted out in "Memory Address Write" stage MSB first

ma_sz - Memory Address size bytes

buf - Buffer to store read data

sz - Read data size bytes.

Return value

On success function returns 0. Otherwise error code.

See also

Error Codes, I2C Status