]> Repositories - Adafruit_Blinka-hackapet.git/commitdiff
add 'deinit()' function
authorsommersoft <sommersoft@gmail.com>
Fri, 31 May 2019 20:17:29 +0000 (15:17 -0500)
committersommersoft <sommersoft@gmail.com>
Fri, 31 May 2019 20:17:29 +0000 (15:17 -0500)
src/adafruit_blinka/microcontroller/generic_linux/sysfs_pwmout.py

index 6266fbb1d37807f619991b76090a2dca6a97db38..4c975c37e0e7acce335bc2a724c352978013de94 100644 (file)
@@ -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,