From 9c06591f47e780d3ecace8660452a344cf5e17cb Mon Sep 17 00:00:00 2001 From: sommersoft Date: Fri, 31 May 2019 15:17:29 -0500 Subject: [PATCH] add 'deinit()' function --- .../microcontroller/generic_linux/sysfs_pwmout.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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, -- 2.49.0