except IOError as e:
raise PWMError(e.errno, "Exporting PWM pin: " + e.strerror)
- self._set_enabled(False)
+ #self._set_enabled(False) # This line causes a write error when trying to enable
# Look up the period, for fast duty cycle updates
self._period = self._get_period()
- self.duty_cycle = 0
+ #self.duty_cycle = 0 # This line causes a write error when trying to enable
# set frequency
self.frequency = freq
self._channel = None
self._pwmpin = None
+ def _is_deinited(self):
+ if self._pwmpin is None:
+ raise ValueError("Object has been deinitialize and can no longer "
+ "be used. Create a new object.")
+
def _write_pin_attr(self, attr, value):
+ # Make sure the pin is active
+ self._is_deinited()
+
path = os.path.join(
self._sysfs_path,
self._channel_path.format(self._channel),
f_attr.write(value + "\n")
def _read_pin_attr(self, attr):
+ # Make sure the pin is active
+ self._is_deinited()
+
path = os.path.join(
self._sysfs_path,
self._channel_path.format(self._channel),