Platform-specific layer provides a consistent I2C API to upper layers of the driver.
I2C API Overview
This API contains the functions to configure and control the I2C communication interface of programmable XBee devices. The inter-integrated circuit (IIC) provides a method of communication between a number of devices. The interface is designed to operate up to 100kbps with maximum bus loading and timing.
- I2C configuration functions:
- Functions to read/write the I2C:
Initializes and configures the I2C interface.
- Parameters
-
[in] | config | a byte containing the configuration masks for the I2C interface. At the moment this parameter is not used, it is reserved for future use. |
- Return values
-
ssize_t i2c_read |
( |
void * |
buf, |
|
|
size_t |
len |
|
) |
| |
Reads the specified number of bytes from the I2C interface.
- Parameters
-
[out] | buf | the buffer where the read bytes will be stored. |
[in] | len | the number of bytes to read. |
- Return values
-
ssize_t | the number of bytes read on success or the error code on failure. |
Sets the device (chip) i2c physical address.
- Parameters
-
[in] | addr | the slave address to be used by the I2C module expressed in 7 bits. This means, not left shifted. |
- Return values
-
ssize_t i2c_write |
( |
const void * |
buf, |
|
|
size_t |
len |
|
) |
| |
Writes the specified bytes through the I2C interface.
- Parameters
-
[in] | buf | buffer containing the bytes that will be written. |
[in] | len | the number of bytes to write from the buffer. |
- Return values
-
ssize_t | the number of bytes written on success or the error code on failure. |
ssize_t i2c_write_no_stop |
( |
const void * |
buf, |
|
|
size_t |
len |
|
) |
| |
Writes the specified bytes through the I2C interface without sending a stop condition at the end of the transfer.
- Parameters
-
[in] | buf | a buffer containing the bytes that will be written. |
[in] | len | the number of bytes to write from the buffer. |
- Return values
-
ssize_t | the number of bytes written on success or the error code on failure. |