Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
i2c-dev.h
Go to the documentation of this file.
1
34#ifndef _I2C_DEV_HXX_
35#define _I2C_DEV_HXX_
36
37#if defined (__linux__)
38 #include <linux/i2c-dev.h>
39#elif defined (__FreeRTOS__) || defined(ESP_PLATFORM)
40 #include <stdint.h>
42 #define I2C_MAGIC ('i')
43
47 #define I2C_SLAVE IOW(I2C_MAGIC, 1, sizeof(long))
48
50 #define I2C_RDWR IOWR(I2C_MAGIC, 2, sizeof(void*))
51
53 #define I2C_SMBUS IOWR(I2C_MAGIC, 3, sizeof(void*))
54
56 struct i2c_smbus_ioctl_data
57 {
58 uint8_t read_write;
59 uint8_t command;
60 uint32_t size;
61 union i2c_smbus_data *data;
62 };
63
65 struct i2c_rdwr_ioctl_data
66 {
67 struct i2c_msg *msgs;
68 uint32_t nmsgs;
69 };
70
72 #define I2C_RDRW_IOCTL_MAX_MSGS 42
73#else
74 #error I2C drivers not supported on this OS
75#endif
76
77#endif /* _I2C_DEV_HXX_ */