Commit Graph

165 Commits

Author SHA1 Message Date
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
3acf8a0d3a More work on the tests... 2016-04-05 13:22:40 +01:00
Dave Jones
92d80d2ae6 Some more tests... 2016-04-05 02:22:38 +01:00
Dave Jones
6c39e7716f Merge pull request #246 from waveform80/pin-database
Add pins database
2016-04-05 00:51:27 +01:00
Dave Jones
50946b417c Add pins database
Related to @lurch's comments on #148, this PR contains a database of
pins for each Pi revision, along with various other bits of miscellany
(I might've gotten a bit carried away here...).

Any corrections/extensions welcome!
2016-04-05 00:44:19 +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
7826e60c3d Fix #193
Changed pin.function so that it's always read-write, which in turn
permits InputDevice to force pin.function to "input" rather than
checking that it's not "input" first. This ensures internal state in
RPi.GPIO and RPIO reflects the reality of each pin's function (see
discussion under the ticket for more detail).
2016-04-03 15:45:28 +01:00
Dave Jones
23a63697b6 Fix #109
Document and test the LineSensor class properly. Multi-sensor devices
can wait for now.
2016-04-03 00:09:02 +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
Dave Jones
72b1857ea6 Merge pull request #235 from waveform80/fix-float-bounce
Fix #229
2016-03-19 18:06:23 +00:00
Dave Jones
9432046392 Fix #229
Make sure bounce is always integer when passed to RPi.GPIO and RPIO, and
added some checks to make sure a negative bounce isn't specified either
2016-03-19 17:02:46 +00:00
Dave Jones
351a323832 Fix #181
Added source_delay property to SourceMixin which means it'll now appear
everywhere. Default is 0.01 which is just enough to drop CPU usage while
remaining responsive enough for the majority of purposes.
2016-03-19 16:55:04 +00:00
Andrew Scheller
f476bbe458 PiGPIOPin fixup
raise correct exception for invalid pin numbers
2016-02-22 23:49:35 +00:00
Andrew Scheller
2495e903df RPIOPin fixups
...as discovered using the new real_pins unit-tests.
2016-02-22 02:46:19 +00:00
Dave Jones
b6fb4e4d89 Add "real" pins tests
This is just a quicky for people to start playing with - it's not
complete in any way, shape, or form. This is how I envisage the "real"
pin tests being done; part of the test suite with a `skipif` to ensure
they don't get run on non-Pi platforms, with a fixture to loop over
whatever pin implementations are found (we can't always assume all of
them: for example, RPIO doesn't work on a Pi 2), and a relatively simple
wiring for the test.

In this case I've assumed GPIOs 22 and 27 are wired together. They're
next to each other, so a jumper is sufficient to run the test.

PRs extending the coverage are very welcome (I've already discovered and
fixed several silly bugs in NativePin!). I've left all the interesting
hard stuff for people to play with (PWM testing: statistical sampling?
debounce compensation testing: timing?). When I've got a second, I'll
looking into hooking up my Pi Zero as a Travis-esque test-bed for this,
triggered by GitHub webhooks (not sure how I'll deal with reporting
yet).
2016-02-21 23:16:24 +00:00
Andrew Scheller
741a8ec7f3 More small MockPin tweaks 2016-02-21 01:24:10 +00:00
Andrew Scheller
c0d70f35f6 MockPin improvements
Change MockPin (and MockPWMPin) to make them behave more like 'real' pins - fixes #206
Add new MockPin tests, and rework some of the existing ones
Incorporate #216
2016-02-21 00:35:01 +00:00
Dave Jones
80dfee5c3f Merge pull request #211 from lurch/patch-2
RPiGPIOPin fixups
2016-02-20 17:51:11 +00:00
Dave Jones
50964a41ec Merge pull request #214 from lurch/patch-4
MockPin fixups
2016-02-20 17:41:46 +00:00
Andrew Scheller
768a27a71b MockPin fixups
* alter the PinSetInput exception message to match other `Pin` implementations
* constrain the state of MockPin to a `bool`, and the state of MockPWMPin to a `float`
* allow MockPin to have a `None` frequency set, matching the docs http://gpiozero.readthedocs.org/en/latest/api_pins.html#gpiozero.pins.Pin.frequency
2016-02-20 17:32:11 +00:00
Andrew Scheller
c878b20bcc NativePin fixups
* rename FUNCTION / PULL / EDGES dictionaries so that they better-match the other `Pin` implementations
* throw `PinSetInput` if trying to set the state of an input pin
2016-02-20 17:15:34 +00:00
Andrew Scheller
9883cf901a RPiGPIO fixups
* Imported missing exceptions
* Corrected wrong PinInvalidValue exception
* GPIO.PWM is a class (GPIO.HARD_PWM is the constant)
* GPIO.setup only supports setting input and output modes https://sourceforge.net/p/raspberry-gpio-python/code/ci/default/tree/source/py_gpio.c#l264
2016-02-20 15:37:13 +00:00
Andrew Scheller
d970af73fd Catch AttributeError inside GPIODevice._read
Fixes #202
2016-02-18 18:53:52 +00:00
Ben Nuttall
72afe2250a Expose all MCP* classes added in #162 2016-02-14 13:23:29 +00:00
Ben Nuttall
263f0e9e8f Fix TrafficLightsBuzzer's blink, close #190 2016-02-14 00:46:34 +00:00
Ben Nuttall
b3ef7440d5 Merge branch 'master' of github.com:rpi-distro/python-gpiozero 2016-02-12 22:50:18 +00:00
Ben Nuttall
052a998cd5 Add pulse to LEDBoard, re: #165 2016-02-12 22:50:05 +00:00
Dave Jones
0978b4c459 Merge pull request #192 from waveform80/pigpiod
Fix #180 - Add support for pigpio
2016-02-12 20:15:25 +00:00
Dave Jones
aebe42875d Fix #180 - Add support for pigpio 2016-02-12 20:14:10 +00:00
Dave Jones
3efd522457 Merge pull request #184 from waveform80/ultrasonics
Fix #114
2016-02-12 19:32:24 +00:00
Dave Jones
83fb6ae8b4 Fix #114 - ultrasonic sensors
Implements support for the HC-SR04 ultrasonic sensor as an input device
class named DistanceSensor
2016-02-12 19:27:24 +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
Ben Nuttall
8482fd12a3 Add active_high and initial_value to LEDCollection, close #175 2016-02-11 22:12:45 +00:00
Ben Nuttall
36cbcc3b98 Correct MCP3001 and MCP3201 differentials, re: #162 2016-02-11 22:02:34 +00:00
Ben Nuttall
add95cc6c0 Merge branch 'master' of github.com:rpi-distro/python-gpiozero 2016-02-11 21:51:38 +00:00
Ben Nuttall
3f9ea91560 Add additional ADC chips, close #162 2016-02-11 21:51:25 +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
c7ee499989 Merge pull request #177 from waveform80/misc-11
Miscellaneous minor changes for 1.1
2016-02-08 13:37:14 +00:00
Dave Jones
55e99f379a Merge-clean update of PR #126
This is an updated cherry-pick of Martin O'Hanlon's LEDBarGraph class.
2016-02-08 12:54:55 +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
Dave Jones
3f62bc848f Merge pull request #166 from lurch/patch-2
Minor tweak to PWMOutputDevice.is_active
2016-02-07 20:32:06 +00:00
Dave Jones
0c1b6d109e Re: #94 and #161
Adds fade-in/out parameters to LEDBoard's blink() method.
2016-02-07 20:27:09 +00:00