Verified Commit 4ad7a881 authored by Alexander Wellbrock's avatar Alexander Wellbrock
Browse files

refactor setup_pin function

Make it more readable / simplify.
parent ce6cb296
......@@ -49,21 +49,18 @@ class GPIO(GenericGPIO):
direction: input or output
pullup: pullup settings are not supported
"""
line_direction = DIRECTIONS[direction]
offset = pin
# Pullup settings are called bias in libgpiod and are only
# available since Linux Kernel 5.5. They are as of now not
# yet part of python3-gpiod.
pin = self.chip.get_line(offset)
line = self.chip.get_line(pin)
config = self.io.line_request()
config.consumer = 'pi-mqtt-gpio'
config.request_type = line_direction
config.request_type = DIRECTIONS[direction]
pin.request(config)
self.pins[offset] = pin
line.request(config)
self.pins[pin] = line
def setup_interrupt(self, handle, pin, edge, callback, bouncetime=100):
"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment