Skip to content

Commit

Permalink
Merge pull request #6 from pimoroni/patch-get-pin-int
Browse files Browse the repository at this point in the history
Add support for int pins to get_pin.
  • Loading branch information
Gadgetoid authored Apr 29, 2024
2 parents 8e3ce47 + cdf0396 commit 038a321
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions gpiodevice/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,13 @@ def get_pin(pin, label, settings):
if isinstance(pin, tuple):
return pin

chip = find_chip_by_pins(pin)
line_offset = chip.line_offset_from_id(pin)
if isinstance(pin, int):
chip = find_chip_by_platform()
line_offset = pin
else:
chip = find_chip_by_pins(pin)
line_offset = chip.line_offset_from_id(pin)

consumer = Path(sys.argv[0]).stem
lines = chip.request_lines(consumer=f"{consumer}-{label}", config={line_offset: settings})
return lines, line_offset
Expand Down

0 comments on commit 038a321

Please sign in to comment.