Skip to content

Commit 6aa55ed

Browse files
committed
Merge branch 'master' of github.com:RPi-Distro/python-gpiozero
Damn, forgot to push the debian/changelog changes after the last release.
2 parents c529c6d + 76b81b3 commit 6aa55ed

File tree

103 files changed

+3725
-1040
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+3725
-1040
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,6 @@ coverage
2727
.coverage
2828
.tox
2929
.cache
30+
31+
# Generated documentation
32+
docs/_build

CONTRIBUTING.md

Lines changed: 0 additions & 44 deletions
This file was deleted.

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
include README.rst
2+
recursive-include tests *.py

README.rst

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,19 @@
22
gpiozero
33
========
44

5-
.. image:: https://badge.fury.io/py/gpiozero.svg
6-
:target: https://badge.fury.io/py/gpiozero
7-
:alt: Latest Version
5+
.. ifconfig:: html_theme == 'sphinx_rtd_theme'
86

9-
.. image:: https://travis-ci.org/RPi-Distro/python-gpiozero.svg?branch=master
10-
:target: https://travis-ci.org/RPi-Distro/python-gpiozero
11-
:alt: Build Tests
7+
.. image:: https://badge.fury.io/py/gpiozero.svg
8+
:target: https://badge.fury.io/py/gpiozero
9+
:alt: Latest Version
10+
11+
.. image:: https://travis-ci.org/RPi-Distro/python-gpiozero.svg?branch=master
12+
:target: https://travis-ci.org/RPi-Distro/python-gpiozero
13+
:alt: Build Tests
14+
15+
.. image:: https://img.shields.io/codecov/c/github/RPi-Distro/python-gpiozero/master.svg?maxAge=2592000
16+
:target: https://codecov.io/github/RPi-Distro/python-gpiozero
17+
:alt: Code Coverage
1218

1319
A simple interface to everyday GPIO components used with Raspberry Pi.
1420

@@ -69,7 +75,7 @@ or::
6975
Documentation
7076
=============
7177

72-
Comprehensive documentation is available at https://gpiozero.readthedocs.org/.
78+
Comprehensive documentation is available at https://gpiozero.readthedocs.io/.
7379

7480
Development
7581
===========
@@ -95,8 +101,8 @@ Contributors
95101
.. _Raspberry Pi Foundation: https://www.raspberrypi.org/
96102
.. _GitHub: https://github.com/RPi-Distro/python-gpiozero
97103
.. _issues: https://github.com/RPi-Distro/python-gpiozero/issues
98-
.. _recipes: http://gpiozero.readthedocs.org/en/latest/recipes.html
99-
.. _Contribute: CONTRIBUTING.md
104+
.. _recipes: http://gpiozero.readthedocs.io/en/latest/recipes.html
105+
.. _contribute: http://gpiozero.readthedocs.io/en/latest/contributing.html
100106
.. _Ben Nuttall: https://github.com/bennuttall
101107
.. _Dave Jones: https://github.com/waveform80
102108
.. _Martin O'Hanlon: https://github.com/martinohanlon

debian/control

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ X-Python3-Version: >= 3.2
1111
Package: python-gpiozero
1212
Architecture: all
1313
Section: python
14-
Depends: ${misc:Depends}, ${python:Depends}, python-rpi.gpio
15-
Suggests: python-spidev, python-gpiozero-docs
14+
Depends: ${misc:Depends}, ${python:Depends}
15+
Recommends: python-rpi.gpio, python-spidev
16+
Suggests: python-gpiozero-docs
1617
Description: Simple API for controlling devices attached to the GPIO pins.
1718
gpiozero builds on RPi.GPIO to provide a set of classes designed to simplify
1819
interaction with devices connected to the GPIO pins, from simple buttons and
@@ -24,8 +25,9 @@ Description: Simple API for controlling devices attached to the GPIO pins.
2425
Package: python3-gpiozero
2526
Architecture: all
2627
Section: python
27-
Depends: ${misc:Depends}, ${python3:Depends}, python3-rpi.gpio
28-
Suggests: python3-spidev, python-gpiozero-docs
28+
Depends: ${misc:Depends}, ${python3:Depends}
29+
Recommends: python3-rpi.gpio, python3-spidev
30+
Suggests: python-gpiozero-docs
2931
Description: Simple API for controlling devices attached to the GPIO pins.
3032
gpiozero builds on RPi.GPIO to provide a set of classes designed to simplify
3133
interaction with devices connected to the GPIO pins, from simple buttons and

docs/api_boards.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,27 @@ LEDBarGraph
2929
:inherited-members:
3030
:members:
3131

32+
ButtonBoard
33+
===========
34+
35+
.. autoclass:: ButtonBoard(\*pins, pull_up=True, bounce_time=None, hold_time=1, hold_repeat=False, \*\*named_pins)
36+
:inherited-members:
37+
:members:
38+
3239
TrafficLights
3340
=============
3441

3542
.. autoclass:: TrafficLights
3643
:inherited-members:
3744
:members:
3845

46+
LedBorg
47+
=======
48+
49+
.. autoclass:: LedBorg
50+
:inherited-members:
51+
:members:
52+
3953
PiLITEr
4054
=======
4155

@@ -106,6 +120,13 @@ Energenie
106120
:inherited-members:
107121
:members:
108122

123+
SnowPi
124+
======
125+
126+
.. autoclass:: SnowPi
127+
:inherited-members:
128+
:members:
129+
109130
Base Classes
110131
============
111132

docs/api_input.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Button
1717
======
1818

1919
.. autoclass:: Button(pin, pull_up=True, bounce_time=None)
20-
:members: wait_for_press, wait_for_release, pin, is_pressed, pull_up, when_pressed, when_released
20+
:members: wait_for_press, wait_for_release, pin, is_pressed, is_held, hold_time, held_time, hold_repeat, pull_up, when_pressed, when_released, when_held
2121

2222

2323
Line Sensor (TRCT5000)

docs/api_other.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ PingServer
2525

2626
.. autoclass:: PingServer
2727

28+
CPUTemperature
29+
==============
30+
31+
.. autoclass:: CPUTemperature
32+
2833
Base Classes
2934
============
3035

docs/api_output.rst

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ PWMLED
2323
======
2424

2525
.. autoclass:: PWMLED(pin, active_high=True, initial_value=0, frequency=100)
26-
:members: on, off, toggle, blink, pin, is_lit, value
26+
:members: on, off, toggle, blink, pulse, pin, is_lit, value
2727

2828
RGBLED
2929
======
3030

31-
.. autoclass:: RGBLED(red, green, blue, active_high=True, initial_value=(0, 0, 0))
32-
:members: on, off, toggle, blink, red, green, blue, is_lit, color
31+
.. autoclass:: RGBLED(red, green, blue, active_high=True, initial_value=(0, 0, 0), pwm=True)
32+
:members: on, off, toggle, blink, pulse, red, green, blue, is_lit, color
3333

3434
Buzzer
3535
======
@@ -40,9 +40,23 @@ Buzzer
4040
Motor
4141
=====
4242

43-
.. autoclass:: Motor(forward, backward)
43+
.. autoclass:: Motor(forward, backward, pwm=True)
4444
:members: forward, backward, stop
4545

46+
Servo
47+
=====
48+
49+
.. autoclass:: Servo(pin, initial_value=0, min_pulse_width=1/1000, max_pulse_width=2/1000, frame_width=20/1000)
50+
:inherited-members:
51+
:members:
52+
53+
AngularServo
54+
============
55+
56+
.. autoclass:: AngularServo(pin, initial_angle=0, min_angle=-90, max_angle=90, min_pulse_width=1/1000, max_pulse_width=2/1000, frame_width=20/1000)
57+
:inherited-members:
58+
:members:
59+
4660
Base Classes
4761
============
4862

docs/api_pins.rst

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,34 +25,38 @@ integer number instead, it uses one of the following classes to provide the
2525
4. :class:`gpiozero.pins.native.NativePin`
2626

2727
You can change the default pin implementation by over-writing the
28-
``DefaultPin`` global in the ``devices`` module like so::
28+
``pin_factory`` global in the ``devices`` module like so::
2929

3030
from gpiozero.pins.native import NativePin
3131
import gpiozero.devices
3232
# Force the default pin implementation to be NativePin
33-
gpiozero.devices.DefaultPin = NativePin
33+
gpiozero.devices.pin_factory = NativePin
3434

3535
from gpiozero import LED
3636

3737
# This will now use NativePin instead of RPiGPIOPin
3838
led = LED(16)
3939

40-
Alternatively, instead of passing an integer to the device constructor, you
41-
can pass a :class:`Pin` object itself::
40+
``pin_factory`` is a concrete descendent of the abstract :class:`Pin` class.
41+
The descendent may take additional parameters in its constructor provided they
42+
are optional; GPIO Zero will expect to be able to construct instances with
43+
nothing more than an integer pin number.
4244

43-
from gpiozero.pins.native import NativePin
44-
from gpiozero import LED
45+
However, the descendent may take default information from additional sources.
46+
For example, to default to creating pins with
47+
:class:`gpiozero.pins.pigpiod.PiGPIOPin` on a remote pi called ``remote-pi``
48+
you can set the :envvar:`PIGPIO_ADDR` environment variable when running your
49+
script::
4550

46-
led = LED(NativePin(16))
51+
$ PIGPIO_ADDR=remote-pi python my_script.py
4752

48-
This is particularly useful with implementations that can take extra parameters
49-
such as :class:`~gpiozero.pins.pigpiod.PiGPIOPin` which can address pins on
50-
remote machines::
53+
It is worth noting that instead of passing an integer to device constructors,
54+
you can pass an object derived from :class:`Pin` itself::
5155

52-
from gpiozero.pins.pigpiod import PiGPIOPin
56+
from gpiozero.pins.native import NativePin
5357
from gpiozero import LED
5458

55-
led = LED(PiGPIOPin(16, host='my_other_pi'))
59+
led = LED(NativePin(16))
5660

5761
In future, this separation of pins and devices should also permit the library
5862
to utilize pins that are part of IO extender chips. For example::
@@ -110,6 +114,13 @@ Abstract Pin
110114
:members:
111115

112116

117+
Local Pin
118+
=========
119+
120+
.. autoclass:: LocalPin
121+
:members:
122+
123+
113124
Utilities
114125
=========
115126

0 commit comments

Comments
 (0)