![]() |
WL865E4-P
36.07.001
|
This section describes the M2MB APIs to perform various I2C operations. More...
| #define | I2C_FLAG_START 0x00000001 |
| #define | I2C_FLAG_STOP 0x00000002 |
| #define | I2C_FLAG_WRITE 0x00000004 |
| #define | I2C_FLAG_READ 0x00000008 |
| enum | M2MB_I2C_IOCTL_REQUEST { M2MB_I2C_IOCTL_SET_CFG, M2MB_I2C_IOCTL_GET_CFG } |
| typedef enum M2MB_I2C_IOCTL_REQUEST | M2MB_I2C_IOCTL_REQUEST_T |
| typedef void * | M2MB_I2C_ID_T |
| INT32 | m2mb_i2c_open (const CHAR *path, INT32 flags,...) |
| Open an I2C device. More... | |
| INT32 | m2mb_i2c_close (INT32 fd) |
| Closes an I2C device. More... | |
| INT32 | m2mb_i2c_ioctl (INT32 fd, M2MB_I2C_IOCTL_REQUEST_T request,...) |
| Configure the I2C device. More... | |
| SSIZE_T | m2mb_i2c_read (INT32 fd, void *buf, SIZE_T nbyte) |
| Read the I2C device. More... | |
| SSIZE_T | m2mb_i2c_write (INT32 fd, const void *buf, SIZE_T nbyte) |
| Write to I2C device. More... | |
This section describes the M2MB APIs to perform various I2C operations.
| #define I2C_FLAG_READ 0x00000008 |
Must be set to indicate a READ transfer.
Definition at line 58 of file m2mb_i2c.h.
| #define I2C_FLAG_START 0x00000001 |
Specifies that the transfer begins with a START bit - S.
Definition at line 55 of file m2mb_i2c.h.
| #define I2C_FLAG_STOP 0x00000002 |
Specifies that the transfer ends with a STOP bit - P.
Definition at line 56 of file m2mb_i2c.h.
| #define I2C_FLAG_WRITE 0x00000004 |
Must be set to indicate a WRITE transfer.
Definition at line 57 of file m2mb_i2c.h.
| typedef void* M2MB_I2C_ID_T |
Definition at line 71 of file m2mb_i2c.h.
| typedef enum M2MB_I2C_IOCTL_REQUEST M2MB_I2C_IOCTL_REQUEST_T |
| Enumerator | |
|---|---|
| M2MB_I2C_IOCTL_SET_CFG | set i2c device configuration |
| M2MB_I2C_IOCTL_GET_CFG | get i2c device configuration |
Definition at line 63 of file m2mb_i2c.h.
Closes an I2C device.
This API closes the requested I2C device
| [in] | fd | File Descriptor of I2C device |
Example
| INT32 m2mb_i2c_ioctl | ( | INT32 | fd, |
| M2MB_I2C_IOCTL_REQUEST_T | request, | ||
| ... | |||
| ) |
Configure the I2C device.
This API set/get the I2C device configuration
| [in] | fd | File Descriptor of I2C device |
| [in] | request | required operation set/get configuration(see M2MB_I2C_IOCTL_REQUEST) |
Example
Open an I2C device.
This API opens the requested I2C device
| [in] | path | Pointer to an I2C device to open |
| [in] | flags | currently unused |
Example
Read the I2C device.
This API reads the data bytes from the I2C device
| [in] | fd | File Descriptor of I2C device |
| [in,out] | buf | reference to the data to be read |
| [in] | nbyte | number of data bytes to be read |
Example
Write to I2C device.
This API writes the data bytes to the I2C device
| [in] | fd | File Descriptor of the I2C device |
| [in] | buf | reference to the data to be written |
| [in] | nbyte | number of data bytes to be write |
Example