mirror of
git://soft.sys114.com/WiringPi2-Python
synced 2026-02-09 20:14:22 +09:00
Various bug fixes
This commit is contained in:
263
wiringpi2.py
263
wiringpi2.py
@@ -80,10 +80,42 @@ def wiringPiSetupGpio():
|
||||
return _wiringpi2.wiringPiSetupGpio()
|
||||
wiringPiSetupGpio = _wiringpi2.wiringPiSetupGpio
|
||||
|
||||
def wiringPiSetupPhys():
|
||||
return _wiringpi2.wiringPiSetupPhys()
|
||||
wiringPiSetupPhys = _wiringpi2.wiringPiSetupPhys
|
||||
|
||||
def piFaceSetup(*args):
|
||||
return _wiringpi2.piFaceSetup(*args)
|
||||
piFaceSetup = _wiringpi2.piFaceSetup
|
||||
|
||||
def pinMode(*args):
|
||||
return _wiringpi2.pinMode(*args)
|
||||
pinMode = _wiringpi2.pinMode
|
||||
|
||||
def pullUpDnControl(*args):
|
||||
return _wiringpi2.pullUpDnControl(*args)
|
||||
pullUpDnControl = _wiringpi2.pullUpDnControl
|
||||
|
||||
def digitalRead(*args):
|
||||
return _wiringpi2.digitalRead(*args)
|
||||
digitalRead = _wiringpi2.digitalRead
|
||||
|
||||
def digitalWrite(*args):
|
||||
return _wiringpi2.digitalWrite(*args)
|
||||
digitalWrite = _wiringpi2.digitalWrite
|
||||
|
||||
def pwmWrite(*args):
|
||||
return _wiringpi2.pwmWrite(*args)
|
||||
pwmWrite = _wiringpi2.pwmWrite
|
||||
|
||||
def analogRead(*args):
|
||||
return _wiringpi2.analogRead(*args)
|
||||
analogRead = _wiringpi2.analogRead
|
||||
|
||||
def analogWrite(*args):
|
||||
return _wiringpi2.analogWrite(*args)
|
||||
analogWrite = _wiringpi2.analogWrite
|
||||
|
||||
def piBoardRev():
|
||||
return _wiringpi2.piBoardRev()
|
||||
piBoardRev = _wiringpi2.piBoardRev
|
||||
@@ -92,42 +124,18 @@ def wpiPinToGpio(*args):
|
||||
return _wiringpi2.wpiPinToGpio(*args)
|
||||
wpiPinToGpio = _wiringpi2.wpiPinToGpio
|
||||
|
||||
def pinMode(*args):
|
||||
return _wiringpi2.pinMode(*args)
|
||||
pinMode = _wiringpi2.pinMode
|
||||
def setPadDrive(*args):
|
||||
return _wiringpi2.setPadDrive(*args)
|
||||
setPadDrive = _wiringpi2.setPadDrive
|
||||
|
||||
def getAlt(*args):
|
||||
return _wiringpi2.getAlt(*args)
|
||||
getAlt = _wiringpi2.getAlt
|
||||
|
||||
def pullUpDnControl(*args):
|
||||
return _wiringpi2.pullUpDnControl(*args)
|
||||
pullUpDnControl = _wiringpi2.pullUpDnControl
|
||||
|
||||
def digitalWrite(*args):
|
||||
return _wiringpi2.digitalWrite(*args)
|
||||
digitalWrite = _wiringpi2.digitalWrite
|
||||
|
||||
def digitalWriteByte(*args):
|
||||
return _wiringpi2.digitalWriteByte(*args)
|
||||
digitalWriteByte = _wiringpi2.digitalWriteByte
|
||||
|
||||
def gpioClockSet(*args):
|
||||
return _wiringpi2.gpioClockSet(*args)
|
||||
gpioClockSet = _wiringpi2.gpioClockSet
|
||||
|
||||
def pwmWrite(*args):
|
||||
return _wiringpi2.pwmWrite(*args)
|
||||
pwmWrite = _wiringpi2.pwmWrite
|
||||
|
||||
def setPadDrive(*args):
|
||||
return _wiringpi2.setPadDrive(*args)
|
||||
setPadDrive = _wiringpi2.setPadDrive
|
||||
|
||||
def digitalRead(*args):
|
||||
return _wiringpi2.digitalRead(*args)
|
||||
digitalRead = _wiringpi2.digitalRead
|
||||
|
||||
def pwmSetMode(*args):
|
||||
return _wiringpi2.pwmSetMode(*args)
|
||||
pwmSetMode = _wiringpi2.pwmSetMode
|
||||
@@ -140,6 +148,10 @@ def pwmSetClock(*args):
|
||||
return _wiringpi2.pwmSetClock(*args)
|
||||
pwmSetClock = _wiringpi2.pwmSetClock
|
||||
|
||||
def gpioClockSet(*args):
|
||||
return _wiringpi2.gpioClockSet(*args)
|
||||
gpioClockSet = _wiringpi2.gpioClockSet
|
||||
|
||||
def wiringPiISR(*args):
|
||||
return _wiringpi2.wiringPiISR(*args)
|
||||
wiringPiISR = _wiringpi2.wiringPiISR
|
||||
@@ -156,6 +168,10 @@ def piUnlock(*args):
|
||||
return _wiringpi2.piUnlock(*args)
|
||||
piUnlock = _wiringpi2.piUnlock
|
||||
|
||||
def piHiPri(*args):
|
||||
return _wiringpi2.piHiPri(*args)
|
||||
piHiPri = _wiringpi2.piHiPri
|
||||
|
||||
def delay(*args):
|
||||
return _wiringpi2.delay(*args)
|
||||
delay = _wiringpi2.delay
|
||||
@@ -291,6 +307,199 @@ mcp23008Setup = _wiringpi2.mcp23008Setup
|
||||
def sr595Setup(*args):
|
||||
return _wiringpi2.sr595Setup(*args)
|
||||
sr595Setup = _wiringpi2.sr595Setup
|
||||
|
||||
def lcdHome(*args):
|
||||
return _wiringpi2.lcdHome(*args)
|
||||
lcdHome = _wiringpi2.lcdHome
|
||||
|
||||
def lcdClear(*args):
|
||||
return _wiringpi2.lcdClear(*args)
|
||||
lcdClear = _wiringpi2.lcdClear
|
||||
|
||||
def lcdSendCommand(*args):
|
||||
return _wiringpi2.lcdSendCommand(*args)
|
||||
lcdSendCommand = _wiringpi2.lcdSendCommand
|
||||
|
||||
def lcdPosition(*args):
|
||||
return _wiringpi2.lcdPosition(*args)
|
||||
lcdPosition = _wiringpi2.lcdPosition
|
||||
|
||||
def lcdPutchar(*args):
|
||||
return _wiringpi2.lcdPutchar(*args)
|
||||
lcdPutchar = _wiringpi2.lcdPutchar
|
||||
|
||||
def lcdPuts(*args):
|
||||
return _wiringpi2.lcdPuts(*args)
|
||||
lcdPuts = _wiringpi2.lcdPuts
|
||||
|
||||
def lcdPrintf(*args):
|
||||
return _wiringpi2.lcdPrintf(*args)
|
||||
lcdPrintf = _wiringpi2.lcdPrintf
|
||||
|
||||
def lcdInit(*args):
|
||||
return _wiringpi2.lcdInit(*args)
|
||||
lcdInit = _wiringpi2.lcdInit
|
||||
class nes(object):
|
||||
def setupNesJoystick(self,*args):
|
||||
return setupNesJoystick(*args)
|
||||
def readNesJoystick(self,*args):
|
||||
return readNesJoystick(*args)
|
||||
|
||||
class Serial(object):
|
||||
device = '/dev/ttyAMA0'
|
||||
baud = 9600
|
||||
serial_id = 0
|
||||
def printf(self,*args):
|
||||
return serialPrintf(self.serial_id,*args)
|
||||
def dataAvail(self,*args):
|
||||
return serialDataAvail(self.serial_id,*args)
|
||||
def getchar(self,*args):
|
||||
return serialGetchar(self.serial_id,*args)
|
||||
def putchar(self,*args):
|
||||
return serialPutchar(self.serial_id,*args)
|
||||
def puts(self,*args):
|
||||
return serialPuts(self.serial_id,*args)
|
||||
def __init__(self,device,baud):
|
||||
self.device = device
|
||||
self.baud = baud
|
||||
self.serial_id = serialOpen(self.device,self.baud)
|
||||
def __del__(self):
|
||||
serialClose(self.serial_id)
|
||||
|
||||
class GPIO(object):
|
||||
WPI_MODE_PINS = 0
|
||||
WPI_MODE_GPIO = 1
|
||||
WPI_MODE_GPIO_SYS = 2
|
||||
WPI_MODE_PHYS = 3
|
||||
WPI_MODE_PIFACE = 4
|
||||
WPI_MODE_UNINITIALISED = -1
|
||||
|
||||
INPUT = 0
|
||||
OUTPUT = 1
|
||||
PWM_OUTPUT = 2
|
||||
GPIO_CLOCK = 3
|
||||
|
||||
LOW = 0
|
||||
HIGH = 1
|
||||
|
||||
PUD_OFF = 0
|
||||
PUD_DOWN = 1
|
||||
PUD_UP = 2
|
||||
|
||||
PWM_MODE_MS = 0
|
||||
PWM_MODE_BAL = 1
|
||||
|
||||
INT_EDGE_SETUP = 0
|
||||
INT_EDGE_FALLING = 1
|
||||
INT_EDGE_RISING = 2
|
||||
INT_EDGE_BOTH = 3
|
||||
|
||||
LSBFIRST = 0
|
||||
MSBFIRST = 1
|
||||
|
||||
MODE = 0
|
||||
def __init__(self,pinmode=0):
|
||||
self.MODE=pinmode
|
||||
if pinmode==self.WPI_MODE_PINS:
|
||||
wiringPiSetup()
|
||||
if pinmode==self.WPI_MODE_GPIO:
|
||||
wiringPiSetupGpio()
|
||||
if pinmode==self.WPI_MODE_GPIO_SYS:
|
||||
wiringPiSetupSys()
|
||||
if pinmode==self.WPI_MODE_PHYS:
|
||||
wiringPiSetupPhys()
|
||||
if pinmode==self.WPI_MODE_PIFACE:
|
||||
wiringPiSetupPiFace()
|
||||
|
||||
def delay(self,*args):
|
||||
delay(*args)
|
||||
def delayMicroseconds(self,*args):
|
||||
delayMicroseconds(*args)
|
||||
def millis(self):
|
||||
return millis()
|
||||
def micros(self):
|
||||
return micros()
|
||||
|
||||
def piHiPri(self,*args):
|
||||
return piHiPri(*args)
|
||||
|
||||
def piBoardRev(self):
|
||||
return piBoardRev()
|
||||
def wpiPinToGpio(self,*args):
|
||||
return wpiPinToGpio(*args)
|
||||
def setPadDrive(self,*args):
|
||||
return setPadDrive(*args)
|
||||
def getAlt(self,*args):
|
||||
return getAlt(*args)
|
||||
def digitalWriteByte(self,*args):
|
||||
return digitalWriteByte(*args)
|
||||
|
||||
def pwmSetMode(self,*args):
|
||||
pwmSetMode(*args)
|
||||
def pwmSetRange(self,*args):
|
||||
pwmSetRange(*args)
|
||||
def pwmSetClock(self,*args):
|
||||
pwmSetClock(*args)
|
||||
def gpioClockSet(self,*args):
|
||||
gpioClockSet(*args)
|
||||
def pwmWrite(self,*args):
|
||||
pwmWrite(*args)
|
||||
|
||||
def pinMode(self,*args):
|
||||
pinMode(*args)
|
||||
|
||||
def digitalWrite(self,*args):
|
||||
digitalWrite(*args)
|
||||
def digitalRead(self,*args):
|
||||
return digitalRead(*args)
|
||||
def digitalWriteByte(self,*args):
|
||||
digitalWriteByte(*args)
|
||||
|
||||
def analogWrite(self,*args):
|
||||
analogWrite(*args)
|
||||
def analogRead(self,*args):
|
||||
return analogRead(*args)
|
||||
|
||||
def shiftOut(self,*args):
|
||||
shiftOut(*args)
|
||||
def shiftIn(self,*args):
|
||||
return shiftIn(*args)
|
||||
|
||||
def pullUpDnControl(self,*args):
|
||||
return pullUpDnControl(*args)
|
||||
|
||||
def waitForInterrupt(self,*args):
|
||||
return waitForInterrupt(*args)
|
||||
def wiringPiISR(self,*args):
|
||||
return wiringPiISR(*args)
|
||||
|
||||
def softPwmCreate(self,*args):
|
||||
return softPwmCreate(*args)
|
||||
def softPwmWrite(self,*args):
|
||||
return sofPwmWrite(*args)
|
||||
|
||||
def softToneCreate(self,*args):
|
||||
return softToneCreate(*args)
|
||||
def softToneWrite(self,*args):
|
||||
return softToneWrite(*args)
|
||||
|
||||
def lcdHome(self,*args):
|
||||
return lcdHome(self,*args)
|
||||
def lcdCLear(self,*args):
|
||||
return lcdClear(self,*args)
|
||||
def lcdSendCommand(self,*args):
|
||||
return lcdSendCommand(self,*args)
|
||||
def lcdPosition(self,*args):
|
||||
return lcdPosition(self,*args)
|
||||
def lcdPutchar(self,*args):
|
||||
return lcdPutchar(self,*args)
|
||||
def lcdPuts(self,*args):
|
||||
return lcdPuts(self,*args)
|
||||
def lcdPrintf(self,*args):
|
||||
return lcdPrintf(self,*args)
|
||||
def lcdInit(self,*args):
|
||||
return lcdInit(self,*args)
|
||||
|
||||
# This file is compatible with both classic and new-style classes.
|
||||
|
||||
cvar = _wiringpi2.cvar
|
||||
|
||||
Reference in New Issue
Block a user