Skip to content

Commit

Permalink
power led check init WIP
Browse files Browse the repository at this point in the history
Signed-off-by: Filip Lewiński <[email protected]>
  • Loading branch information
filipleple committed Jan 20, 2025
1 parent 2aefa22 commit 1310603
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions osfv_cli/src/osfv/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,11 @@ def gpio_get(rte, args):
print(f"GPIO {args.gpio_no} state: {state}")


def check_pwr_led(rte, args)
state = rte.gpio_get(GPIO_PWR_LED)
print(f"Power LED state: {'ON' if state == 1 else 'OFF'}")


def gpio_set(rte, args):
rte.gpio_set(args.gpio_no, args.state)
state = rte.gpio_get(args.gpio_no)
Expand Down Expand Up @@ -775,6 +780,9 @@ def main():
psu_subparsers.add_parser(
"get", help="Display information on DUT's power state"
)
check_pwr_led_parser = pwr_subparsers.add_parser(
"check_led", help="Check the state of the DUT power LED"
)

# GPIO subcommands
gpio_subparsers = gpio_parser.add_subparsers(
Expand Down Expand Up @@ -958,6 +966,8 @@ def main():
power_off(rte, args)
elif args.pwr_cmd == "reset":
reset(rte, args)
elif args.pwr_cmd == "check_led":
check_pwr_led(rte, args)
elif args.pwr_cmd == "psu":
if args.psu_cmd == "on":
psu_on(rte, args)
Expand Down
2 changes: 2 additions & 0 deletions osfv_cli/src/osfv/libs/rte.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class RTE(rtectrl):

GPIO_CMOS = 12

GPIO_PWR_LED = -1 # tbd after connecting in lab

PSU_STATE_ON = "ON"
PSU_STATE_OFF = "OFF"

Expand Down
6 changes: 6 additions & 0 deletions osfv_cli/src/osfv/rf/rte_robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,9 @@ def rte_gpio_set(self, gpio_no, state):
self.rte.gpio_set(int(gpio_no), state)
state = self.rte.gpio_get(int(gpio_no))
robot.api.logger.info(f"GPIO {gpio_no} state set to {state}")

@keyword(types=None)
def rte_check_power_led(self):
state = self.rte.gpio_get(GPIO_PWR_LED)
robot.api.logger.info(f"Power LED state: {'ON' if state == 1 else 'OFF'}")
return state

0 comments on commit 1310603

Please sign in to comment.