Various fixes
diff --git a/CHANGES.txt b/CHANGES.txt
index c504481..dc341cf 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -6,3 +6,6 @@
v1.0.5 -- Second attempt at pretty Pypi page
v1.0.6 -- Fixed spelling error in softToneCreate - Thanks oevsegneev
v1.0.7 -- Added LCD functionality
+v1.0.8 -- Updated manifest to include .rst and fix build error
+v1.0.9 -- Erroneous non-fix due to stupidity
+v1.0.10 -- Added I2CSetup and new I2C class
diff --git a/MANIFEST.in b/MANIFEST.in
index 4d941f2..dd99154 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,2 +1,3 @@
graft WiringPi/wiringPi
include *.txt
+include *.rst
diff --git a/setup.py b/setup.py
index ff987a4..338eb2e 100644
--- a/setup.py
+++ b/setup.py
@@ -31,14 +31,14 @@
setup(
name = 'wiringpi2',
- version = '1.0.7',
+ version = '1.0.10',
author = "Philip Howard",
author_email = "phil@gadgetoid.com",
url = 'https://github.com/Gadgetoid/WiringPi2-Python/',
description = """A python interface to WiringPi 2.0 library which allows for
easily interfacing with the GPIO pins of the Raspberry Pi. Also supports
i2c and SPI""",
- long_description=open('README.rst','rt').read(),
+ long_description=open('README').read(),
ext_modules = [ _wiringpi2 ],
py_modules = ["wiringpi2"],
install_requires=[],
diff --git a/wiringpi.i b/wiringpi.i
index 1538c38..a38d5a0 100644
--- a/wiringpi.i
+++ b/wiringpi.i
@@ -105,6 +105,9 @@
// i2c
+extern int wiringPiI2CSetupInterface (char *device, int devId) ;
+extern int wiringPiI2CSetup (int devId) ;
+
extern int wiringPiI2CRead (int fd) ;
extern int wiringPiI2CReadReg8 (int fd, int reg) ;
extern int wiringPiI2CReadReg16 (int fd, int reg) ;
diff --git a/wiringpi2-class.py b/wiringpi2-class.py
index 822c18c..beeb811 100644
--- a/wiringpi2-class.py
+++ b/wiringpi2-class.py
@@ -26,6 +26,24 @@
def __del__(self):
serialClose(self.serial_id)
+class I2C(object):
+ def setupInterface(self,*args):
+ return wiringPiI2CSetupInterface(*args)
+ def setup(self,*args):
+ return wiringPiI2CSetup(*args)
+ def read(self,*args):
+ return wiringPiI2CRead(*args)
+ def readReg8(self,*args):
+ return wiringPiI2CRead(*args)
+ def readReg16(self,*args):
+ return wiringPiI2CReadReg16(*args)
+ def write(self,*args):
+ return wiringPiI2CWrite(*args)
+ def writeReg8(self,*args):
+ return wiringPiI2CWriteReg8(*args)
+ def writeReg16(self,*args):
+ return wiringPiI2CWriteReg16(*args)
+
class GPIO(object):
WPI_MODE_PINS = 0
WPI_MODE_GPIO = 1
diff --git a/wiringpi2.py b/wiringpi2.py
index 2dad3e1..2940572 100644
--- a/wiringpi2.py
+++ b/wiringpi2.py
@@ -240,6 +240,14 @@
return _wiringpi2.wiringPiSPISetup(*args)
wiringPiSPISetup = _wiringpi2.wiringPiSPISetup
+def wiringPiI2CSetupInterface(*args):
+ return _wiringpi2.wiringPiI2CSetupInterface(*args)
+wiringPiI2CSetupInterface = _wiringpi2.wiringPiI2CSetupInterface
+
+def wiringPiI2CSetup(*args):
+ return _wiringpi2.wiringPiI2CSetup(*args)
+wiringPiI2CSetup = _wiringpi2.wiringPiI2CSetup
+
def wiringPiI2CRead(*args):
return _wiringpi2.wiringPiI2CRead(*args)
wiringPiI2CRead = _wiringpi2.wiringPiI2CRead
@@ -366,6 +374,24 @@
def __del__(self):
serialClose(self.serial_id)
+class I2C(object):
+ def setupInterface(self,*args):
+ return wiringPiI2CSetupInterface(*args)
+ def setup(self,*args):
+ return wiringPiI2CSetup(*args)
+ def read(self,*args):
+ return wiringPiI2CRead(*args)
+ def readReg8(self,*args):
+ return wiringPiI2CRead(*args)
+ def readReg16(self,*args):
+ return wiringPiI2CReadReg16(*args)
+ def write(self,*args):
+ return wiringPiI2CWrite(*args)
+ def writeReg8(self,*args):
+ return wiringPiI2CWriteReg8(*args)
+ def writeReg16(self,*args):
+ return wiringPiI2CWriteReg16(*args)
+
class GPIO(object):
WPI_MODE_PINS = 0
WPI_MODE_GPIO = 1
diff --git a/wiringpi2.pyc b/wiringpi2.pyc
index 6f3ae5c..cbde93d 100644
--- a/wiringpi2.pyc
+++ b/wiringpi2.pyc
Binary files differ
diff --git a/wiringpi_wrap.c b/wiringpi_wrap.c
index 063f987..9b23aa6 100644
--- a/wiringpi_wrap.c
+++ b/wiringpi_wrap.c
@@ -4418,6 +4418,62 @@
}
+SWIGINTERN PyObject *_wrap_wiringPiI2CSetupInterface(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ char *arg1 = (char *) 0 ;
+ int arg2 ;
+ int res1 ;
+ char *buf1 = 0 ;
+ int alloc1 = 0 ;
+ int val2 ;
+ int ecode2 = 0 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+ int result;
+
+ if (!PyArg_ParseTuple(args,(char *)"OO:wiringPiI2CSetupInterface",&obj0,&obj1)) SWIG_fail;
+ res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "wiringPiI2CSetupInterface" "', argument " "1"" of type '" "char *""'");
+ }
+ arg1 = (char *)(buf1);
+ ecode2 = SWIG_AsVal_int(obj1, &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "wiringPiI2CSetupInterface" "', argument " "2"" of type '" "int""'");
+ }
+ arg2 = (int)(val2);
+ result = (int)wiringPiI2CSetupInterface(arg1,arg2);
+ resultobj = SWIG_From_int((int)(result));
+ if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+ return resultobj;
+fail:
+ if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_wiringPiI2CSetup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ int arg1 ;
+ int val1 ;
+ int ecode1 = 0 ;
+ PyObject * obj0 = 0 ;
+ int result;
+
+ if (!PyArg_ParseTuple(args,(char *)"O:wiringPiI2CSetup",&obj0)) SWIG_fail;
+ ecode1 = SWIG_AsVal_int(obj0, &val1);
+ if (!SWIG_IsOK(ecode1)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "wiringPiI2CSetup" "', argument " "1"" of type '" "int""'");
+ }
+ arg1 = (int)(val1);
+ result = (int)wiringPiI2CSetup(arg1);
+ resultobj = SWIG_From_int((int)(result));
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
SWIGINTERN PyObject *_wrap_wiringPiI2CRead(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
int arg1 ;
@@ -5447,6 +5503,8 @@
{ (char *)"wiringPiSPIGetFd", _wrap_wiringPiSPIGetFd, METH_VARARGS, NULL},
{ (char *)"wiringPiSPIDataRW", _wrap_wiringPiSPIDataRW, METH_VARARGS, NULL},
{ (char *)"wiringPiSPISetup", _wrap_wiringPiSPISetup, METH_VARARGS, NULL},
+ { (char *)"wiringPiI2CSetupInterface", _wrap_wiringPiI2CSetupInterface, METH_VARARGS, NULL},
+ { (char *)"wiringPiI2CSetup", _wrap_wiringPiI2CSetup, METH_VARARGS, NULL},
{ (char *)"wiringPiI2CRead", _wrap_wiringPiI2CRead, METH_VARARGS, NULL},
{ (char *)"wiringPiI2CReadReg8", _wrap_wiringPiI2CReadReg8, METH_VARARGS, NULL},
{ (char *)"wiringPiI2CReadReg16", _wrap_wiringPiI2CReadReg16, METH_VARARGS, NULL},