sub_bb_i2c_read

Top  Previous  Next
Got to SUB-20 page

Synopsis

int sub_bb_i2c_read( sub_handle hndl, int channel, 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

•channel - Bit-bang I2C Master channel 0..3

•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

Compatibility

FW version

0.2.6 or grater

Library version

0.1.12.16 or grater