X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/blobdiff_plain/d1402cafbd77236c5d4c74f1b42f987affd194b2..8fe9bc8bda76d6f0202ae5aacc7dab6d103f89fc:/src/adafruit_blinka/microcontroller/generic_linux/sysfs_pwmout.py diff --git a/src/adafruit_blinka/microcontroller/generic_linux/sysfs_pwmout.py b/src/adafruit_blinka/microcontroller/generic_linux/sysfs_pwmout.py index 6266fbb..de663e9 100644 --- a/src/adafruit_blinka/microcontroller/generic_linux/sysfs_pwmout.py +++ b/src/adafruit_blinka/microcontroller/generic_linux/sysfs_pwmout.py @@ -55,13 +55,13 @@ class PWMOut(object): 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): - self.close() + self.deinit() def _open(self, pin, duty=0, freq=500, variable_frequency=False): self._channel = None @@ -91,7 +91,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() @@ -104,8 +104,8 @@ class PWMOut(object): 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: @@ -128,7 +128,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,