Datasheet

Flyport Wi-Fi and Ethernet Programmer's guide framework 2.3 (rev 1.0) www.openpicus.com
Write a byte on I2C I2CWrite(BYTE data);
This function writes a byte of data .
Parameters:
data: The byte data to be sent
Returns:
0: NACK condition detected
1: ACK condition detected
2: Write Collision detected
3: Master Collision detected
Accessing memory registers of slave devices
The easier way to communicate with a I2C device, is using the ready-to-go functions offered by the
OpenPicus Framework to read/write registers. Using the following functions, you don't need to know
the details of the I2C communications, you are just requested to pass the device and the register(s)
addresses and the commands will exchange the data with the slave device. The functions follows the
standard way to read/write registers on I2C bus, if you experience any problems, always refer to slave
device datasheet to check if some particular operation is required to communicate.
Note on device addressing: in the following functions, with "device address" is intended the 7-bit I2C
address of the device. You can find the default address and how to change it in the datasheet of each
I2C device. The address will be correctly shifted and added with the read/write bit by the read/write
functions
Read a single register I2CReadReg( BYTE DeviceAddr,
BYTE RegisterAddr,
unsigned int rwDelay);
This function to read a byte of data from a specific device.
Parameters:
DeviceAddr: The byte address of slave device
RegisterAddr: The byte address of memory register to read
rwDelay: The delay (expressed in 10us) between write and read operations
performed. This delay is needed by some I2C devices (please see slave
datasheet for further info)
Returns:
char of data read.
Reading mulLple registers → I2CReadMulti( BYTE DeviceAddr,
BYTE RegisterAddr,
BYTE destination[],
unsigned int numReg,
unsigned int rwDelay);
This function to read a “numReg amount of bytes starting from a specific address.
Parameters:
DeviceAddr: The byte address of slave device
RegisterAddr: The byte address of memory register to read
destination: The byte array to store data
numReg: The amount of register to read.
26