![]() |
WE310F5
39.00.000
|
This section describes the M2MB APIs to perform various I2C operations. More...
enum | M2MB_I2C_IOCTL_REQUEST { M2MB_I2C_IOCTL_SET_CFG, M2MB_I2C_IOCTL_GET_CFG } |
enum | M2MB_I2C_MODE { M2MB_I2C_MODE_SLAVE = 0, M2MB_I2C_MODE_MASTER = 1 } |
enum | M2MB_I2C_ADDR { M2MB_I2C_ADDR_7BIT = 0, M2MB_I2C_ADDR_10BIT = 1 } |
typedef enum M2MB_I2C_IOCTL_REQUEST | M2MB_I2C_IOCTL_REQUEST_T |
typedef enum M2MB_I2C_MODE | M2MB_I2C_MODE_T |
typedef enum M2MB_I2C_ADDR | M2MB_I2C_ADDR_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, SSIZE_T nbyte) |
Read the I2C device. More... | |
SSIZE_T | m2mb_i2c_write (INT32 fd, const void *buf, SSIZE_T nbyte) |
Write to I2C device. More... | |
INT32 | m2mb_i2c_reset (INT32 fd) |
Reset the I2C device. More... | |
This section describes the M2MB APIs to perform various I2C operations.
typedef enum M2MB_I2C_ADDR M2MB_I2C_ADDR_T |
typedef enum M2MB_I2C_IOCTL_REQUEST M2MB_I2C_IOCTL_REQUEST_T |
typedef enum M2MB_I2C_MODE M2MB_I2C_MODE_T |
enum M2MB_I2C_ADDR |
Enumerator | |
---|---|
M2MB_I2C_ADDR_7BIT | i2c slave uses 7 bit addressing |
M2MB_I2C_ADDR_10BIT | i2c slave uses 10 bit addressing |
Definition at line 71 of file m2mb_i2c.h.
Enumerator | |
---|---|
M2MB_I2C_IOCTL_SET_CFG | set i2c device configuration |
M2MB_I2C_IOCTL_GET_CFG | get i2c device configuration |
Definition at line 58 of file m2mb_i2c.h.
enum M2MB_I2C_MODE |
Enumerator | |
---|---|
M2MB_I2C_MODE_SLAVE | set i2c slave mode |
M2MB_I2C_MODE_MASTER | set i2c master mode |
Definition at line 65 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
Reset the I2C device.
This API resets the I2C Master from the blocked I2C state
[in] | fd | File Descriptor of I2C device |
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