示例#1
0
文件: gpio.py 项目: Hunter275/webiopi
 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
文件: gpio.py 项目: Hunter275/webiopi
 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
文件: gpio.py 项目: Hunter275/webiopi
 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
文件: gpio.py 项目: Hunter275/webiopi
 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)