# Path: minibot/hardware/gpio.py
# class PWM():
#     """
#     PWM used on a minibot.
#     """
#     def __init__(self, pin, frequency, duty_cycle=0):
#         """
#         Constructor.
#         Args:
#             pin (int): Pin that the PWM is connected to on the minibot.
#             frequency (int): Frequency of the PWM.
#             duty_cycle (int): Duty cycle of the PWM.
#         """
#         self.pin = pin
#         self.frequency = frequency
#         self.duty_cycle = duty_cycle
# 
#     def set_frequency(self, frequency):
#         """
#         Sets frequency of the PWM.
#         """
#         self.frequency = frequency
# 
#     def set_duty_cycle(self, duty_cycle):
#         """
#         Sets duty cycle of the PWM.
#         """
#         self.duty_cycle = duty_cycle
# 
#     def stop(self):
#         """
#         Stops the PWM.
#         """
#         raise NotImplementedError("PWM.stop")
# 
# Path: minibot/hardware/gpio.py
# class DigitalInput():
#     """
#     Digital input pin.
#     """
#     def __init__(self, pin):
#         """
#         Constructor.
#         Args:
#             pin (int): Digital pin number.
#         """
#         self.pin = pin
# 
#     def read(self):
#         """
#         Read input from the digital pin.
#         Return:
#             int: 0 or 1 for LOW or HIGH voltage.
#         """
#         raise NotImplementedError
# 
# Path: minibot/hardware/gpio.py
# class DigitalOutput():
#     """
#     Digital output pin.
#     """
#     def __init__(self, pin):
#         """
#         Constructor.
#         Args:
#             pin (int): Digital pin number.
#         """
#         self.pin = pin
# 
#     def set_low(self):
#         """
#         Set the digital output pin to low.
#         """
#         raise NotImplementedError
# 
#     def set_high(self):
#         """
#         Set the digital output pin to high.
#         """
#         raise NotImplementedError


from minibot.hardware.gpio import PWM as MPWM
from minibot.hardware.gpio import DigitalInput as MDigitalInput
from minibot.hardware.gpio import DigitalOutput as MDigitalOutput
import RPi.GPIO as RGPIO
# Sets mode of the GPIO to BCM numbering.
RGPIO.setmode(RGPIO.BCM)

class DigitalInput(MDigitalInput):
    """
    Digital input pin.
    """
    def __init__(self, pin, pull_up_down=None):
        """
        Digital input for the RPi.
        Args:
            pin (int): BCM pin number for the digital input.
            pull_up_down (int): Whether to use an internal pull up or pull down resistor.
        """
        MDigitalInput.__init__(self, pin)
        RGPIO.setup(pin, RGPIO.IN, pull_up_down=pull_up_down)

    def read(self):
        """
        Read digital input from the pin.
        Return:
            int: 0 or 1 for LOW or HIGH voltage.
        """
        return RGPIO.input(self.pin)

class DigitalOutput(MDigitalOutput):
    """
    Digital output pin.
    """
    def __init__(self, pin):

# Path: minibot/hardware/gpio.py
# class PWM():
#     """
#     PWM used on a minibot.
#     """
#     def __init__(self, pin, frequency, duty_cycle=0):
#         """
#         Constructor.
#         Args:
#             pin (int): Pin that the PWM is connected to on the minibot.
#             frequency (int): Frequency of the PWM.
#             duty_cycle (int): Duty cycle of the PWM.
#         """
#         self.pin = pin
#         self.frequency = frequency
#         self.duty_cycle = duty_cycle
# 
#     def set_frequency(self, frequency):
#         """
#         Sets frequency of the PWM.
#         """
#         self.frequency = frequency
# 
#     def set_duty_cycle(self, duty_cycle):
#         """
#         Sets duty cycle of the PWM.
#         """
#         self.duty_cycle = duty_cycle
# 
#     def stop(self):
#         """
#         Stops the PWM.
#         """
#         raise NotImplementedError("PWM.stop")
# 
# Path: minibot/hardware/gpio.py
# class DigitalInput():
#     """
#     Digital input pin.
#     """
#     def __init__(self, pin):
#         """
#         Constructor.
#         Args:
#             pin (int): Digital pin number.
#         """
#         self.pin = pin
# 
#     def read(self):
#         """
#         Read input from the digital pin.
#         Return:
#             int: 0 or 1 for LOW or HIGH voltage.
#         """
#         raise NotImplementedError
# 
# Path: minibot/hardware/gpio.py
# class DigitalOutput():
#     """
#     Digital output pin.
#     """
#     def __init__(self, pin):
#         """
#         Constructor.
#         Args:
#             pin (int): Digital pin number.
#         """
#         self.pin = pin
# 
#     def set_low(self):
#         """
#         Set the digital output pin to low.
#         """
#         raise NotImplementedError
# 
#     def set_high(self):
#         """
#         Set the digital output pin to high.
#         """
#         raise NotImplementedError


# Path: minibot/hardware/rpi/gpio.py
from minibot.hardware.gpio import PWM as MPWM
from minibot.hardware.gpio import DigitalInput as MDigitalInput
from minibot.hardware.gpio import DigitalOutput as MDigitalOutput
import RPi.GPIO as RGPIO

# Sets mode of the GPIO to BCM numbering.
RGPIO.setmode(RGPIO.BCM)

class DigitalInput(MDigitalInput):
    """
    Digital input pin.
    """
    def __init__(self, pin, pull_up_down=None):
        """
        Digital input for the RPi.
        Args:
            pin (int): BCM pin number for the digital input.
            pull_up_down (int): Whether to use an internal pull up or pull down resistor.
        """
        MDigitalInput.__init__(self, pin)
        RGPIO.setup(pin, RGPIO.IN, pull_up_down=pull_up_down)

    def read(self):
        """
        Read digital input from the pin.
        Return:
            int: 0 or 1 for LOW or HIGH voltage.
        """
        return RGPIO.input(self.pin)

class DigitalOutput(MDigitalOutput):
    """
    Digital output pin.
    """
    def __init__(self, pin):

        MDigitalOutput.__init__(self, pin)