I2C library functions.
More...
|
int | i2c_init () |
| Initialises the i2c-dev interface for the I2C peripheral exposed on the P1 header (which is dependent on the board revision)
|
|
int | i2c_init_name (char *devname) |
| Initialises the i2c-dev interface for the sysfs entry specified by the devname parameter.
|
|
int | i2c_select_device (unsigned int fd, unsigned int addr) |
| Selects a specific I2C slave device.
|
|
int | i2c_write (unsigned int fd, unsigned int addr, unsigned char *data, unsigned int len) |
| Initiates an I2C write operation.
|
|
int | i2c_read (unsigned int fd, unsigned int addr, unsigned char *data, unsigned int len) |
| Initiates an I2C read operation.
|
|
I2C library functions.
Initialises the i2c-dev interface for the I2C peripheral exposed on the P1 header (which is dependent on the board revision)
- Returns
- The file descriptor for the relevant i2c-dev interface, -1 for failure
Definition at line 57 of file pi_i2c.c.
int i2c_init_name |
( |
char * |
devname | ) |
|
Initialises the i2c-dev interface for the sysfs entry specified by the devname parameter.
- Parameters
-
devname | The sysfs entry for a particular I2C peripheral |
- Returns
- The file descriptor for the relevant i2c-dev interface, -1 for failure
Definition at line 100 of file pi_i2c.c.
int i2c_read |
( |
unsigned int |
fd, |
|
|
unsigned int |
addr, |
|
|
unsigned char * |
data, |
|
|
unsigned int |
len |
|
) |
| |
Initiates an I2C read operation.
- Parameters
-
fd | File descriptor for the i2c-dev interface |
addr | I2C slave device address |
data | Pointer to the read buffer |
len | Length of data |
- Returns
- 1 for success, -1 for failure
Definition at line 179 of file pi_i2c.c.
int i2c_select_device |
( |
unsigned int |
fd, |
|
|
unsigned int |
addr |
|
) |
| |
Selects a specific I2C slave device.
- Parameters
-
fd | File descriptor for the i2c-dev interface |
addr | I2C slave device address |
- Returns
- 1 for success, -1 for failure
Definition at line 124 of file pi_i2c.c.
int i2c_write |
( |
unsigned int |
fd, |
|
|
unsigned int |
addr, |
|
|
unsigned char * |
data, |
|
|
unsigned int |
len |
|
) |
| |
Initiates an I2C write operation.
- Parameters
-
fd | File descriptor for the i2c-dev interface |
addr | I2C slave device address |
data | Data to write to the device |
len | Length of data |
- Returns
- 1 for success, -1 for failure
Definition at line 148 of file pi_i2c.c.