Skip to content

Commit

Permalink
gpio: global gpio factory?
Browse files Browse the repository at this point in the history
  • Loading branch information
charles37 committed Oct 30, 2024
1 parent 53733a2 commit 0c900b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hwci/gpio/interfaces/raspberry_pi5_gpio.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# Copyright Tock Contributors 2024.

import logging
from gpiozero import LED, Button, DigitalOutputDevice, DigitalInputDevice
from gpiozero import DigitalOutputDevice, DigitalInputDevice


class RaspberryPi5GPIO:
def __init__(self):
self.pins = {}

def pin(self, _target_pin_label, target_pin_mapping):
def pin(self, target_pin_label, target_pin_mapping):
gpio_pin_number = int(target_pin_mapping["io_pin_spec"])
if gpio_pin_number not in self.pins:
pin = RaspberryPiGPIOPin(gpio_pin_number)
Expand Down
6 changes: 6 additions & 0 deletions hwci/tests/mpu_walk_region.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
from utils.test_helpers import OneshotTest
import time

from gpiozero import Device
from gpiozero.pins.pigpio import PiGPIOFactory

# Set the pin factory to use pigpio
Device.pin_factory = PiGPIOFactory()


class MpuWalkRegionTest(OneshotTest):
def __init__(self):
Expand Down

0 comments on commit 0c900b9

Please sign in to comment.