Example #1
0
 def gpioConfig(self, set_array = [], mask_array = []):
     code, string = libsub.sub_gpio_config(self.device, self._binary2int(set_array), self._binary2int(mask_array))
     print self._binary2int(set_array)
     print self._binary2int(mask_array)
     if code > 0:
         raise DeviceException(self.getError())
     return string
Example #2
0
 def gpioDirection(self, pin, val):
     pin_ = self._getPin(pin)
     set = mask = self.gpioMask()
     mask[pin_-1] = 1
     set[pin_-1] = val
     code, port = libsub.sub_gpio_config(self.device, self._binary2int(set), self._binary2int(mask))
     self.gpioPort = self._hex2binary(port)
Example #3
0
 def __init__(self, dev = 0, pinNames = 0):
     res = libsub.sub_find_devices(dev)
     if res == 0:
         raise DeviceException(self.getError())
     
     self.device = libsub.sub_open(res)
     if self.device == 0:
         raise DeviceException(self.getError())
     
     code, port = libsub.sub_gpio_config(self.device, 0, 0)
     self.gpioPort = self._hex2binary(port)
     self.pinNames = pinNames
     self.pinArray = [17, 18, 19, 20, 21, 22, 23, 24, 1, 2, 3, 4, 5, 6, 7, 8, 32, 31, 30, 29, 28, 27, 26, 25, 9, 10, 11, 12, 13, 14, 15, 16]
     self.fpwmStatus = 0
     
     return res