359 Commits

Author SHA1 Message Date
Ben Nuttall
fd3f66b832 Ensure PWMOutputDevice pin argument not mandatory, close #43 2015-10-05 12:09:35 +01:00
Ben Nuttall
82319ba672 Cleanup 2015-10-05 12:08:55 +01:00
Dave Jones
7429c03117 Docs clean up part 1
Big push on getting the docs cleaned up before 1.0. Proper wrapping of
everything so it's decently viewable from the command line (or as
decently viewable as markdown can be - the tables will never look great
from the command line).

Only one code change in this PR: rename bouncetime to bounce_time
(everything else is PEP-8, so this probably should be too) and change
its units to seconds from milliseconds (again, all other durations in
the library are in seconds, so it feels inconsistent that this one
isn't; for the sake of those who won't read the docs - which is most
people - I figure consistency helps with guessing!).
2015-10-03 16:24:12 +01:00
Ben Nuttall
3a4d3d4deb Add documentation for Motor, Robot and RyanteckRobot 2015-10-02 18:08:59 +01:00
Ben Nuttall
dc34cf3ccf Implement Motor, Robot and RyanteckRobot 2015-10-02 15:27:55 +01:00
Ben Nuttall
fbede611df Add MCP3008 and potentiometer example 2015-09-30 19:02:12 +01:00
Dave Jones
034b88b478 Add close method and context manager
Permit devices to be explicitly closed and used as context managers.
Also deal with cleanup properly at script end and ensure objects don't
step on the global cleanup function.
2015-09-29 19:10:01 +01:00
Ben Nuttall
8fc8e3444e Add RGBLED using new PWMOutputDevice 2015-09-28 19:34:55 +01:00
Ben Nuttall
b2a36bba47 Resolve merge conflict 2015-09-28 11:38:09 +01:00
Ben Nuttall
3f960f6da3 Update docstrings and add initial set of documentation 2015-09-28 11:11:00 +01:00
Dave Jones
c35dd1698b Fix #27 2015-09-27 17:29:21 +01:00
Dave Jones
980e4e7144 Fix #32 2015-09-24 16:45:55 +01:00
Ben Nuttall
7811ed67c9 Ensure args are passed to flash() 2015-09-24 12:23:09 +01:00
Ben Nuttall
cfed671972 Add docstrings, close #26 2015-09-24 11:39:50 +01:00
Ben Nuttall
c619aab630 Expose LEDBoard 2015-09-23 17:47:49 +01:00
Ben Nuttall
d47aff9f69 Make TrafficLights extend LEDBoard 2015-09-23 17:30:17 +01:00
Ben Nuttall
12800db25f Refactor PiLiter into generic LEDBoard class 2015-09-23 16:32:00 +01:00
Ben Nuttall
b97e97909c Add flash method to output devices and boards, close #22 2015-09-23 15:31:06 +01:00
Ben Nuttall
931571b85d Add toggle to boards 2015-09-23 14:44:41 +01:00
Ben Nuttall
3a19d8f5ab Merge branch 'master' of github.com:rpi-distro/python-gpiozero 2015-09-23 14:18:44 +01:00
Ben Nuttall
5e0a56b11c Make buzzer blink, close #19 2015-09-23 14:18:40 +01:00
Dave Jones
6b7a3c8851 Fix #25
Add a nice __repr__ to the GPIODevice base class.

This isn't much but generally I think `__repr__` implementations should
be deliberately simple: firstly, they're frequently used for debugging
so if they're at all complex you risk making a debugging tool buggy
(very annoying!). Secondly, if you pour too much info into them you risk
making the debugging output cluttered, so I tend to prefer keeping it to
straight-forward simple to retrieve/calculate info without excessive
detail (if the user wants more, they can always query it directly).

There is one refinement here: in SmoothedInputDevice, `__repr__` is
tweaked to ensure that when partial is False (the default), and the
queue isn't filled, `__repr__` doesn't block (because it should *never*
block).
2015-09-23 14:07:17 +01:00
Dave Jones
4e33052703 Fix #28
Re-order the test bindings to prefer using no parameters if possible
2015-09-23 13:47:32 +01:00
Dave Jones
7c647ec616 Fix #23
Add OutputDevice.toggle method with locking for correct threaded
operation
2015-09-23 13:38:37 +01:00
Ben Nuttall
e805eedd13 Add properties for leds and all on boards 2015-09-23 11:42:06 +01:00
Ben Nuttall
4a7d60f6a3 Release v0.4.0 2015-09-23 11:20:43 +01:00
Ben Nuttall
bb33b9aff3 Fix PiTraffic and TrafficHat 2015-09-23 11:16:42 +01:00
Ben Nuttall
2d999f82ab Merge branch 'master' of github.com:rpi-distro/python-gpiozero 2015-09-23 11:15:17 +01:00
Dave Jones
5c12d8c2e0 Flexible events
Permit event callbacks to accept no parameters, or a single parameter
providing the source input object
2015-09-22 23:20:29 +01:00
Dave Jones
b81d9ed875 Fix missing comma in __init__ 2015-09-22 22:08:06 +01:00
Ben Nuttall
8fe2a9d8ca Add missing comma 2015-09-22 18:23:56 +01:00
Ben Nuttall
65d363b7ed Tidy up 2015-09-22 17:52:19 +01:00
Ben Nuttall
b16127dd39 Add PiTraffic back in (was accidentally deleted in e474215) 2015-09-22 17:18:38 +01:00
Ben Nuttall
1bc5a5fa92 Release v0.3.0 2015-09-22 16:34:25 +01:00
Dave Jones
3df061b1bd Minor cleanup in boards
super calls weren't specified correctly, and there's no need to convert
to lists for adding tuples - tuples add to tuples just fine, just not
lists.
2015-09-22 15:05:11 +01:00
Dave Jones
0c208efff8 Merge branch 'master' into when-active-when-inactive
Conflicts:
	gpiozero/devices.py
	gpiozero/input_devices.py
2015-09-22 12:55:56 +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
Ben Nuttall
ae1c31e313 pep8 cleanup 2015-09-22 09:36:25 +01:00
Ben Nuttall
41c1bfb18f Initial commit of basic Robot class 2015-09-21 21:11:56 +01:00
Ben Nuttall
e4742150c4 Add Ryanteck TrafficHat based on FishDish (untested) 2015-09-21 18:40:06 +01:00
Ben Nuttall
840953fd81 Refactor and add blink method to all boards 2015-09-21 18:22:49 +01:00
Ben Nuttall
be48a96e3e Blink defaults to 1 second on/off 2015-09-21 17:55:19 +01:00
Ben Nuttall
2172ed78db Add missing Buzzer import 2015-09-21 17:44:45 +01:00
Ben Nuttall
2de3d9a26b Merge pull request #18 from Gadgetoid/patch-1
Update __init__.py
2015-09-21 17:33:56 +01:00
Ben Nuttall
4403348917 Use super over re-implentation for PiTraffic 2015-09-21 17:30:11 +01:00
Ben Nuttall
8223e56162 Make FishDish Button pull down 2015-09-21 17:18:20 +01:00
Ben Nuttall
d5f3e849a4 Prefix lights and all properties and convert lists to tuples 2015-09-21 17:14:33 +01:00
Philip Howard
9019452973 Update __init__.py
Added rogue missing comma!
2015-09-21 17:00:09 +01:00
Ben Nuttall
5669a98b42 Expose add-on board classes to the module 2015-09-21 15:29:54 +01:00
Ben Nuttall
6d29aaa590 Implement common add-on boards, re: #17 2015-09-21 15:28:01 +01:00