示例#1
0
    def setPeriodMultiplier(self, mult: PeriodMultiplier) -> None:
        """Slow down the PWM signal for old devices.

        :param mult: The period multiplier to apply to this channel
        """
        if mult == PWM.PeriodMultiplier.k4X:
            # Squelch 3 out of 4 outputs
            hal.setPWMPeriodScale(self.handle, 3)
        elif mult == PWM.PeriodMultiplier.k2X:
            # Squelch 1 out of 2 outputs
            hal.setPWMPeriodScale(self.handle, 1)
        elif mult == PWM.PeriodMultiplier.k1X:
            # Don't squelch any outputs
            hal.setPWMPeriodScale(self.handle, 0)
        else:
            raise ValueError("Invalid mult argument '%s'" % mult)
示例#2
0
    def setPeriodMultiplier(self, mult: PeriodMultiplier) -> None:
        """Slow down the PWM signal for old devices.

        :param mult: The period multiplier to apply to this channel
        """
        if mult == PWM.PeriodMultiplier.k4X:
            # Squelch 3 out of 4 outputs
            hal.setPWMPeriodScale(self.handle, 3)
        elif mult == PWM.PeriodMultiplier.k2X:
            # Squelch 1 out of 2 outputs
            hal.setPWMPeriodScale(self.handle, 1)
        elif mult == PWM.PeriodMultiplier.k1X:
            # Don't squelch any outputs
            hal.setPWMPeriodScale(self.handle, 0)
        else:
            raise ValueError("Invalid mult argument '%s'" % mult)
示例#3
0
    def setPeriodMultiplier(self, mult):
        """Slow down the PWM signal for old devices.

        :param mult: The period multiplier to apply to this channel
        :type mult: PWM.PeriodMultiplier
        """
        if self.port is None:
            raise ValueError("operation on freed port")
        if mult == PWM.PeriodMultiplier.k4X:
            # Squelch 3 out of 4 outputs
            hal.setPWMPeriodScale(self.port, 3)
        elif mult == PWM.PeriodMultiplier.k2X:
            # Squelch 1 out of 2 outputs
            hal.setPWMPeriodScale(self.port, 1)
        elif mult == PWM.PeriodMultiplier.k1X:
            # Don't squelch any outputs
            hal.setPWMPeriodScale(self.port, 0)
        else:
            raise ValueError("Invalid mult argument '%s'" % mult)