1234567891011121314151617181920212223242526 |
- #ifndef I2C_CONTEXT_H
- #define I2C_CONTEXT_H
- #include <stdbool.h>
- #include <stdint.h>
- struct i2c_ctx {
-
- void (*exit)(struct i2c_ctx *ctx);
-
- bool (*write)(struct i2c_ctx *ctx, uint8_t reg, uint8_t val);
-
- bool (*read)(struct i2c_ctx *ctx, uint8_t reg, uint8_t *val);
-
- uint8_t addr;
- int file;
- };
- #define I2C_BUS "/dev/i2c-1"
- extern struct i2c_ctx *i2c_slave_open(char *i2c_bus, uint8_t slave_addr);
- #endif
|