Commit Graph

107 Commits

Author SHA1 Message Date
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
075841249e Tidying up bits for #150 2016-01-30 21:58:00 +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
15ce68d1a7 Merge pull request #139 from waveform80/exceptions-module
Move exceptions to their own sub-module
2016-01-07 12:04:59 +00:00
Dave Jones
ef5761d409 Merge pull request #138 from alexwlchan/awlc/fishdish
Fix return type of TrafficLightsBuzzer.value
2016-01-07 11:18:40 +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
Alex Chan
cca4c85afe Fix return type of TrafficLightsBuzzer.value
The FishDishTuple was renamed to TrafficLightsBuzzerTuple in
commit b87e2a4, but the `value` property wasn't modified to match.
2016-01-06 15:06:09 +00:00
Alex Chan
6538d5de7b Add missing InputDeviceError import to devices.py 2016-01-06 14:59:10 +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
4cf634a9c3 Fix typo 2015-11-22 18:25:41 +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
71284b233d Fix TrafficHat numbering to match promo photos, re: #65 2015-11-15 17:37:36 +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
382d6e45fc Reverse order of MCP300X arguments, close #92 2015-11-15 13:51:49 +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
4615873b39 Change bouncetime to bounce_time
The parameter was already changed to bounce_time in the base
DigitalInputDevice class, but was overridden (incorrectly) in the
derived Button class.
2015-11-05 19:45:09 +00:00
Dave Jones
04c30d1ad2 Fix speling and grandma mistakes
Several in WaitableInputDevice's attribute docstrings.
2015-11-04 15:33:20 +00:00
Dave Jones
e6be9ab274 Fix #100
Permit built-in (C implemented) methods and functions to be used as
event callbacks. Given that prototype introspection is not available for
such routines, assume that they take no (mandatory) parameters.
2015-11-04 12:26:24 +00:00
Dave Jones
0c8eff6a20 Merge pull request #96 from waveform80/pwm-toggle-motor-reverse
Fix #91
2015-10-27 20:05:12 +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
Dave Jones
43fbf03dd7 Fix Py2 syntax and value super-call 2015-10-26 21:08:53 +00:00
Ben Nuttall
8c1f2d420f Add PWM option to add-on boards with LEDs, re: #90 2015-10-25 23:33:14 +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
Tim Golden
3d468d764f Fix incorrect variable name 2015-10-24 11:38:01 +01: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
Dave Jones
f6294a5bf4 Fix #76
Makes `value` an alias of `is_active` in the base `GPIODevice`, and
`values` an infinite iterable of this value. Then adds `source` property
to `OutputDevice` allowing simple linkage of devices via iterators.
2015-10-19 11:01:09 +01:00
Ben Nuttall
3230f3ae18 Add PWMLED, close #58 2015-10-17 22:11:59 +01:00
Dave Jones
6583223299 Fix #74
Add more property aliases and do them properly (no more lambdas and
string lookups) which means we can remove `_alias`. This commit also
defines `__slots__` for all classes which should prevent assignation of
invalid attributes with an AttributeError (more friendly than silently
doing the wrong thing). Finally, it cleans up all the property defs to
use Ben's preferred decorator style.
2015-10-17 22:04:52 +01:00
Ben Nuttall
b7cce51497 Update docs for v0.8.0 2015-10-17 12:36:41 +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
7bf0561cb6 Remove relay class, re: #66 2015-10-14 12:17:49 +01:00
Dave Jones
924850ccde Fix #66
This PR adds the `active_high` parameter (defaulted to `True`) to the
`OutputDevice` class. This permits flipping the logic of an output
device in a similar manner to `pull_up` on `InputDevice`.

It also adds a `Relay` class derived from `DigitalOutputDevice` which
uses this parameter to flip the logic (as this is typically required
with relays).
2015-10-14 12:10:36 +01:00
Dave Jones
250ba454d9 Fix #68
Actually, this isn't so much a fix as a re-working of RGBLED. This
renames the `rgb` property to `color` because that's what the property
really represents (combined with `picamera.Color` this lets you do stuff
like `rgb_led.color = Color('red')`), and simplifies the internals of
the class. It also adds the common `close` method and context manager
capabilities.

Finally, it corrects an error I hadn't noticed earlier where
PWMOutputDevice isn't properly cleaning up PWM threads on close.
2015-10-14 12:05:44 +01:00
Dave Jones
53f3a3c69f Fix #64
Make MotionSensor more responsive by effectively removing the averaging
queue. Also add note on how to smooth out "jittery" PIR sensors by
increasing the queue length back up to 5.
2015-10-13 22:00:09 +01:00
Ryan Walmsley
f1771c1f05 Fixed TrafficHat numbering to match promo photos etc. 2015-10-13 13:52:39 +01:00
Dave Jones
bb6523a95b Fix #57
This refactors the GPIOOutputDevice to have an internal `_write` method
similar to the `_read` method used to grab the value of a GPIO device.
This is used for simple 1s and 0s until we get to PWMOutputDevice which
replaces the value with the PWM device's duty cycle level. As a result,
all the DigitalOutputDevice base methods (including blink) "just work".

This commit also, for the moment, removes min_pwm and max_pwm because
I'm not 100% certain how they should interact with the notion of
is_active at the moment. They'll probably get added back in at some
point but I need a bit more time to think about it!
2015-10-12 15:46:48 +01:00
Dave Jones
2d161f560f Fix #50
This isn't a full fix but I can't seem to reproduce the issue in #50 at
the moment. So for now this just ensures that exceptions in the
constructors get cleaned up properly (so they don't block future
construction attempts against the same pin)
2015-10-12 10:15:09 +01:00
Ben Nuttall
3ce4151bb7 Fix faulty PWMOutputDevice value setter 2015-10-12 00:24:46 +01:00
Ben Nuttall
ee36451bed Make Motors PWM devices with optional speed argument on methods 2015-10-07 17:09:28 +01:00
Ben Nuttall
493b4e1cda Change RGBLED interface from 0-100 to 0-255, close #40 2015-10-05 13:26:01 +01:00
Ben Nuttall
c26c279174 Change PWM interface from 0-100 to 0-1, close #45 2015-10-05 12:37:43 +01:00
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