m2mb API docs  25.30.006.0
m2mb API sets documentation
m2mb_i2c.h
Go to the documentation of this file.
1 /* $version: 252304 */
2 /*===============================================================================================*/
3 /* >>> Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. <<< */
34 #ifndef M2M_M2MB_I2C_API_H
35 #define M2M_M2MB_I2C_API_H
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 
50 {
54 };
55 
56 /* Global typedefs ========================================================================================*/
57 
62 typedef struct
63 {
64  UINT16 flags;
65  UINT16 len;
66  UINT8 *buf;
67 } M2MB_I2C_MSG;
68 
69 
73 typedef struct
74 {
76  UINT32 nmsgs;
78 
82 typedef struct
83 {
84  UINT8 sdaPin;
85  UINT8 sclPin;
86  UINT8 registerId;
90 
91 /* Global functions =======================================================================================*/
92 
124 /*---------------------------------------------------------------------------------------------------------*/
125 INT32 m2mb_i2c_open( const CHAR *path, INT32 flags, ... );
126 
127 
128 /*---------------------------------------------------------------------------------------------------------*/
156 
160 /*---------------------------------------------------------------------------------------------------------*/
161 INT32 m2mb_i2c_close( INT32 fd );
162 
163 
164 /*---------------------------------------------------------------------------------------------------------*/
264 /*---------------------------------------------------------------------------------------------------------*/
265 INT32 m2mb_i2c_ioctl( INT32 fd, INT32 request, ... );
266 
267 
268 /*---------------------------------------------------------------------------------------------------------*/
320 /*---------------------------------------------------------------------------------------------------------*/
321 SSIZE_T m2mb_i2c_read( INT32 fd, void *buf, SIZE_T nbyte );
322 
323 
324 /*---------------------------------------------------------------------------------------------------------*/
374 /*---------------------------------------------------------------------------------------------------------*/
375 SSIZE_T m2mb_i2c_write( INT32 fd, const void *buf, SIZE_T nbyte );
376 
377 #endif /* M2M_M2MB_I2C_API_H */
378 
379 
M2MB_I2C_MSG::buf
UINT8 * buf
Definition: m2mb_i2c.h:66
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:88
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:49
M2MB_I2C_IOCTL_SET_CFG
Definition: m2mb_i2c.h:51
M2MB_I2C_MSG::len
UINT16 len
Definition: m2mb_i2c.h:65
M2MB_I2C_IOCTL_RDWR
Definition: m2mb_i2c.h:53
M2MB_I2C_RDWR_IOCTL_DATA::msgs
M2MB_I2C_MSG * msgs
Definition: m2mb_i2c.h:75
M2MB_I2C_CFG_T::sdaPin
UINT8 sdaPin
Definition: m2mb_i2c.h:84
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:73
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:62
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:52
M2MB_I2C_CFG_T
I2C device configuration structure.
Definition: m2mb_i2c.h:82
M2MB_I2C_CFG_T::sclPin
UINT8 sclPin
Definition: m2mb_i2c.h:85
M2MB_I2C_CFG_T::registerId
UINT8 registerId
Definition: m2mb_i2c.h:86
M2MB_I2C_RDWR_IOCTL_DATA::nmsgs
UINT32 nmsgs
Definition: m2mb_i2c.h:76
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:64