mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-10-29 17:50:37 +00:00
The prototypes in the docs are rigged to make out the first parameter as mandatory (as it effectively is); however this does mean you've got to remember to update the prototype when you modify it in the code! :)
88 lines
2.0 KiB
ReStructuredText
88 lines
2.0 KiB
ReStructuredText
===============
|
|
Generic Devices
|
|
===============
|
|
|
|
.. currentmodule:: gpiozero
|
|
|
|
The GPIO Zero class hierarchy is quite extensive. It contains a couple of base
|
|
classes:
|
|
|
|
* :class:`GPIODevice` for individual devices that attach to a single GPIO pin
|
|
|
|
* :class:`CompositeDevice` for devices composed of multiple other devices like
|
|
HATs
|
|
|
|
There are also a couple of `mixin classes`_:
|
|
|
|
* :class:`ValuesMixin` which defines the ``values`` properties; there is rarely
|
|
a need to use this as the base classes mentioned above both include it
|
|
(so all classes in GPIO Zero include the ``values`` property)
|
|
|
|
* :class:`SourceMixin` which defines the ``source`` property; this is generally
|
|
included in novel output device classes
|
|
|
|
.. _mixin classes: https://en.wikipedia.org/wiki/Mixin
|
|
|
|
The current class hierarchies are displayed below. For brevity, the mixin
|
|
classes are omitted:
|
|
|
|
.. image:: images/gpio_device_hierarchy.*
|
|
|
|
.. image:: images/composite_device_hierarchy.*
|
|
|
|
Finally, for composite devices, the following chart shows which devices are
|
|
composed of which other devices:
|
|
|
|
.. image:: images/composed_devices.*
|
|
|
|
Base Classes
|
|
============
|
|
|
|
.. autoclass:: GPIODevice(pin)
|
|
:inherited-members:
|
|
:members:
|
|
|
|
.. autoclass:: CompositeDevice
|
|
:inherited-members:
|
|
:members:
|
|
|
|
Input Devices
|
|
=============
|
|
|
|
.. autoclass:: InputDevice(pin, pull_up=False)
|
|
:members:
|
|
|
|
.. autoclass:: WaitableInputDevice
|
|
:members:
|
|
|
|
.. autoclass:: DigitalInputDevice(pin, pull_up=False, bounce_time=None)
|
|
:members:
|
|
|
|
.. autoclass:: SmoothedInputDevice
|
|
:members:
|
|
|
|
.. autoclass:: AnalogInputDevice
|
|
:members:
|
|
|
|
Output Devices
|
|
==============
|
|
|
|
.. autoclass:: OutputDevice(pin, active_high=True, initial_value=False)
|
|
:members:
|
|
|
|
.. autoclass:: PWMOutputDevice(pin, active_high=True, initial_value=0, frequency=100)
|
|
:members:
|
|
|
|
.. autoclass:: DigitalOutputDevice(pin, active_high=True, initial_value=False)
|
|
:members:
|
|
|
|
Mixin Classes
|
|
=============
|
|
|
|
.. autoclass:: ValuesMixin(...)
|
|
:members:
|
|
|
|
.. autoclass:: SourceMixin(...)
|
|
:members:
|
|
|