From: sommersoft Date: Fri, 31 May 2019 20:17:29 +0000 (-0500) Subject: add 'deinit()' function X-Git-Tag: 1.3.4^2~4 X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/commitdiff_plain/9c06591f47e780d3ecace8660452a344cf5e17cb add 'deinit()' function --- diff --git a/src/adafruit_blinka/microcontroller/generic_linux/sysfs_pwmout.py b/src/adafruit_blinka/microcontroller/generic_linux/sysfs_pwmout.py index 6266fbb..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: @@ -91,7 +94,7 @@ class PWMOut(object): raise PWMError(e.errno, "Exporting PWM pin: " + e.strerror) self._set_enabled(False) - + # Look up the period, for fast duty cycle updates self._period = self._get_period() @@ -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,