Пример #1
0
 def __init__(self, dma_channel=0, subcycle_time_us=20000, \
         pulse_incr_us=10):
     """
     Makes sure PWM is setup with the correct increment granularity and
     subcycle time.
     """
     self._dma_channel = dma_channel
     self._subcycle_time_us = subcycle_time_us
     if _PWM.is_setup():
         _pw_inc = _PWM.get_pulse_incr_us()
         if not pulse_incr_us == _pw_inc:
             raise AttributeError(("Error: PWM is already setup with pulse-"
                     "width increment granularity of %sus instead of %sus")\
                      % (_pw_inc, self.pulse_incr_us))
     else:
         setup(pulse_incr_us=pulse_incr_us)
Пример #2
0
 def __init__(self, dma_channel=0, subcycle_time_us=20000, \
         pulse_incr_us=10):
     """
     Makes sure PWM is setup with the correct increment granularity and
     subcycle time.
     """
     self._dma_channel = dma_channel
     self._subcycle_time_us = subcycle_time_us
     if _PWM.is_setup():
         _pw_inc = _PWM.get_pulse_incr_us()
         if not pulse_incr_us == _pw_inc:
             raise AttributeError(("Error: PWM is already setup with pulse-"
                     "width increment granularity of %sus instead of %sus")\
                      % (_pw_inc, self.pulse_incr_us))
     else:
         setup(pulse_incr_us=pulse_incr_us)
Пример #3
0
def is_setup():
    """ Returns 1 if setup(..) has been called, else 0 """
    return _PWM.is_setup()
Пример #4
0
def is_setup():
    """ Returns 1 if setup(..) has been called, else 0 """
    return _PWM.is_setup()