mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-10-29 17:50:37 +00:00
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...
50 lines
960 B
ReStructuredText
50 lines
960 B
ReStructuredText
============
|
|
Source Tools
|
|
============
|
|
|
|
.. currentmodule:: gpiozero
|
|
|
|
GPIO Zero includes several utility routines which are intended to be used with
|
|
the :attr:`~SourceMixin.source` and :attr:`~ValuesMixin.values` attributes
|
|
common to most devices in the library. Given that ``source`` and ``values``
|
|
deal with infinite iterators, another excellent source of utilities is the
|
|
:mod:`itertools` module in the standard library.
|
|
|
|
Single source conversions
|
|
=========================
|
|
|
|
.. autofunction:: negated
|
|
|
|
.. autofunction:: inverted
|
|
|
|
.. autofunction:: scaled
|
|
|
|
.. autofunction:: clamped
|
|
|
|
.. autofunction:: post_delayed
|
|
|
|
.. autofunction:: pre_delayed
|
|
|
|
.. autofunction:: quantized
|
|
|
|
.. autofunction:: queued
|
|
|
|
Combining sources
|
|
=================
|
|
|
|
.. autofunction:: conjunction
|
|
|
|
.. autofunction:: disjunction
|
|
|
|
.. autofunction:: averaged
|
|
|
|
Artifical sources
|
|
=================
|
|
|
|
.. autofunction:: random_values
|
|
|
|
.. autofunction:: sin_values
|
|
|
|
.. autofunction:: cos_values
|
|
|