26 lines
530 B
C
26 lines
530 B
C
|
#ifndef __I2C_H__
|
||
|
#define __I2C_H__
|
||
|
|
||
|
#include "driver.h"
|
||
|
|
||
|
int i2c_open(const struct driver *drv);
|
||
|
int i2c_close(const struct driver *drv);
|
||
|
|
||
|
int i2c_read(const struct driver *drv, char *buffer, unsigned int len);
|
||
|
int i2c_write(const struct driver *drv, const char *buffer, unsigned int len);
|
||
|
|
||
|
struct i2c {
|
||
|
const char * i2c_device;
|
||
|
const uint8_t slave_addr;
|
||
|
int i2c_file;
|
||
|
};
|
||
|
|
||
|
static const struct driver_fp i2c_fp = {
|
||
|
.open = i2c_open,
|
||
|
.close = i2c_close,
|
||
|
.read = i2c_read,
|
||
|
.write = i2c_write,
|
||
|
};
|
||
|
|
||
|
#endif
|