Commit Graph

96 Commits

Author SHA1 Message Date
Dave Jones
9fdc093837 Add pin_factory to all relevant class docs
Also tell a whole load of lies about what's a keyword-only arg. In the
vast majority of cases, pin_factory (and other args) *aren't*
keyword-only ... but we'd really like them to be, it's just difficult
while maintaining py2 compatibility.
2017-07-14 11:01:02 +01:00
Dave Jones
8958874a77 Add pin_factory param to all devices
And some docs ...
2017-07-14 10:44:24 +01:00
Ben Nuttall
448feaf68f Correct StatusBoard max strip numbers in docstring 2017-07-03 12:30:58 +01:00
Dave Jones
53a8200507 Move device construction into dict-comprehension
Shouldn't make any difference to object lifetimes, but makes the
constructor similar to all others (which don't seem to have the same
issue?)
2017-06-25 21:35:58 +01:00
Dave Jones
56f2152daf Change CompositeDevice to reject invalid identifiers
Also updated StatusBoard and StatusZero to reject duplicate identifiers
(namedtuple doesn't pick 'em up because they're passed in a dict and
thus the dups are squashed prior to the call). Added tests for all the
relevant stuff.
2017-06-25 20:44:13 +01:00
Ben Nuttall
8c656e4c4d Remove kwargs from CompositeOutputDevice init 2017-06-23 22:59:29 +01:00
Ben Nuttall
09711f2ea6 Correct order of red/green LEDs 2017-06-23 22:59:29 +01:00
Ben Nuttall
5f0e87766e Small Statusboard corrections from PR review 2017-06-23 22:58:06 +01:00
Ben Nuttall
55e031d72f Add implementation for StatusBoard 2017-06-23 22:58:06 +01:00
Ben Nuttall
be6380f97b Add implementation for StatusZero 2017-06-23 22:58:06 +01:00
Ben Nuttall
a79f8ccc16 Merge pull request #446 from lurch/traffic_lights_tweak
Add extra TrafficLight tests, and remove the redundant setattr function
2016-09-19 14:13:51 +01:00
Ben Nuttall
12932c67d8 Merge pull request #441 from lurch/add_pistop_board
Add support for the Pi-Stop Traffic-light board
2016-09-19 14:10:50 +01:00
Andrew Scheller
1b3e6a429b Add extra TrafficLight tests, and remove the redundant setattr function
- `CompositeDevice`s can't have any of their attributes set anyway
2016-09-19 12:00:38 +01:00
Andrew Scheller
eaa6016ded Typo 2016-09-19 11:00:28 +01:00
Andrew Scheller
c35741c793 Add support for the Pi-Stop Traffic-light board 2016-09-19 01:11:29 +01:00
Dave Jones
9272b28b2e Merge pull request #370 from lurch/ButtonBoard
Initial version of ButtonBoard for testing...
2016-08-30 23:19:00 +01:00
Dave Jones
57c8a3b4dd Merge pull request #372 from lurch/amber_gambler
Add 'yellow' as an alias of 'amber' for TrafficLights
2016-08-14 20:27:41 +01:00
Ben Nuttall
9c15afe77e Use robot.forward() not robot.left() in examples 2016-06-12 22:09:55 +01:00
Andrew Scheller
f96ab609e2 TrafficLights.value also reports 'yellow' instead of 'amber' when appropriate 2016-06-10 12:44:39 +01:00
Andrew Scheller
38262a125f Add 'yellow' as an alias of 'amber' for TrafficLights
Fixes #345
2016-06-10 12:43:22 +01:00
Andrew Scheller
382966e4e4 Allow TrafficLights, RGBLED and Motor to be constructed using GPIO 0 2016-06-10 11:49:53 +01:00
Andrew Scheller
754c9c9b9c Initial version of ButtonBoard for testing...
...not ready to be merged into master yet!
2016-06-09 19:45:22 +01:00
Andrew Scheller
97202b9250 Add extra product URLs to the boards.py docstrings 2016-06-05 11:59:14 +01:00
Ben Nuttall
70e3d1b4cd Merge pull request #341 from lurch/deprecate_CompositeDevice_all
remove usage of CompositeDevice.all since it's marked as deprecated
2016-05-31 00:22:41 +01:00
Ben Nuttall
35d9228843 Merge pull request #342 from lurch/robot_value
Add value-setter for Robot class
2016-05-28 17:07:16 +01:00
Andrew Scheller
d8ae4b6814 Typo 2016-05-28 13:56:04 +01:00
Andrew Scheller
b3035d306e Add value-setter for Robot class
Fixes #305
2016-05-28 13:50:47 +01:00
Andrew Scheller
42371294a2 remove usage of CompositeDevice.all since it's marked as deprecated 2016-05-28 13:14:45 +01:00
Ben Nuttall
8b006e9fb7 Merge pull request #339 from lurch/extra_init_params
Add extra init-method params
2016-05-28 12:39:25 +01:00
Andrew Scheller
e832cfeb23 Add extra init-method params
adds `initial_value` to PiLiter, TrafficLights, PiTraffic & SnowPi and
adds `pwm` to PiTraffic
2016-05-28 12:17:52 +01:00
Andrew Scheller
871c9268b2 Change LEDBoard.leds to return a static tuple
fixes #337
2016-05-28 10:42:49 +01:00
Ben Nuttall
a13a7bb1c4 Correct PiLiterBarGraph init params 2016-05-27 22:05:09 +01:00
Ben Nuttall
a116e9ded0 Add PWM support to PiLiterBarGraph 2016-05-27 21:51:20 +01:00
Andrew Scheller
3a7acbf89d Add LedBorg as a subclass of RGBLED 2016-05-26 20:27:16 +01:00
Dave Jones
1b7dad5fa4 Merge pull request #313 from lurch/patch-5
Add active_high parameter to LEDBarGraph's constructor
2016-05-08 11:56:51 +01:00
Dave Jones
afc847c159 Merge pull request #307 from lurch/extra_board_tests
Add more unit tests, fix a few small bugs
2016-05-08 11:36:27 +01:00
Andrew Scheller
86aeab4129 Add active_high parameter to LEDBarGraph's constructor
Also adds an active_high property to LEDCollection, and fixes up some of the LEDBoard docstrings
2016-05-06 11:53:00 +01:00
Andrew Scheller
fddb95b84b Add more unit tests, fix a few small bugs 2016-04-30 16:47:29 +01:00
Andrew Scheller
708157c8fd Minor Energenie tweaks 2016-04-30 12:19:45 +01:00
Andrew Scheller
53b78f1e32 Minor docs fix (#286)
* Minor docs fix

* Another doc fix
2016-04-19 16:14:31 +01:00
Andrew Scheller
0089b5225c Add *args to the LEDBoard on(), off() and toggle() methods.
Implements #125
2016-04-10 01:35:18 +01:00
Dave Jones
8c4096b19c Some minor doc fixes for 1.2 2016-04-09 10:30:03 +01:00
Dave Jones
c2a9392ea5 Make tests work reliably on the Pi
While the tests work well on a PC or Travis, the Pi (where I ought to be
running them!) has some issues with the timing tests. Need to relax the
tolerance of the "assert_states_and_times" method to 0.05 seconds
otherwise it periodically fails even on something reasonably quick like
a Pi 2 (less failures on a Pi 3 but still occasionally).

Also reduced default fps to 25; if the default timing occasionally fails
on a Pi 2 it's evidently too fast for a Pi 1 and shouldn't be the
default; 25 also doesn't look any different to me on a pulsing LED.

There's also a bunch of miscellaneous fixes in here; last minute typos
and chart re-gens for the 1.2 release.
2016-04-08 23:11:14 +01:00
Andrew Scheller
6f92e979bd Typo 2016-04-08 15:27:17 +01:00
Andrew Scheller
72ca075668 fix various bugs found by the 'prospector' static-analysis tool 2016-04-07 17:58:51 +01:00
Dave Jones
ee3bd6b532 Fix #204 and start readying the release
Also re-numbers energenie sockets 1-4 (as noted by @bennuttall in
comments to #239), and adds several "real pins" tests and board tests.
The bad-PWM stuff is currently disabled as it causes segfaults when
running the tests and I can't seem to trace the cause at the moment.
Finally, I've tweaked the deb config to suggest gpiozero, removed spidev
as a mandatory dep (which'll fix installs on wheezy for py3), and
there's some more miscellaneous last-minute stuff here that I can't
recall...
2016-04-06 23:06:46 +01:00
Dave Jones
69dd8a439a 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...
2016-04-04 23:59:05 +01:00
Dave Jones
8fc4b58ec2 Fix #182
Fixes LEDBarGraph (broken by snowpi updates) and adds PWM support and
relevant recipes
2016-04-01 20:05:10 +01:00
Dave Jones
d6af02933a Fix #130, fix #131, fix #189
This PR implements SnowPi, adds the ability for LEDBoard's to own other
LEDBoards as well as LEDs, and enhances blink so that manually
controlling a LED automatically stops it from blinking (no matter
whether it's blinking itself or a LEDBoard is blinking it).

It also fixes up RGBLED and Motor which I managed to break with the last
PR ...
2016-04-01 17:32:46 +01:00
Dave Jones
759a6a58e6 Fix #140, fix #69, fix #185
This PR adds a software SPI implementation. Firstly this removes the
absolute necessity for spidev (#140), which also means when it's not
present things still work (effectively fixes #185), and also enables any
four pins to be used for SPI devices (which don't require the hardware
implementation).

The software implementation is simplistic but still supports clock
polarity and phase, select-high, and variable bits per word. However it
doesn't allow precise speeds to be implemented because it just wibbles
the clock as fast as it can (which being pure Python isn't actually that
fast).

Finally, because this PR involves creating a framework for "shared"
devices (like SPI devices with multiple channels), it made sense to bung
Energenie (#69) in as wells as this is a really simple shared device.
2016-04-01 12:57:17 +01:00