Commit Graph

207 Commits

Author SHA1 Message Date
Ben Nuttall
2aede36365 Add recipes 2015-09-28 12:47:21 +01:00
Ben Nuttall
c1db2dce55 Tidy up docs index 2015-09-28 11:50:56 +01:00
Ben Nuttall
3f960f6da3 Update docstrings and add initial set of documentation 2015-09-28 11:11:00 +01:00
Dave Jones
b1913e5e39 Add events to all input devices
Fairly major tidy up of the hierarchy as well. There's now a trivial
base class: InputDevice which simply permits reading of state.
WaitableInputDevice descends from this and introduces waitable events
and callbacks, and provides a hook for calling them but needs further
machinery to activate that hook.

DigitalInputDevice (crap name?) descends from WaitableInputDevice and
uses the standard RPi.GPIO callback mechanisms to handle events. This is
intended for use with trivial on/off devices with predictably small
bounce times.

Next is SmoothedInputDevice (crap name?) which also descends from
WaitableInputDevice. This includes a background threaded queue which
constantly monitors the state of the device and provides a running mean
of its state. This is compared to a threshold for determining active /
inactive state. This is intended for use with on/off devices that
"jitter" a lot and for which a running average is therefore appropriate
or for devices which provide an effectively analog readout (like
charging capacitor timings).

MonitorSensor and LightSensor now descend from SmoothedInputDevice, and
Button descends from DigitalInputDevice. All "concrete" classes provide
event aliases appropriate to their function (e.g. when_dark,
when_pressed, etc.)
2015-09-22 12:48:09 +01:00
Dave Jones
9c64a1dc2f Update the docs with an example
Simple demo of when_dark / when_light
2015-09-21 12:04:51 +01:00
Dave Jones
4a8e17deac Doc corrections
Tidy up wrapping and replace all references to gpio_components with
gpiozero
2015-09-21 08:33:03 +01:00
Ben Nuttall
a8b93cf97f Add setup.py and distribution basics 2015-09-15 17:53:50 +01:00