Пример #1
0
 def setup(self):
     for g in self.gpio_setup:
         gpio = g["gpio"]
         debug("Setup GPIO %d" % gpio)
         GPIO.setFunction(gpio, g["func"])
         if g["value"] >= 0 and GPIO.getFunction(gpio) == GPIO.OUT:
             GPIO.digitalWrite(gpio, g["value"])
Пример #2
0
 def close(self):
     for g in self.gpio_reset:
         gpio = g["gpio"]
         debug("Reset GPIO %d" % gpio)
         GPIO.setFunction(gpio, g["func"])
         if g["value"] >= 0 and GPIO.getFunction(gpio) == GPIO.OUT:
             GPIO.digitalWrite(gpio, g["value"])
Пример #3
0
 def __portWrite__(self, value):
     if len(self.export) < 54:
         for i in self.export:
             if GPIO.getFunction(i) == GPIO.OUT:
                 GPIO.digitalWrite(i, (value >> i) & 1)
     else:
         raise Exception("Please limit exported GPIO to write integers")
Пример #4
0
 def close(self):
     for g in self.gpio_reset:
         gpio = g["gpio"]
         debug("Reset GPIO %d" % gpio)
         GPIO.setFunction(gpio, g["func"])
         if g["value"] >= 0 and GPIO.getFunction(gpio) == GPIO.OUT:
             GPIO.digitalWrite(gpio, g["value"])
Пример #5
0
 def setup(self):
     for g in self.gpio_setup:
         gpio = g["gpio"]
         debug("Setup GPIO %d" % gpio)
         GPIO.setFunction(gpio, g["func"])
         if g["value"] >= 0 and GPIO.getFunction(gpio) == GPIO.OUT:
             GPIO.digitalWrite(gpio, g["value"])
Пример #6
0
 def __portWrite__(self, value):
     if len(self.export) < 54:
         for i in self.export:
             if GPIO.getFunction(i) == GPIO.OUT:
                 GPIO.digitalWrite(i, (value >> i) & 1)
     else:
         raise Exception("Please limit exported GPIO to write integers")
Пример #7
0
 def __digitalWrite__(self, channel, value):
     self.checkDigitalChannelExported(channel)
     self.checkPostingValueAllowed()
     GPIO.digitalWrite(channel, value)
Пример #8
0
 def __digitalWrite__(self, channel, value):
     self.checkDigitalChannelExported(channel)
     self.checkPostingValueAllowed()
     GPIO.digitalWrite(channel, value)