|
|
@ -7,7 +7,7 @@ import threading |
|
|
|
class FeApPinConfiguration(object): |
|
|
|
class FeApPinConfiguration(object): |
|
|
|
def __init__(self, gpio_numbering, pin_nsa, pin_nsi, pin_gabelschalter, |
|
|
|
def __init__(self, gpio_numbering, pin_nsa, pin_nsi, pin_gabelschalter, |
|
|
|
pin_schauzeichen, pin_wecker_enable, pin_wecker_a, |
|
|
|
pin_schauzeichen, pin_wecker_enable, pin_wecker_a, |
|
|
|
pin_wecker_b): |
|
|
|
pin_wecker_b, invert_gs): |
|
|
|
if gpio_numbering == 'BOARD': |
|
|
|
if gpio_numbering == 'BOARD': |
|
|
|
gpio_numbering = gpio.BOARD |
|
|
|
gpio_numbering = gpio.BOARD |
|
|
|
elif gpio_numbering == 'BCM': |
|
|
|
elif gpio_numbering == 'BCM': |
|
|
@ -23,6 +23,7 @@ class FeApPinConfiguration(object): |
|
|
|
self.pin_wecker_enable = pin_wecker_enable |
|
|
|
self.pin_wecker_enable = pin_wecker_enable |
|
|
|
self.pin_wecker_a = pin_wecker_a |
|
|
|
self.pin_wecker_a = pin_wecker_a |
|
|
|
self.pin_wecker_b = pin_wecker_b |
|
|
|
self.pin_wecker_b = pin_wecker_b |
|
|
|
|
|
|
|
self.invert_gs = invert_gs |
|
|
|
|
|
|
|
|
|
|
|
class FeApUserInterface(object): |
|
|
|
class FeApUserInterface(object): |
|
|
|
def __init__(self, pinconfig): |
|
|
|
def __init__(self, pinconfig): |
|
|
@ -69,6 +70,8 @@ class FeApUserInterface(object): |
|
|
|
|
|
|
|
|
|
|
|
def __on_gabelschalter_change(self, pin): |
|
|
|
def __on_gabelschalter_change(self, pin): |
|
|
|
gbstate = gpio.input(self.__pinconfig.pin_gabelschalter) |
|
|
|
gbstate = gpio.input(self.__pinconfig.pin_gabelschalter) |
|
|
|
|
|
|
|
if self.__pinconfig.invert_gs: |
|
|
|
|
|
|
|
gbstate = 1 - gbstate |
|
|
|
print 'gabelschalter:', gbstate |
|
|
|
print 'gabelschalter:', gbstate |
|
|
|
for cb in self.__gabelschalter_callbacks: |
|
|
|
for cb in self.__gabelschalter_callbacks: |
|
|
|
cb(gbstate) |
|
|
|
cb(gbstate) |
|
|
|