Commit Graph

83 Commits

Author SHA1 Message Date
Dave Jones
8958874a77 Add pin_factory param to all devices
And some docs ...
2017-07-14 10:44:24 +01:00
Dave Jones
d3c55d25a4 Tidying up...
Dunno how many commits this PR is now!
2017-06-16 13:28:55 +01:00
Dave Jones
ce6217c14f Fix #459 - properly support remote SPI with pigpio
Sorry! Dave's messing around with the pin implementations again.
Hopefully the last time. The pin_factory is now really a factory object
which can be asked to produce individual pins or pin-based interfaces
like SPI (which can be supported properly via pigpio).
2017-06-16 13:28:55 +01:00
Dave Jones
02f7d20bc3 Fix #248
Add Servo and AngularServo implementation along with docs and tests.
This is a deliberately minimal implementation designed to be added to as
we agree on new extensions (better than making an all-singing,
all-dancing version in which I get things wrong and then wind up making
backward incompatible changes to get it right :)
2016-08-30 21:33:28 +01:00
Dave Jones
6f67a973cf Fix all the stuff you broke last night...
In particular the `pi_revision` thing in PiGPIOPin, all the stuff @lurch
picked up in `pins/data.py` (thank goodness *someone's* watching!), and
make all those links pointing to "Notes" point somewhere useful like
"Pin Numbering"...
2016-08-30 15:43:57 +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
90ba151d26 Doc fix: initial_value for PWMOutputDevice and PWMLED are float (not bool) 2016-05-27 23:27:58 +01:00
Ben Nuttall
e515601a2c Merge pull request #332 from lurch/patch-4
Doc fix: RGBLED's initial_value is a tuple
2016-05-26 23:08:55 +01:00
Andrew Scheller
d2833e988f Doc fix: RGBLED's initial_value is a tuple 2016-05-26 19:24:19 +01:00
Andrew Scheller
3ee154189c Don't (implicitly) set an initial_value in PWMOutputDevice's init method via the super() call
fixes #326
2016-05-23 20:57:58 +01:00
Andrew Scheller
da9b0bb644 Always make PWMOutputDevice operate on floats.
And better 'encapsulation' of the active_high properties.
2016-05-11 16:23:39 +01:00
Andrew Scheller
c9461c50d3 Add a pwm option to the RGBLED and Motor constructors
...along with the other necessary changes required, to allow them to
optionally be used with non-PWM-capable pins
2016-05-08 18:23:30 +01:00
Dave Jones
1575863ba5 Merge pull request #312 from lurch/rgbled_pulse
Add RGBLED.pulse method
2016-05-08 11:53:14 +01:00
Dave Jones
97e873dd2e Revert "Update output_devices.py" 2016-05-08 11:39:25 +01:00
Dave Jones
714638a195 Merge pull request #301 from goloplo/patch-1
Update output_devices.py
2016-05-08 11:38:26 +01:00
Andrew Scheller
18bb3f559e Add RGBLED.pulse method
Also add timing tests to all the blink unit-tests
2016-05-04 11:14:36 +01:00
Andrew Scheller
fddb95b84b Add more unit tests, fix a few small bugs 2016-04-30 16:47:29 +01:00
goloplo
3e8a998661 Update output_devices.py 2016-04-28 21:07:37 +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
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
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
Ben Nuttall
052a998cd5 Add pulse to LEDBoard, re: #165 2016-02-12 22:50:05 +00:00
Ben Nuttall
81123f87d5 Remove on_time and off_time from PWMLED.pulse, add docstring, close #165 2016-02-12 19:12:55 +00:00
Ben Nuttall
6174ef035e Merge branch 'PWMLED_pulse' of https://github.com/lurch/python-gpiozero into lurch-PWMLED_pulse 2016-02-12 19:08:40 +00:00
Dave Jones
1f2140a9f5 Work on #87
Implement a test suite, including Travis-CI integration
2016-02-11 21:11:22 +00:00
Dave Jones
b4a8273472 Bump version and update changelog for 1.1
Includes some last minute changes too
2016-02-08 23:37:13 +00:00
Dave Jones
8e0c6e243b Refactor low level implementation
This commit is a fairly major piece of work that abstracts all pin
operations (function, state, edge detection, PWM, etc.) into a base
"Pin" class which is then used by input/output/composite devices to
perform all required configuration.

The idea is to pave the way for I2C based IO extenders which can present
additional GPIO ports with similar capabilities to the Pi's "native"
GPIO ports. As a bonus it also abstracts away the reliance on the
RPi.GPIO library to allow alternative pin implementations (e.g. using
RPIO to take advantage of DMA based PWM), or even pure Python
implementations.
2016-02-08 14:54:18 +00:00
Dave Jones
006c10cce0 Miscellaneous minor changes for 1.1 2016-02-08 12:01:42 +00:00
Dave Jones
9871ac3dca Fix #135 2016-02-08 00:33:05 +00:00
Dave Jones
19c19f6ff5 Merge pull request #173 from waveform80/blink-device-not-led
Fix #167
2016-02-07 22:52:49 +00:00
Dave Jones
f0ea1627f7 Fix #167 2016-02-07 22:51:41 +00:00
Andrew Scheller
29ca48d2a7 Minor tweak to PWMOutputDevice.is_active
...so that its implementation is more consistent with the other is_active methods
2016-02-03 03:34:12 +00:00
Andrew Scheller
c133110ab9 Add PWMOutputDevice.pulse method
...which simply calls blink with different default arguments
2016-02-03 01:01:54 +00:00
Dave Jones
e52ad37200 Fix prototypes in docs
The prototypes in the docs are rigged to make out the first parameter as
mandatory (as it effectively is); however this does mean you've got to
remember to update the prototype when you modify it in the code! :)
2016-01-31 20:07:34 +00:00
Dave Jones
8b21599257 Fix #118
... and fix up active_high values while we're at it ...
2016-01-31 17:50:02 +00:00
Dave Jones
d5226d1fee Minor changes 2016-01-31 16:25:35 +00:00
Dave Jones
de5dff3c1d Fix #143
Add active_high parameter to PWMOutputDevice (there's no reason PWM
devices can't be wired active low after all)
2016-01-31 16:17:43 +00:00
Dave Jones
cf18fb971e Fix #121
Change parent of PWMOutputDevice to OutputDevice and implement blink to
maintain compatibility. The version of blink implemented here is
slightly extended to include functionality like Explorer HAT's "pulse".
The parameter defaults behave identically to OutputDevice's blink but
can be adjusted to have the device smoothly fade in and out.
2016-01-31 13:47:11 +00:00
Dave Jones
0bc62aee73 Generic docs need reST
Conversion of all docs to reST so that the generic docs can link easily
with the rest of the docs.
2016-01-30 23:40:12 +00:00
Dave Jones
59ba7154c5 Move exceptions to their own sub-module
This removes the circular dependency introduced in PR#137. This also
fixes up an issue in the base meta-class which meant it wasn't working
in Python 3 (only Python 2), and adds a bit to the meta-class to allow
docstrings to be inherited (taken from the rest-docs branch).
2016-01-07 11:01:49 +00:00
Ben Nuttall
ef9e5802dc Merge pull request #108 from waveform80/motor-pins
Fix #107
2015-11-15 18:22:01 +00:00
Dave Jones
c929b9a53b Fix #107
Add forward_device and backward_device to Motor, left_motor and
right_motor to Robot, and ensure all CompositeDevice descendents have a
proper close() method and closed property. Also, add a few more
_check_open calls around the place to make sure GPIODeviceClosed is
properly raised in response to read and writing values.
2015-11-15 18:19:15 +00:00
Ben Nuttall
4975e9c8fb Update docs: add PWMLED and include value, values and source properties 2015-11-15 17:18:10 +00:00
Ben Nuttall
492f311cc4 Remove incomplete TemperatureSensor for 1.0 release, close #93 2015-11-15 13:00:06 +00:00
Dave Jones
f69b6195ca Fix #75
Alias blink to beep for Buzzer
2015-11-15 11:48:53 +00:00
Dave Jones
2a1ed11535 Fix #91
Override toggle() in PWMOutputDevice, and add reverse() to Motor and
Robot
2015-10-26 21:23:03 +00:00
Tim Golden
3d468d764f Fix incorrect variable name 2015-10-24 11:38:01 +01:00