Commit Graph

30 Commits

Author SHA1 Message Date
Dave Jones
1f2140a9f5 Work on #87
Implement a test suite, including Travis-CI integration
2016-02-11 21:11:22 +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
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
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
pcopa
38bc27b546 Have made a simpler structure for MCP3008/3004 and MCP3208/3204.
The code is running on my Pi and seems to be stable
 Have added MCP3301/3302/3304
 have implemented the "M" bit to allow Differential mode
 Have added an "absVal" for absolute values
 Have added a "relVal" for relative val from 0 to 1 (same as "value")
 left "value" for backwards compatabilety, but propse to delete it
 shifted Rx bits for MCP330x

 On branch master
 Your branch is up-to-date with 'origin/master'.

 Changes to be committed:
	modified:   gpiozero/__init__.py
	modified:   gpiozero/input_devices.py

 Untracked files:
	ZeroCombo11.py

 Date:      Mon Jan 18 20:25:36 2016 -0500
2016-01-29 22:03:13 -05: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
f1d4ca0c05 Add LineSensor 2015-11-23 08:36:14 +00:00
Ben Nuttall
cfe200af35 Add CamJamKitRobot interface 2015-11-22 18:35:11 +00:00
Ben Nuttall
492f311cc4 Remove incomplete TemperatureSensor for 1.0 release, close #93 2015-11-15 13:00:06 +00:00
Dave Jones
b87e2a4d53 Fix #81
Fix up the FishDish hierarchy so that all LEDS can be addressed as
`lights` directly.
2015-10-25 10:45:34 +00:00
Dave Jones
fa0a1b3cdd Fix #76, fix #79
This finishes off implementing values and source for all (current)
classes in gpiozero. I'm afraid things get rather complex in this
commit. For starters, we've now got quite a few "aggregate" classes
which necessarily don't descend from GPIODevice. To implement values and
source on these I could either repeat a helluva lot of code or ... turn
to mixin classes. Yeah, it's multiple inheritance time, baby!

Unfortunately multiple inheritance doesn't work with __slots__ but we
really ought to keep functionality that they provide us (raise
AttributeError when an unknown attribute is set). So I've implemented
this with ... erm ... metaclasses. Sorry!
2015-10-22 21:44:42 +01:00
Ben Nuttall
3230f3ae18 Add PWMLED, close #58 2015-10-17 22:11:59 +01:00
Dave Jones
a347a2ca4e Fix #41
Add `AnalogInputDevice` base class and extend `MCP3008` (and `MCP3004`)
classes from it.
2015-10-15 10:18:28 +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
c619aab630 Expose LEDBoard 2015-09-23 17:47:49 +01:00
Ben Nuttall
4a7d60f6a3 Release v0.4.0 2015-09-23 11:20:43 +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
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
1bc5a5fa92 Release v0.3.0 2015-09-22 16:34:25 +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
a07f89c561 Release v0.2.0 2015-09-21 11:20:21 +01:00
Dave Jones
e2ddad6fea Shut down GPIO threads nicely
The motion sensor queue doesn't shut down properly at script end at the
moment and prevents the interpreter shutting down. This is because it's
a non-daemon thread so `__del__` never gets run and so on.

This is a bit of a major PR - I can split it up if you want. Firstly it
makes a common base class called `GPIODevice` for both `InputDevice` and
`OutputDevice`. This just takes care of the read-only pin stuff. Next it
makes a `GPIOThread` class that ensures its a daemon thread, and which
also ensures proper cleanup on shutdown.

Finally, it fixes `MotionSensor` to use the new `GPIOThread` class
(tested this time! Works nicely) and adds the `blink` method to the
`LED` class (which also works nicely this time).
2015-09-18 12:45:30 +01:00
Dave Jones
481193497a Ensure GPIO.cleanup is called
Small patch to ensure GPIO.cleanup is always called on interpreter
shutdown. This just means the library will "play nice" with whatever
comes afterward.
2015-09-17 18:51:56 +01:00
Ben Nuttall
abdc215175 Rename to gpiozero and tidy up 2015-09-15 17:53:08 +01:00