m2mb API docs  25.30.003
m2mb API sets documentation
m2mb_i2c.h
Go to the documentation of this file.
1 /*===============================================================================================*/
2 /* >>> Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. <<< */
31 #ifndef M2M_M2MB_I2C_API_H
32 #define M2M_M2MB_I2C_API_H
33 
34 
35 
36 /* Global declarations ==========================================================================*/
37 #ifndef NULL
38 #define NULL 0
39 #endif
40 
41 #define I2C_M_WR 0x0000
42 #define I2C_M_RD 0x0001
44 /* Global enums ==============================================================================*/
45 
50 {
54 };
55 
56 /* Global typedefs ==============================================================================*/
57 
58 
59 
64 typedef struct
65 {
66  UINT16 flags;
67  UINT16 len;
68  UINT8 *buf;
69 } M2MB_I2C_MSG;
70 
71 
75 typedef struct
76 {
78  UINT32 nmsgs;
80 
84 typedef struct
85 {
86  UINT8 sdaPin;
87  UINT8 sclPin;
88  UINT8 registerId;
92 
93 /* Global functions =============================================================================*/
94 
95 
128 /*-----------------------------------------------------------------------------------------------*/
129 INT32 m2mb_i2c_open( const CHAR *path, INT32 flags, ... );
130 
131 
132 /*-----------------------------------------------------------------------------------------------*/
161 
166 /*-----------------------------------------------------------------------------------------------*/
167 INT32 m2mb_i2c_close( INT32 fd );
168 
169 
170 /*-----------------------------------------------------------------------------------------------*/
258 /*-----------------------------------------------------------------------------------------------*/
259 INT32 m2mb_i2c_ioctl( INT32 fd, INT32 request, ... );
260 
261 
262 /*-----------------------------------------------------------------------------------------------*/
311 /*-----------------------------------------------------------------------------------------------*/
312 SSIZE_T m2mb_i2c_read( INT32 fd, void *buf, SIZE_T nbyte );
313 
314 
315 /*-----------------------------------------------------------------------------------------------*/
361 /*-----------------------------------------------------------------------------------------------*/
362 SSIZE_T m2mb_i2c_write( INT32 fd, const void *buf, SIZE_T nbyte );
363 
364 #endif /* M2M_M2MB_I2C_API_H */
365 
366 
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::sdaPin
UINT8 sdaPin
Definition: m2mb_i2c.h:86
m2mb_i2c_close
INT32 m2mb_i2c_close(INT32 fd)
Close an I2C device.
M2MB_I2C_RDWR_IOCTL_DATA::nmsgs
UINT32 nmsgs
Definition: m2mb_i2c.h:78
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:67
M2MB_I2C_RDWR_IOCTL_DATA::msgs
M2MB_I2C_MSG * msgs
Definition: m2mb_i2c.h:77
M2MB_I2C_IOCTL_RDWR
Definition: m2mb_i2c.h:53
M2MB_I2C_MSG::flags
UINT16 flags
Definition: m2mb_i2c.h:66
M2MB_I2C_MSG::buf
UINT8 * buf
Definition: m2mb_i2c.h:68
M2MB_I2C_CFG_T::sclPin
UINT8 sclPin
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:75
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:64
m2mb_i2c_open
INT32 m2mb_i2c_open(const CHAR *path, INT32 flags,...)
open an I2C device
M2MB_I2C_CFG_T::registerId
UINT8 registerId
Definition: m2mb_i2c.h:88
M2MB_I2C_CFG_T::rw_param
M2MB_I2C_RDWR_IOCTL_DATA * rw_param
Definition: m2mb_i2c.h:90
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:84
m2mb_i2c_read
SSIZE_T m2mb_i2c_read(INT32 fd, void *buf, SIZE_T nbyte)
Read data from a connected I2C device.