Fixed Schauzeichen implementation

This commit is contained in:
klonfish 2015-05-18 14:52:20 +02:00
parent 61d109d9d2
commit 9eeae13691

View file

@ -4,7 +4,7 @@ import time
import threading import threading
class TelefonapparatPinConfiguration(object): class FeApPinConfiguration(object):
def __init__(self): def __init__(self):
self.pin_nsa = 11 self.pin_nsa = 11
self.pin_nsi = 13 self.pin_nsi = 13
@ -14,7 +14,7 @@ class TelefonapparatPinConfiguration(object):
self.pin_wecker_a = 18 self.pin_wecker_a = 18
self.pin_wecker_b = 19 self.pin_wecker_b = 19
class TelefonapparatUserInterface(object): class FeApUserInterface(object):
def __init__(self, pinconfig): def __init__(self, pinconfig):
self.__pinconfig = pinconfig self.__pinconfig = pinconfig
@ -92,34 +92,34 @@ class TelefonapparatUserInterface(object):
self.__weckt = False self.__weckt = False
def set_schauzeichen(self, enabled): def set_schauzeichen(self, enabled):
gpio.output(self.__pinconfig.pin_wecker_a, 1 if enabled else 0) gpio.output(self.__pinconfig.pin_schauzeichen, 1 if enabled else 0)
if __name__ == '__main__': if __name__ == '__main__':
gpio.setmode(gpio.BOARD) gpio.setmode(gpio.BOARD)
pinconfig = TelefonapparatPinConfiguration() pinconfig = FeApPinConfiguration()
t = TelefonapparatUserInterface(pinconfig) t = FeApUserInterface(pinconfig)
def dailed(num): def dailed(num):
print num print num
t.add_nummernschalter_callback(dailed) t.add_nummernschalter_callback(dailed)
t.set_schauzeichen(true) t.set_schauzeichen(True)
time.sleep(0.5) time.sleep(0.5)
t.set_schauzeichen(false) t.set_schauzeichen(False)
time.sleep(0.5) time.sleep(0.5)
t.set_schauzeichen(true) t.set_schauzeichen(True)
time.sleep(0.5) time.sleep(0.5)
t.set_schauzeichen(false) t.set_schauzeichen(False)
time.sleep(0.5) time.sleep(0.5)
t.set_schauzeichen(true) t.set_schauzeichen(True)
time.sleep(0.5) time.sleep(0.5)
t.set_schauzeichen(false) t.set_schauzeichen(False)
time.sleep(0.5) time.sleep(0.5)
t.set_schauzeichen(true) t.set_schauzeichen(True)
time.sleep(0.5) time.sleep(0.5)
t.set_schauzeichen(false) t.set_schauzeichen(False)
time.sleep(0.5) time.sleep(0.5)
t.set_wecker(True) t.set_wecker(True)
time.sleep(20) time.sleep(20)