Skip to content
This repository was archived by the owner on Nov 23, 2025. It is now read-only.

Commit 75a481b

Browse files
committed
Updated the get_gpio_input interface to allow for enabling pull-up.
1 parent 833a4a7 commit 75a481b

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

CHANGES.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Version 0.5.0
2323
* Fixed a bug where get compatible pins wasn't verifying requirements.
2424
* Removed get gpio config as this functionality is no longer applicable in
2525
the new UOS design.
26+
* Updated the get_gpio_input interface to allow for enabling pull-up.
2627

2728
Version 0.4.0
2829
-------------

uoshardware/api.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,19 +143,22 @@ def set_gpio_output(
143143
)
144144

145145
def get_gpio_input(
146-
self, pin: int, level: int, volatility: Persistence = Persistence.NONE
146+
self,
147+
pin: int,
148+
pull_up: bool = False,
149+
volatility: Persistence = Persistence.NONE,
147150
) -> ComResult:
148151
"""Read a GPIO pins level from device and returns the value.
149152
150153
:param pin: The numeric number of the pin as defined in the dictionary for that device.
151-
:param level: Not used currently, future will define pull-up state.
154+
:param pull_up: Enable the internal pull-up resistor. Default is false.
152155
:param volatility: How volatile should the command be, use constants from uoshardware.
153156
:return: ComResult object.
154157
"""
155158
return self.__execute_instruction(
156159
UOSFunctions.get_gpio_input,
157160
InstructionArguments(
158-
payload=(pin, level),
161+
payload=(pin, 0 if pull_up else 1),
159162
expected_rx_packets=2,
160163
check_pin=pin,
161164
volatility=volatility,

0 commit comments

Comments
 (0)