mirror of
git://soft.sys114.com/WiringPi2-Python
synced 2026-02-04 15:30:35 +09:00
Various fixes
This commit is contained in:
@@ -6,3 +6,6 @@ v1.0.4 -- Added class wrapper, plus analogRead/Write functions
|
||||
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
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
graft WiringPi/wiringPi
|
||||
include *.txt
|
||||
include *.rst
|
||||
|
||||
4
setup.py
4
setup.py
@@ -31,14 +31,14 @@ _wiringpi2 = Extension(
|
||||
|
||||
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=[],
|
||||
|
||||
@@ -105,6 +105,9 @@ int wiringPiSPISetup (int channel, int speed) ;
|
||||
|
||||
// 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) ;
|
||||
|
||||
@@ -26,6 +26,24 @@ class Serial(object):
|
||||
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
|
||||
|
||||
26
wiringpi2.py
26
wiringpi2.py
@@ -240,6 +240,14 @@ def wiringPiSPISetup(*args):
|
||||
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 @@ class Serial(object):
|
||||
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
|
||||
|
||||
BIN
wiringpi2.pyc
BIN
wiringpi2.pyc
Binary file not shown.
@@ -4418,6 +4418,62 @@ fail:
|
||||
}
|
||||
|
||||
|
||||
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 @@ static PyMethodDef SwigMethods[] = {
|
||||
{ (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},
|
||||
|
||||
Reference in New Issue
Block a user