X-Git-Url: https://git.ayoreis.com/hackapet/Adafruit_Blinka.git/blobdiff_plain/f599d177e9baa31e507c6633681dcfc65b73c759..9c06591f47e780d3ecace8660452a344cf5e17cb:/src/adafruit_blinka/microcontroller/generic_linux/sysfs_pwmout.py diff --git a/src/adafruit_blinka/microcontroller/generic_linux/sysfs_pwmout.py b/src/adafruit_blinka/microcontroller/generic_linux/sysfs_pwmout.py index 915c318..4c975c3 100644 --- a/src/adafruit_blinka/microcontroller/generic_linux/sysfs_pwmout.py +++ b/src/adafruit_blinka/microcontroller/generic_linux/sysfs_pwmout.py @@ -63,6 +63,9 @@ class PWMOut(object): def __exit__(self, t, value, traceback): self.close() + def deinit(self): + self.close() + def _open(self, pin, duty=0, freq=500, variable_frequency=False): self._channel = None for pwmpair in pwmOuts: @@ -90,12 +93,12 @@ class PWMOut(object): except IOError as e: raise PWMError(e.errno, "Exporting PWM pin: " + e.strerror) - #self._set_enabled(False) - + self._set_enabled(False) + # Look up the period, for fast duty cycle updates self._period = self._get_period() - #self.duty_cycle = 0 + self.duty_cycle = 0 # set frequency self.frequency = freq @@ -128,7 +131,7 @@ class PWMOut(object): with open(path, 'w') as f_attr: #print(value, path) f_attr.write(value + "\n") - + def _read_pin_attr(self, attr): path = os.path.join( self._sysfs_path,