From: John Melton G0ORX <john.d.melton@googlemail.com>
Date: Sat, 14 Dec 2019 14:47:25 +0000 (+0000)
Subject: Updated i2c to use latest i2c-dev includes and library
X-Git-Url: https://git.rkrishnan.org/pf/module-simplejson.html?a=commitdiff_plain;h=ac4b1d162448a6e43b2c8f4eb85fc14f0b31dc80;p=pihpsdr.git

Updated i2c to use latest i2c-dev includes and library
---

diff --git a/Makefile b/Makefile
index 1d17bb3..3b32b0f 100644
--- a/Makefile
+++ b/Makefile
@@ -24,7 +24,7 @@ PURESIGNAL_INCLUDE=PURESIGNAL
 #LOCALCW_INCLUDE=LOCALCW
 
 # uncomment the line below for SoapySDR
-SOAPYSDR_INCLUDE=SOAPYSDR
+#SOAPYSDR_INCLUDE=SOAPYSDR
 
 # uncomment the line below to include support for psk31
 #PSK_INCLUDE=PSK
@@ -180,6 +180,7 @@ endif
 
 ifeq ($(I2C_INCLUDE),I2C)
   I2C_OPTIONS=-D I2C
+  I2C_LIBS=-li2c
   I2C_SOURCES=i2c.c
   I2C_HEADERS=i2c.h
   I2C_OBJS=i2c.o
@@ -225,7 +226,7 @@ OPTIONS=-g -Wno-deprecated-declarations $(MIDI_OPTIONS) $(PURESIGNAL_OPTIONS) $(
         $(CONTROLLER2_OPTIONS) \
 	-D GIT_DATE='"$(GIT_DATE)"' -D GIT_VERSION='"$(GIT_VERSION)"' $(DEBUG_OPTION) -O3
 
-LIBS=-lrt -lm -lwdsp -lpthread $(AUDIO_LIBS) $(USBOZY_LIBS) $(PSKLIBS) $(GTKLIBS) $(GPIO_LIBS) $(SOAPYSDRLIBS) $(FREEDVLIBS) $(STEMLAB_LIBS) $(MIDI_LIBS)
+LIBS=-lrt -lm -lwdsp -lpthread $(AUDIO_LIBS) $(USBOZY_LIBS) $(PSKLIBS) $(GTKLIBS) $(GPIO_LIBS) $(I2C_LIBS) $(SOAPYSDRLIBS) $(FREEDVLIBS) $(STEMLAB_LIBS) $(MIDI_LIBS)
 INCLUDES=$(GTKINCLUDES)
 
 COMPILE=$(CC) $(OPTIONS) $(INCLUDES)
diff --git a/i2c.c b/i2c.c
index 4f99b9c..7478c57 100644
--- a/i2c.c
+++ b/i2c.c
@@ -4,6 +4,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <linux/i2c-dev.h>
+#include <i2c/smbus.h>
 #include <sys/ioctl.h>
 #include <fcntl.h>