Skip to content

Commit

Permalink
account for different versions of i2c-dev installed on the system
Browse files Browse the repository at this point in the history
  • Loading branch information
giuliomoro committed Sep 10, 2019
1 parent 6a5124e commit 64c1b9a
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions I2C Library/I2C.c
Expand Up @@ -34,8 +34,19 @@ SOFTWARE.
#include<stdio.h>
#include<fcntl.h>
#include<sys/ioctl.h>
#include<linux/i2c.h>
#include<linux/i2c-dev.h>
#include <linux/i2c-dev.h>
// heuristic to guess what version of i2c-dev.h we have:
// the one installed with `apt-get install libi2c-dev`
// would conflict with linux/i2c.h, while the stock
// one requires linus/i2c.h
#ifndef I2C_SMBUS_BLOCK_MAX
// If this is not defined, we have the "stock" i2c-dev.h
// so we include linux/i2c.h
#include <linux/i2c.h>
typedef unsigned char i2c_char_t;
#else
typedef char i2c_char_t;
#endif

/* Header Files */
#include "I2C.h"
Expand Down

0 comments on commit 64c1b9a

Please sign in to comment.