Skip to content

Commit

Permalink
Refactor of LXServo
Browse files Browse the repository at this point in the history
  • Loading branch information
ZodiusInfuser committed Nov 8, 2023
1 parent 24f8bfa commit 714a1dc
Show file tree
Hide file tree
Showing 3 changed files with 259 additions and 552 deletions.
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ verify_and_initialise(allow_unregistered : bool | int | SLOT | list | tuple,
## Interaction ##
is_pressed(switch : int | string) -> bool
is_boot_pressed() -> bool
is_led_on(switch: int | string) -> bool
set_led(switch : int | string, value : bool) -> None

## Power Control ##
Expand Down
8 changes: 4 additions & 4 deletions lib/pimoroni_yukon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,25 +459,25 @@ def is_pressed(self, switch):
def is_boot_pressed(self):
return self.__sw_boot.value() != 1

def set_led(self, switch, value):
def is_led_on(self, switch):
if switch is self.SWITCH_A_NAME:
switch = self.SWITCH_A
elif switch is self.SWITCH_B_NAME:
switch = self.SWITCH_B
elif switch < 0 or switch > 1:
raise ValueError("switch out of range. Expected 'A' or 'B', or SWITCH_A (0) or SWITCH_B (1)")

self.__leds[switch].value(value)
return self.__leds[switch].value() == 1

def is_led_on(self, switch):
def set_led(self, switch, value):
if switch is self.SWITCH_A_NAME:
switch = self.SWITCH_A
elif switch is self.SWITCH_B_NAME:
switch = self.SWITCH_B
elif switch < 0 or switch > 1:
raise ValueError("switch out of range. Expected 'A' or 'B', or SWITCH_A (0) or SWITCH_B (1)")

return self.__leds[switch].value() == 1
self.__leds[switch].value(value)

def enable_main_output(self):
if self.is_main_output_enabled() is False:
Expand Down
Loading

0 comments on commit 714a1dc

Please sign in to comment.