m2mb API docs  25.30.004.0
m2mb API sets documentation
m2mb_i2c.h
Go to the documentation of this file.
1 /* $version: 252203 */
2 /*===============================================================================================*/
3 /* >>> Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. <<< */
32 #ifndef M2M_M2MB_I2C_API_H
33 #define M2M_M2MB_I2C_API_H
34 
35 
36 
37 /* Global declarations ==========================================================================*/
38 #ifndef NULL
39 #define NULL 0
40 #endif
41 
42 #define I2C_M_WR 0x0000
43 #define I2C_M_RD 0x0001
45 /* Global enums ==============================================================================*/
46 
51 {
55 };
56 
57 /* Global typedefs ==============================================================================*/
58 
59 
60 
65 typedef struct
66 {
67  UINT16 flags;
68  UINT16 len;
69  UINT8 *buf;
70 } M2MB_I2C_MSG;
71 
72 
76 typedef struct
77 {
79  UINT32 nmsgs;
81 
85 typedef struct
86 {
87  UINT8 sdaPin;
88  UINT8 sclPin;
89  UINT8 registerId;
93 
94 /* Global functions =============================================================================*/
95 
96 
129 /*-----------------------------------------------------------------------------------------------*/
130 INT32 m2mb_i2c_open( const CHAR *path, INT32 flags, ... );
131 
132 
133 /*-----------------------------------------------------------------------------------------------*/
162 
167 /*-----------------------------------------------------------------------------------------------*/
168 INT32 m2mb_i2c_close( INT32 fd );
169 
170 
171 /*-----------------------------------------------------------------------------------------------*/
259 /*-----------------------------------------------------------------------------------------------*/
260 INT32 m2mb_i2c_ioctl( INT32 fd, INT32 request, ... );
261 
262 
263 /*-----------------------------------------------------------------------------------------------*/
312 /*-----------------------------------------------------------------------------------------------*/
313 SSIZE_T m2mb_i2c_read( INT32 fd, void *buf, SIZE_T nbyte );
314 
315 
316 /*-----------------------------------------------------------------------------------------------*/
362 /*-----------------------------------------------------------------------------------------------*/
363 SSIZE_T m2mb_i2c_write( INT32 fd, const void *buf, SIZE_T nbyte );
364 
365 #endif /* M2M_M2MB_I2C_API_H */
366 
367 
M2MB_I2C_MSG::buf
UINT8 * buf
Definition: m2mb_i2c.h:69
m2mb_i2c_write
SSIZE_T m2mb_i2c_write(INT32 fd, const void *buf, SIZE_T nbyte)
Write data to a connected I2C device.
M2MB_I2C_CFG_T::rw_param
M2MB_I2C_RDWR_IOCTL_DATA * rw_param
Definition: m2mb_i2c.h:91
m2mb_i2c_close
INT32 m2mb_i2c_close(INT32 fd)
Close an I2C device.
M2MB_I2C_IOCTL_REQUEST
M2MB_I2C_IOCTL_REQUEST
enum used to access I2C configuration
Definition: m2mb_i2c.h:50
M2MB_I2C_IOCTL_SET_CFG
Definition: m2mb_i2c.h:52
M2MB_I2C_MSG::len
UINT16 len
Definition: m2mb_i2c.h:68
M2MB_I2C_IOCTL_RDWR
Definition: m2mb_i2c.h:54
M2MB_I2C_RDWR_IOCTL_DATA::msgs
M2MB_I2C_MSG * msgs
Definition: m2mb_i2c.h:78
M2MB_I2C_CFG_T::sdaPin
UINT8 sdaPin
Definition: m2mb_i2c.h:87
M2MB_I2C_RDWR_IOCTL_DATA
Structure to be used with the M2MB_I2C_IOCTL_RDWR option in m2mb_i2c_ioctl call.
Definition: m2mb_i2c.h:76
M2MB_I2C_MSG
Structure to be used as container for a write or read operation in I2C Combined mode (M2MB_I2C_IOCTL_...
Definition: m2mb_i2c.h:65
m2mb_i2c_open
INT32 m2mb_i2c_open(const CHAR *path, INT32 flags,...)
open an I2C device
m2mb_i2c_ioctl
INT32 m2mb_i2c_ioctl(INT32 fd, INT32 request,...)
configure, read from and/or write to an I2C device
M2MB_I2C_IOCTL_GET_CFG
Definition: m2mb_i2c.h:53
M2MB_I2C_CFG_T
I2C device configuration structure.
Definition: m2mb_i2c.h:85
M2MB_I2C_CFG_T::sclPin
UINT8 sclPin
Definition: m2mb_i2c.h:88
M2MB_I2C_CFG_T::registerId
UINT8 registerId
Definition: m2mb_i2c.h:89
M2MB_I2C_RDWR_IOCTL_DATA::nmsgs
UINT32 nmsgs
Definition: m2mb_i2c.h:79
m2mb_i2c_read
SSIZE_T m2mb_i2c_read(INT32 fd, void *buf, SIZE_T nbyte)
Read data from a connected I2C device.
M2MB_I2C_MSG::flags
UINT16 flags
Definition: m2mb_i2c.h:67