Cleanup I2C handling

* Move OS specific code to new files i2c.h and i2c.c
* As side effect a likely bug (linux only code) in the existing driver
  has been fixed.

Compile tested on Debian/i386 and OpenWRT/arm.

Signed-off-by: Harald Geyer <harald@ccbib.org>
This commit is contained in:
Harald Geyer
2016-07-31 09:42:06 +02:00
parent ecd8aac043
commit 0a38c18f00
6 changed files with 161 additions and 71 deletions
+14
View File
@@ -0,0 +1,14 @@
#ifndef I2C_H
#define I2C_H
struct i2c_data;
typedef struct i2c_data I2CHandle;
#define I2C_DEFAULT_DEVICE "/dev/i2c-0"
extern I2CHandle *i2c_open(const char *device, unsigned int addr);
extern void i2c_close(I2CHandle *h);
extern int i2c_write(I2CHandle *h, void *buf, unsigned int count);
#endif /* I2C_H */