mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-10-29 17:50:37 +00:00
Always make PWMOutputDevice operate on floats.
And better 'encapsulation' of the active_high properties.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user