added test feature and credentials
This commit is contained in:
46
dummygpio.py
Normal file
46
dummygpio.py
Normal file
@@ -0,0 +1,46 @@
|
||||
import time
|
||||
|
||||
HIGH = True
|
||||
LOW = False
|
||||
IN = 0
|
||||
PUD_UP = None
|
||||
DUMMY_FALLING_EDGE = "FALLING"
|
||||
CHANGE_PIN_VALUE_AFTER = 8 # Transition to HIGH after 5 seconds
|
||||
BCM = 0
|
||||
FALLING = None
|
||||
pull_up_down = {PUD_UP: DUMMY_FALLING_EDGE}
|
||||
state = HIGH
|
||||
pin_last_change = {}
|
||||
|
||||
|
||||
def setwarnings(value):
|
||||
pass
|
||||
|
||||
|
||||
def setmode(mode):
|
||||
pass
|
||||
|
||||
|
||||
def cleanup():
|
||||
pass
|
||||
|
||||
|
||||
def setup(pin, direction, **kwargs):
|
||||
pin_last_change[pin] = time.time()
|
||||
|
||||
|
||||
def input(pin):
|
||||
last_change = pin_last_change.get(pin, 0)
|
||||
current = time.time()
|
||||
|
||||
if current - last_change >= CHANGE_PIN_VALUE_AFTER:
|
||||
pin_last_change[pin] = current
|
||||
return HIGH
|
||||
|
||||
return LOW
|
||||
|
||||
|
||||
def add_event_detect(pin, edge, callback, **kwargs):
|
||||
pin_last_change[pin] = time.time()
|
||||
if edge == FALLING:
|
||||
callback(pin)
|
||||
Reference in New Issue
Block a user