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:
Dave Jones
2016-04-04 01:34:53 +01:00
parent 365e309af6
commit 69dd8a439a
23 changed files with 1091 additions and 423 deletions

View File

@@ -11,6 +11,7 @@ from .pins import (
from .exc import (
GPIOZeroError,
DeviceClosed,
BadEventHandler,
CompositeDeviceError,
CompositeDeviceBadName,
SPIError,
@@ -45,13 +46,15 @@ from .devices import (
Device,
GPIODevice,
CompositeDevice,
)
from .mixins import (
SharedMixin,
SourceMixin,
ValuesMixin,
EventsMixin,
)
from .input_devices import (
InputDevice,
WaitableInputDevice,
DigitalInputDevice,
SmoothedInputDevice,
Button,
@@ -103,3 +106,24 @@ from .boards import (
CamJamKitRobot,
Energenie,
)
from .other_devices import (
InternalDevice,
PingServer,
TimeOfDay,
)
from .source_tools import (
averaged,
clamped,
conjunction,
cos_values,
disjunction,
inverted,
negated,
post_delayed,
pre_delayed,
quantized,
queued,
random_values,
scaled,
sin_values,
)