mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-12-08 20:39:01 +00:00
The source/values toolkit
Me and my big mouth. No sooner do I declare the base classes "relatively stable" than I go and mess around with it all again. Anyway, this is the long promised set of utilities to make source/values more interesting. It includes a few interesting little utility functions, a whole bunch of examples and introduces the notion of "pseudo" devices with no (obvious) hardware representation like a time-of-day device. This necessitated making the event system a little more generic (it's not exclusive the GPIO devices after all; no reason we can't use it on composite devices in future) and by this point the mixins have gotten large enough to justify their own module. The pseudo-devices are a bit spartan and basic at the moment but I'm sure there'll be plenty of future ideas...
This commit is contained in:
@@ -16,6 +16,9 @@ classes:
|
||||
* :class:`SPIDevice` represents devices that communicate over an SPI interface
|
||||
(implemented as four GPIO pins)
|
||||
|
||||
* :class:`InternalDevice` represents devices that are entirely internal to
|
||||
the Pi (usually operating system related services)
|
||||
|
||||
* :class:`CompositeDevice` represents devices composed of multiple other
|
||||
devices like HATs
|
||||
|
||||
@@ -31,6 +34,9 @@ There are also several `mixin classes`_:
|
||||
* :class:`SharedMixin` which causes classes to track their construction and
|
||||
return existing instances when equivalent constructor arguments are passed
|
||||
|
||||
* :class:`EventsMixin` which adds activated/deactivated events to devices
|
||||
along with the machinery to trigger those events
|
||||
|
||||
.. _mixin classes: https://en.wikipedia.org/wiki/Mixin
|
||||
|
||||
The current class hierarchies are displayed below. For brevity, the mixin
|
||||
@@ -47,6 +53,10 @@ Next, the classes below :class:`SPIDevice`:
|
||||
|
||||
.. image:: images/spi_device_hierarchy.*
|
||||
|
||||
Next, the classes below :class:`InternalDevice`:
|
||||
|
||||
.. image:: images/other_device_hierarchy.*
|
||||
|
||||
Next, the classes below :class:`CompositeDevice`:
|
||||
|
||||
.. image:: images/composite_device_hierarchy.*
|
||||
@@ -60,15 +70,18 @@ Base Classes
|
||||
============
|
||||
|
||||
.. autoclass:: Device
|
||||
:members: close, closed
|
||||
:members: close, closed, value, is_active
|
||||
|
||||
.. autoclass:: GPIODevice(pin)
|
||||
:members:
|
||||
|
||||
.. autoclass:: CompositeDevice
|
||||
.. autoclass:: SPIDevice
|
||||
:members:
|
||||
|
||||
.. autoclass:: SPIDevice
|
||||
.. autoclass:: InternalDevice
|
||||
:members:
|
||||
|
||||
.. autoclass:: CompositeDevice
|
||||
:members:
|
||||
|
||||
Input Devices
|
||||
@@ -77,9 +90,6 @@ Input Devices
|
||||
.. autoclass:: InputDevice(pin, pull_up=False)
|
||||
:members:
|
||||
|
||||
.. autoclass:: WaitableInputDevice
|
||||
:members:
|
||||
|
||||
.. autoclass:: DigitalInputDevice(pin, pull_up=False, bounce_time=None)
|
||||
:members:
|
||||
|
||||
@@ -128,3 +138,6 @@ Mixin Classes
|
||||
.. autoclass:: SharedMixin(...)
|
||||
:members: _shared_key
|
||||
|
||||
.. autoclass:: EventsMixin(...)
|
||||
:members:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user