Commit Graph

61 Commits

Author SHA1 Message Date
Dave Jones
73c0516a28 Try and import the right compat...
And remove all the nonsense you re-factored into PiPin...
2017-06-16 13:28:55 +01:00
Dave Jones
cab6cc8086 Rework when_changed attribute to use weakrefs
Some fairly major changes to ensure that the Pin.when_changed property
doesn't keep references to the objects owning the callbacks that are
assigned. This is vaguely tricky given that ordinary weakref's can't be
used with bound methods (which are ephemeral), so I've back-ported
weakref.WeakMethod from Py3.4.

This solves a whole pile of things like Button instances not
disappearing when they're deleted, and makes composite devices
containing Buttons much easier to construct as we don't need to worry
about partially constructed things not getting deleted.
2017-06-16 13:28:55 +01:00
Dave Jones
08076e8d0e Inline the SPI hardware args (neater code) 2017-06-16 13:28:55 +01:00
Dave Jones
cbff81f3a1 Simplify SPI bit-banging implementation
And add some comments to make stuff clearer
2017-06-16 13:28:55 +01:00
Dave Jones
a9f9aa4a3e Catch SPI conflicts properly
Also handle SPI flags in pigpio implementation more elegantly (just
store the flags and manipulate them instead of keeping separate fields)
2017-06-16 13:28:55 +01:00
Dave Jones
ba1a7e6497 Add configuration of mock factory via env-vars
Also tidied up some docs
2017-06-16 13:28:55 +01:00
Dave Jones
b0c807da19 More tidying up
Ensure LEDCollection cleans up upon construction failure, rename some
internals to be a bit more obvious, rename PinGPIOUnsupported to
PinUnsupported, and some other stuff I've forgotten!
2017-06-16 13:28:55 +01:00
Dave Jones
c570b8f09b Clean up repeated string substitutions 2017-06-16 13:28:55 +01:00
Dave Jones
4d79dc74db Removed redundant weakref references
Also tweaked a couple of minor bits (SPI bus init mask) and unused
_get_address override
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
4e62990917 Merge remote-tracking branch 'upstream/lenient_revision_parser'
Conflicts:
	gpiozero/pins/data.py
2017-06-13 18:19:02 +01:00
Dave Jones
97ffabe764 Fix up missing board stuff
Also ensure the Zero W gets represented properly on board output and
tidy up some spacing
2017-06-13 16:02:07 +01:00
Dave Jones
900affbf7f Merge remote-tracking branch 'upstream/1.3.2-updates'
Conflicts:
	docs/changelog.rst
	gpiozero/pins/data.py
2017-06-13 15:48:02 +01:00
Ben Nuttall
f5f827c0ec Add missing quote 2017-03-03 13:11:49 +00:00
Andrew Scheller
5b91e55e96 Add details for Chinese Pi Zero (on top of v1.3.1.post1) 2017-03-03 12:55:18 +00:00
Andrew Scheller
82050d3d5a Add details for 512MB Pi A+ (on top of v1.3.1.post1) 2017-03-03 12:55:07 +00:00
Andrew Scheller
71fed0e851 Add BCM2837-based Pi2B details (on top of v1.3.1.post1) 2017-03-03 12:54:53 +00:00
Andrew Scheller
8c7bd5f51f Add Pi Zero W details (on top of v1.3.1.post1) 2017-03-03 12:54:42 +00:00
Andrew Scheller
dc0c119cbb Add Sony Japan manufactured Pi 3B details (on top of v1.3.1.post1) 2017-03-03 12:54:29 +00:00
Andrew Scheller
4e2798dcd0 Add Compute Module 3 details (on top of v1.3.1.post1) 2017-03-03 12:54:14 +00:00
Andrew Scheller
1b2415a4c2 Supply 'default' values for some of the pi-revision fields, where appropriate 2017-01-22 17:10:32 +00:00
Andrew Scheller
17024c9ba3 Separate out the revision-code parsing and decoding 2017-01-22 16:51:42 +00:00
Andrew Scheller
f3ccaf891c Update for rev 1.0 2B 2016-09-22 23:19:20 +01:00
Ben Nuttall
69aaa627fc Correct B+/2B release date change 2016-09-22 16:41:39 +01:00
Ben Nuttall
2046af7454 Add release date for new BCM2837-based Pi 2B
I think this is all that's needed to make pi_info accurate
2016-09-22 15:25:27 +01:00
Andrew Scheller
4e66c0fcd3 Default to 'full' content in __format__
...when no explicit content argument is given
2016-09-13 23:50:19 +01:00
Dave Jones
27c0703043 Fix #354
Actually, "fix" doesn't really do this justice. This is closer to "nukes
from orbit" ...
2016-09-13 17:37:17 +01:00
Dave Jones
737a739cd6 Fix #421
Added SPI tests, simplified the shared SPI software bus implementation,
and fixed several protocol errors in our MCP3xxx classes (the x2 and x1
protocols were wrong)
2016-09-08 22:24:06 +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
Dave Jones
6cc308e44a Fix #354, fix #389
Overhaul the pi_info system:

Pin factories are now capable of generating pi_info themselves (although
currently they all just look up the revision and call pi_info with a
specific one).

PiGPIOPin will now return pi_info for the remote pi which can be
specified by parameter or implicitly by the environment vars.

Overvolted Pis should work properly no matter what (some argument over
whether the revision 7 or 8 chars in this case; both should work). Added
some minor tweaks for the new camera-capable Pi Zero

Finally, added a bunch of tests for pins.data
2016-08-29 11:48:23 +01:00
Andrew Scheller
37b91ced74 Correct number of ComputeModule USB ports (part 2)
Correct associated documentation
2016-08-18 00:22:07 +01:00
Andrew Scheller
65285d1b33 Correct number of ComputeModule USB ports
Fixes #384
2016-08-14 23:43:59 +01:00
BuildTools
76ab6badd2 Applying suggestion by lurch in https://github.com/RPi-Distro/python-gpiozero/pull/395 comment. 2016-07-27 00:17:20 +02:00
BuildTools
23fabb68ce Use PIGPIO_ADDR and PIGPIO_PORT environment variable if they exist to configure PiGPIO, otherwise it use the default value 'localhost' and 8888. This is the same behaviour as the pigpio library for initialisation. 2016-07-26 22:45:38 +02:00
Andrew Scheller
23e153df50 Correct manufacturer of 0x14 ComputeModule 2016-06-19 11:30:58 +01:00
Ben Nuttall
ea1ec451ef Add Pi Zero v1.3
@waveform80 does this look ok to you?
2016-06-04 17:34:05 +01:00
Dave Jones
79a0fd2a27 Fix #278
Allow the creation of remote pins easily with PiGPIOPin. Also changes
DefaultPin to a pin_factory callable which accepts the input pin number.
2016-04-16 00:30:22 +01:00
Andrew Scheller
b694ec838a Tiny typo 2016-04-14 02:02:40 +01:00
Dave Jones
f82ddad1fc Last minute changes for 1.2
Warnings about non-physical pins, and period specification for
sin/cosine waves in tools
2016-04-10 20:09:12 +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
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
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
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
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
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
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