]> Repositories - Adafruit_Blinka-hackapet.git/blobdiff - src/adafruit_blinka/microcontroller/generic_linux/sysfs_pwmout.py
replace 'close()' with 'deinit()'
[Adafruit_Blinka-hackapet.git] / src / adafruit_blinka / microcontroller / generic_linux / sysfs_pwmout.py
index 915c3182b22d4b2486c33e01381c6455782176bf..de663e9fe7d80d48afb74e8ff351e5cb541bb088 100644 (file)
@@ -55,13 +55,13 @@ class PWMOut(object):
         self._open(pin, duty_cycle, frequency, variable_frequency)
 
     def __del__(self):
         self._open(pin, duty_cycle, frequency, variable_frequency)
 
     def __del__(self):
-        self.close()
+        self.deinit()
 
     def __enter__(self):
         return self
 
     def __exit__(self, t, value, traceback):
 
     def __enter__(self):
         return self
 
     def __exit__(self, t, value, traceback):
-        self.close()
+        self.deinit()
 
     def _open(self, pin, duty=0, freq=500, variable_frequency=False):
         self._channel = None
 
     def _open(self, pin, duty=0, freq=500, variable_frequency=False):
         self._channel = None
@@ -90,12 +90,12 @@ class PWMOut(object):
         except IOError as e:
             raise PWMError(e.errno, "Exporting PWM pin: " + e.strerror)
 
         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()
 
         # 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
 
         # set frequency
         self.frequency = freq
@@ -104,8 +104,8 @@ class PWMOut(object):
 
         self._set_enabled(True)
 
 
         self._set_enabled(True)
 
-    def close(self):
-        """Close the sysfs PWM."""
+    def deinit(self):
+        """Deinit the sysfs PWM."""
         if self._channel is not None:
             self.duty_cycle = 0
             try:
         if self._channel is not None:
             self.duty_cycle = 0
             try:
@@ -128,7 +128,7 @@ class PWMOut(object):
         with open(path, 'w') as f_attr:
             #print(value, path)
             f_attr.write(value + "\n")
         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,
     def _read_pin_attr(self, attr):
         path = os.path.join(
             self._sysfs_path,