Skip to content

Commit 730ee5b

Browse files
committed
cleanup
1 parent 0d53e4b commit 730ee5b

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎pcduino/gpio.py‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
20
1616
)
1717

18+
gpio_mode_pins = PinMap(
19+
'/sys/devices/virtual/misc/gpio/mode/',
20+
'gpio',
21+
20
22+
)
23+
1824
def digital_write(channel, value):
1925
"""Write to a GPIO channel"""
2026
path = gpio_pins.get_path(channel)
@@ -29,6 +35,6 @@ def digital_read(channel):
2935

3036
def pin_mode(channel, mode):
3137
""" Set Mode of a GPIO channel """
32-
path = gpio_pins.get_path(channel, '/sys/devices/virtual/misc/gpio/mode/')
33-
with open(path, 'w') as f:
38+
path = gpio_mode_pins.get_path(channel)
39+
with open(path, 'w+') as f:
3440
f.write('0' if mode == INPUT else '1')

0 commit comments

Comments
 (0)