Always make PWMOutputDevice operate on floats.

And better 'encapsulation' of the active_high properties.
This commit is contained in:
Andrew Scheller
2016-05-11 15:08:28 +01:00
parent c44a4bfe4b
commit da9b0bb644
2 changed files with 15 additions and 20 deletions

View File

@@ -376,9 +376,12 @@ class GPIODevice(Device):
self._active_state = True
self._inactive_state = False
def _state_to_value(self, state):
return bool(state == self._active_state)
def _read(self):
try:
return self.pin.state == self._active_state
return self._state_to_value(self.pin.state)
except (AttributeError, TypeError):
self._check_open()
raise