void I2CIN (int sda_pin, int
scl_pin, int slaveADDR, int
opt1, int opt2, int opt3, int opt4, int opt5, int cnt
, char
*inList);
I2CIN will read a series of bytes from an I2C slave device. sda_pin is any expression
defining the SDA pin to use. scl_pin
will be designated the SCL pin. slaveADDR will select a
device
on the I2C bus.
Up to 5 optional byte
values may be writen out prior to reading the inList
. If the optX
value is -1 then it will not be sent out. Most i2c devices have a
sub-address field that is written immediately before reading. This field
would be held in opt1. For devices that do not have a sub-address,
opt1 can be set to
-1. In this case, no I2C write is performed before the I2CIN. For some slow
i2c devices, they can not respond to a write of
sub-address, immediately followed by a read of the device. For these slow devices (often implemented
with a slower micro-processor), it is necessary to do seperate I2COUT and I2CIN with a delay in
between.
After any write of the optX
,a series of
cnt bytes will be read from the slave to fill the character
array inList.
I2C is a byte oriented bus, so each transaction will either send a byte value
(0 to 255) or receive a byte for each element of the inList
.
Data is shifted in at 350 Kbits/sec.