]> Repositories - hackapet/Adafruit_Blinka.git/blobdiff - src/adafruit_blinka/microcontroller/generic_linux/sysfs_pwmout.py
add 'deinit()' function
[hackapet/Adafruit_Blinka.git] / src / adafruit_blinka / microcontroller / generic_linux / sysfs_pwmout.py
index 915c3182b22d4b2486c33e01381c6455782176bf..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:
@@ -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,