File: api_generic.rst

package info (click to toggle)
gpiozero 2.0.1-0.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 17,192 kB
  • sloc: python: 15,355; makefile: 246
file content (81 lines) | stat: -rw-r--r-- 1,805 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
.. GPIO Zero: a library for controlling the Raspberry Pi's GPIO pins
..
.. Copyright (c) 2015-2021 Dave Jones <dave@waveform.org.uk>
..
.. SPDX-License-Identifier: BSD-3-Clause

=====================
API - Generic Classes
=====================

.. module:: gpiozero.devices

.. currentmodule:: gpiozero

The GPIO Zero class hierarchy is quite extensive. It contains several base
classes (most of which are documented in their corresponding chapters):

* :class:`Device` is the root of the hierarchy, implementing base functionality
  like :meth:`~Device.close` and context manager handlers.

* :class:`GPIODevice` represents individual devices that attach to a single
  GPIO pin

* :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

There are also several `mixin classes`_ for adding important functionality
at numerous points in the hierarchy, which is illustrated below (mixin classes
are represented in purple, while abstract classes are shaded lighter):

.. image:: images/device_hierarchy.*

.. _mixin classes: https://en.wikipedia.org/wiki/Mixin


Device
======

.. autoclass:: Device
    :members: close, closed, value, is_active, pin_factory


ValuesMixin
===========

.. autoclass:: ValuesMixin(...)
    :members:


SourceMixin
===========

.. autoclass:: SourceMixin(...)
    :members:


SharedMixin
===========

.. autoclass:: SharedMixin(...)
    :members: _shared_key


EventsMixin
===========

.. autoclass:: EventsMixin(...)
    :members:


HoldMixin
=========

.. autoclass:: HoldMixin(...)
    :members: