Skip to content

Commit d9926c4

Browse files
committed
examples/sysfsgpio: add active_low attribute to examples
Signed-off-by: Perry Melange <[email protected]>
1 parent 3f5a41b commit d9926c4

File tree

3 files changed

+54
-1
lines changed

3 files changed

+54
-1
lines changed

examples/sysfsgpio/export-gpio.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
desk:
22
GpioDigitalOutputDriver:
33
index: 60
4+
active_low: False

examples/sysfsgpio/sysfsgpio.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
StepLogger.start()
1414

1515
t = Target("main")
16-
r = SysfsGPIO(t, name=None, index=60)
16+
r = SysfsGPIO(t, name=None, index=60, active_low=True)
1717
d = GpioDigitalOutputDriver(t, name=None)
1818

1919
p = t.get_driver("DigitalOutputProtocol")
2020
print(t.resources)
21+
print("Testing IO")
2122
p.set(True)
2223
print(p.get())
2324
time.sleep(2)
@@ -26,3 +27,28 @@
2627
time.sleep(2)
2728
p.set(True)
2829
print(p.get())
30+
31+
print("Testing Power")
32+
p.off()
33+
print(p.get())
34+
time.sleep(2)
35+
p.on()
36+
print(p.get())
37+
time.sleep(2)
38+
p.cycle()
39+
print(p.get())
40+
time.sleep(2)
41+
42+
print("Testing Button")
43+
p.release()
44+
print(p.get())
45+
time.sleep(2)
46+
p.press()
47+
print(p.get())
48+
time.sleep(2)
49+
p.toggle()
50+
print(p.get())
51+
time.sleep(2)
52+
p.toggle_for()
53+
print(p.get())
54+

examples/sysfsgpio/sysfsgpio_remote.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
p = t.get_driver("DigitalOutputProtocol")
1717
print(t.resources)
18+
print("Testing IO")
1819
p.set(True)
1920
print(p.get())
2021
time.sleep(2)
@@ -23,3 +24,28 @@
2324
time.sleep(2)
2425
p.set(True)
2526
print(p.get())
27+
28+
print("Testing Power")
29+
p.off()
30+
print(p.get())
31+
time.sleep(2)
32+
p.on()
33+
print(p.get())
34+
time.sleep(2)
35+
p.cycle()
36+
print(p.get())
37+
time.sleep(2)
38+
39+
print("Testing Button")
40+
p.release()
41+
print(p.get())
42+
time.sleep(2)
43+
p.press()
44+
print(p.get())
45+
time.sleep(2)
46+
p.toggle()
47+
print(p.get())
48+
time.sleep(2)
49+
p.toggle_for()
50+
print(p.get())
51+

0 commit comments

Comments
 (0)