Philip Howard | fa09d18 | 2013-04-01 21:11:00 +0000 | [diff] [blame^] | 1 | %pythoncode %{ |
| 2 | class nes(object): |
| 3 | def setupNesJoystick(self,*args): |
| 4 | return setupNesJoystick(*args) |
| 5 | def readNesJoystick(self,*args): |
| 6 | return readNesJoystick(*args) |
| 7 | |
| 8 | class Serial(object): |
| 9 | device = '/dev/ttyAMA0' |
| 10 | baud = 9600 |
| 11 | serial_id = 0 |
| 12 | def printf(self,*args): |
| 13 | return serialPrintf(self.serial_id,*args) |
| 14 | def dataAvail(self,*args): |
| 15 | return serialDataAvail(self.serial_id,*args) |
| 16 | def getchar(self,*args): |
| 17 | return serialGetchar(self.serial_id,*args) |
| 18 | def putchar(self,*args): |
| 19 | return serialPutchar(self.serial_id,*args) |
| 20 | def puts(self,*args): |
| 21 | return serialPuts(self.serial_id,*args) |
| 22 | def __init__(self,device,baud): |
| 23 | self.device = device |
| 24 | self.baud = baud |
| 25 | self.serial_id = serialOpen(self.device,self.baud) |
| 26 | def __del__(self): |
| 27 | serialClose(self.serial_id) |
| 28 | |
| 29 | class GPIO(object): |
| 30 | WPI_MODE_PINS = 0 |
| 31 | WPI_MODE_GPIO = 1 |
| 32 | WPI_MODE_GPIO_SYS = 2 |
| 33 | WPI_MODE_PHYS = 3 |
| 34 | WPI_MODE_PIFACE = 4 |
| 35 | WPI_MODE_UNINITIALISED = -1 |
| 36 | |
| 37 | INPUT = 0 |
| 38 | OUTPUT = 1 |
| 39 | PWM_OUTPUT = 2 |
| 40 | GPIO_CLOCK = 3 |
| 41 | |
| 42 | LOW = 0 |
| 43 | HIGH = 1 |
| 44 | |
| 45 | PUD_OFF = 0 |
| 46 | PUD_DOWN = 1 |
| 47 | PUD_UP = 2 |
| 48 | |
| 49 | PWM_MODE_MS = 0 |
| 50 | PWM_MODE_BAL = 1 |
| 51 | |
| 52 | INT_EDGE_SETUP = 0 |
| 53 | INT_EDGE_FALLING = 1 |
| 54 | INT_EDGE_RISING = 2 |
| 55 | INT_EDGE_BOTH = 3 |
| 56 | |
| 57 | LSBFIRST = 0 |
| 58 | MSBFIRST = 1 |
| 59 | |
| 60 | MODE = 0 |
| 61 | def __init__(self,pinmode=0): |
| 62 | self.MODE=pinmode |
| 63 | if pinmode==self.WPI_MODE_PINS: |
| 64 | wiringPiSetup() |
| 65 | if pinmode==self.WPI_MODE_GPIO: |
| 66 | wiringPiSetupGpio() |
| 67 | if pinmode==self.WPI_MODE_GPIO_SYS: |
| 68 | wiringPiSetupSys() |
| 69 | if pinmode==self.WPI_MODE_PHYS: |
| 70 | wiringPiSetupPhys() |
| 71 | if pinmode==self.WPI_MODE_PIFACE: |
| 72 | wiringPiSetupPiFace() |
| 73 | |
| 74 | def delay(self,*args): |
| 75 | delay(*args) |
| 76 | def delayMicroseconds(self,*args): |
| 77 | delayMicroseconds(*args) |
| 78 | def millis(self): |
| 79 | return millis() |
| 80 | def micros(self): |
| 81 | return micros() |
| 82 | |
| 83 | def piHiPri(self,*args): |
| 84 | return piHiPri(*args) |
| 85 | |
| 86 | def piBoardRev(self): |
| 87 | return piBoardRev() |
| 88 | def wpiPinToGpio(self,*args): |
| 89 | return wpiPinToGpio(*args) |
| 90 | def setPadDrive(self,*args): |
| 91 | return setPadDrive(*args) |
| 92 | def getAlt(self,*args): |
| 93 | return getAlt(*args) |
| 94 | def digitalWriteByte(self,*args): |
| 95 | return digitalWriteByte(*args) |
| 96 | |
| 97 | def pwmSetMode(self,*args): |
| 98 | pwmSetMode(*args) |
| 99 | def pwmSetRange(self,*args): |
| 100 | pwmSetRange(*args) |
| 101 | def pwmSetClock(self,*args): |
| 102 | pwmSetClock(*args) |
| 103 | def gpioClockSet(self,*args): |
| 104 | gpioClockSet(*args) |
| 105 | def pwmWrite(self,*args): |
| 106 | pwmWrite(*args) |
| 107 | |
| 108 | def pinMode(self,*args): |
| 109 | pinMode(*args) |
| 110 | |
| 111 | def digitalWrite(self,*args): |
| 112 | digitalWrite(*args) |
| 113 | def digitalRead(self,*args): |
| 114 | return digitalRead(*args) |
| 115 | def digitalWriteByte(self,*args): |
| 116 | digitalWriteByte(*args) |
| 117 | |
| 118 | def analogWrite(self,*args): |
| 119 | analogWrite(*args) |
| 120 | def analogRead(self,*args): |
| 121 | return analogRead(*args) |
| 122 | |
| 123 | def shiftOut(self,*args): |
| 124 | shiftOut(*args) |
| 125 | def shiftIn(self,*args): |
| 126 | return shiftIn(*args) |
| 127 | |
| 128 | def pullUpDnControl(self,*args): |
| 129 | return pullUpDnControl(*args) |
| 130 | |
| 131 | def waitForInterrupt(self,*args): |
| 132 | return waitForInterrupt(*args) |
| 133 | def wiringPiISR(self,*args): |
| 134 | return wiringPiISR(*args) |
| 135 | |
| 136 | def softPwmCreate(self,*args): |
| 137 | return softPwmCreate(*args) |
| 138 | def softPwmWrite(self,*args): |
| 139 | return sofPwmWrite(*args) |
| 140 | |
| 141 | def softToneCreate(self,*args): |
| 142 | return softToneCreate(*args) |
| 143 | def softToneWrite(self,*args): |
| 144 | return softToneWrite(*args) |
| 145 | |
| 146 | def lcdHome(self,*args): |
| 147 | return lcdHome(self,*args) |
| 148 | def lcdCLear(self,*args): |
| 149 | return lcdClear(self,*args) |
| 150 | def lcdSendCommand(self,*args): |
| 151 | return lcdSendCommand(self,*args) |
| 152 | def lcdPosition(self,*args): |
| 153 | return lcdPosition(self,*args) |
| 154 | def lcdPutchar(self,*args): |
| 155 | return lcdPutchar(self,*args) |
| 156 | def lcdPuts(self,*args): |
| 157 | return lcdPuts(self,*args) |
| 158 | def lcdPrintf(self,*args): |
| 159 | return lcdPrintf(self,*args) |
| 160 | def lcdInit(self,*args): |
| 161 | return lcdInit(self,*args) |
| 162 | %} |