Skip to content

Commit eb6c4e8

Browse files
committed
examples/sysfsgpio: add invert (active-low) attribute to examples
Add the new invert (active-low) attribute to the examples and add calls to the new invert method Signed-off-by: Perry Melange <[email protected]>
1 parent 2df5184 commit eb6c4e8

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

examples/sysfsgpio/export-gpio.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
desk:
2-
GpioDigitalOutputDriver:
2+
SysfsGPIO:
33
index: 60
4+
invert: False

examples/sysfsgpio/import-gpio.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,3 @@ targets:
55
name: gpio
66
drivers:
77
GpioDigitalOutputDriver: {}
8-
options:
9-
coordinator_address: 'labgrid:20408'

examples/sysfsgpio/sysfsgpio.py

+9-1
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, invert=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,10 @@
2627
time.sleep(2)
2728
p.set(True)
2829
print(p.get())
30+
time.sleep(2)
31+
p.invert()
32+
print(p.get())
33+
time.sleep(2)
34+
p.invert()
35+
print(p.get())
36+
time.sleep(2)

examples/sysfsgpio/sysfsgpio_remote.py

+8
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,10 @@
2324
time.sleep(2)
2425
p.set(True)
2526
print(p.get())
27+
time.sleep(2)
28+
p.invert()
29+
print(p.get())
30+
time.sleep(2)
31+
p.invert()
32+
print(p.get())
33+
time.sleep(2)

0 commit comments

Comments
 (0)