Add support for the Pi-Stop Traffic-light board

This commit is contained in:
Andrew Scheller
2016-09-18 16:45:53 +01:00
parent 322ec1316a
commit c35741c793
8 changed files with 123 additions and 31 deletions

View File

@@ -71,6 +71,13 @@ PI-TRAFFIC
:inherited-members: :inherited-members:
:members: :members:
Pi-Stop
=======
.. autoclass:: PiStop
:inherited-members:
:members:
TrafficLightsBuzzer TrafficLightsBuzzer
=================== ===================

View File

@@ -25,6 +25,7 @@ digraph classes {
PiLiterBarGraph->LEDBarGraph; PiLiterBarGraph->LEDBarGraph;
TrafficLights->LEDBoard; TrafficLights->LEDBoard;
PiTraffic->TrafficLights; PiTraffic->TrafficLights;
PiStop->TrafficLights;
TrafficLightsBuzzer->CompositeOutputDevice; TrafficLightsBuzzer->CompositeOutputDevice;
FishDish->TrafficLightsBuzzer; FishDish->TrafficLightsBuzzer;
TrafficHat->TrafficLightsBuzzer; TrafficHat->TrafficLightsBuzzer;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View File

@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.38.0 (20140413.2041) <!-- Generated by graphviz version 2.36.0 (20140111.2315)
--> -->
<!-- Title: classes Pages: 1 --> <!-- Title: classes Pages: 1 -->
<svg width="733pt" height="476pt" <svg width="733pt" height="476pt"
viewBox="0.00 0.00 732.50 476.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> viewBox="0.00 0.00 733.00 476.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 472)"> <g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 472)">
<title>classes</title> <title>classes</title>
<polygon fill="white" stroke="none" points="-4,4 -4,-472 728.5,-472 728.5,4 -4,4"/> <polygon fill="white" stroke="none" points="-4,4 -4,-472 729,-472 729,4 -4,4"/>
<!-- Device --> <!-- Device -->
<g id="node1" class="node"><title>Device</title> <g id="node1" class="node"><title>Device</title>
<polygon fill="#9ec6e0" stroke="#9ec6e0" points="607,-468 553,-468 553,-432 607,-432 607,-468"/> <polygon fill="#9ec6e0" stroke="#9ec6e0" points="607,-468 553,-468 553,-432 607,-432 607,-468"/>
@@ -31,8 +31,8 @@
</g> </g>
<!-- CompositeOutputDevice&#45;&gt;CompositeDevice --> <!-- CompositeOutputDevice&#45;&gt;CompositeDevice -->
<g id="edge2" class="edge"><title>CompositeOutputDevice&#45;&gt;CompositeDevice</title> <g id="edge2" class="edge"><title>CompositeOutputDevice&#45;&gt;CompositeDevice</title>
<path fill="none" stroke="black" d="M362.023,-324.034C394.498,-334.274 435.899,-347.328 469.472,-357.915"/> <path fill="none" stroke="black" d="M362.023,-324.034C394.615,-334.311 436.197,-347.422 469.834,-358.029"/>
<polygon fill="black" stroke="black" points="468.58,-361.303 479.17,-360.972 470.685,-354.627 468.58,-361.303"/> <polygon fill="black" stroke="black" points="468.958,-361.422 479.547,-361.091 471.063,-354.746 468.958,-361.422"/>
</g> </g>
<!-- LEDCollection --> <!-- LEDCollection -->
<g id="node4" class="node"><title>LEDCollection</title> <g id="node4" class="node"><title>LEDCollection</title>
@@ -96,121 +96,131 @@
</g> </g>
<!-- PiTraffic --> <!-- PiTraffic -->
<g id="node10" class="node"><title>PiTraffic</title> <g id="node10" class="node"><title>PiTraffic</title>
<polygon fill="#2980b9" stroke="#2980b9" points="135,-36 81,-36 81,-0 135,-0 135,-36"/> <polygon fill="#2980b9" stroke="#2980b9" points="99,-36 45,-36 45,-0 99,-0 99,-36"/>
<text text-anchor="middle" x="108" y="-15.5" font-family="Sans" font-size="10.00" fill="#ffffff">PiTraffic</text> <text text-anchor="middle" x="72" y="-15.5" font-family="Sans" font-size="10.00" fill="#ffffff">PiTraffic</text>
</g> </g>
<!-- PiTraffic&#45;&gt;TrafficLights --> <!-- PiTraffic&#45;&gt;TrafficLights -->
<g id="edge9" class="edge"><title>PiTraffic&#45;&gt;TrafficLights</title> <g id="edge9" class="edge"><title>PiTraffic&#45;&gt;TrafficLights</title>
<path fill="none" stroke="black" d="M108,-36.3034C108,-44.0173 108,-53.2875 108,-61.8876"/> <path fill="none" stroke="black" d="M80.8989,-36.3034C84.9968,-44.2716 89.9488,-53.9005 94.4927,-62.7359"/>
<polygon fill="black" stroke="black" points="104.5,-61.8956 108,-71.8957 111.5,-61.8957 104.5,-61.8956"/> <polygon fill="black" stroke="black" points="91.5174,-64.6035 99.2035,-71.8957 97.7425,-61.402 91.5174,-64.6035"/>
</g>
<!-- PiStop -->
<g id="node11" class="node"><title>PiStop</title>
<polygon fill="#2980b9" stroke="#2980b9" points="171,-36 117,-36 117,-0 171,-0 171,-36"/>
<text text-anchor="middle" x="144" y="-15.5" font-family="Sans" font-size="10.00" fill="#ffffff">PiStop</text>
</g>
<!-- PiStop&#45;&gt;TrafficLights -->
<g id="edge10" class="edge"><title>PiStop&#45;&gt;TrafficLights</title>
<path fill="none" stroke="black" d="M135.101,-36.3034C131.003,-44.2716 126.051,-53.9005 121.507,-62.7359"/>
<polygon fill="black" stroke="black" points="118.258,-61.402 116.797,-71.8957 124.483,-64.6035 118.258,-61.402"/>
</g> </g>
<!-- TrafficLightsBuzzer --> <!-- TrafficLightsBuzzer -->
<g id="node11" class="node"><title>TrafficLightsBuzzer</title> <g id="node12" class="node"><title>TrafficLightsBuzzer</title>
<polygon fill="#2980b9" stroke="#2980b9" points="360.5,-252 255.5,-252 255.5,-216 360.5,-216 360.5,-252"/> <polygon fill="#2980b9" stroke="#2980b9" points="360.5,-252 255.5,-252 255.5,-216 360.5,-216 360.5,-252"/>
<text text-anchor="middle" x="308" y="-231.5" font-family="Sans" font-size="10.00" fill="#ffffff">TrafficLightsBuzzer</text> <text text-anchor="middle" x="308" y="-231.5" font-family="Sans" font-size="10.00" fill="#ffffff">TrafficLightsBuzzer</text>
</g> </g>
<!-- TrafficLightsBuzzer&#45;&gt;CompositeOutputDevice --> <!-- TrafficLightsBuzzer&#45;&gt;CompositeOutputDevice -->
<g id="edge10" class="edge"><title>TrafficLightsBuzzer&#45;&gt;CompositeOutputDevice</title> <g id="edge11" class="edge"><title>TrafficLightsBuzzer&#45;&gt;CompositeOutputDevice</title>
<path fill="none" stroke="black" d="M308,-252.303C308,-260.017 308,-269.288 308,-277.888"/> <path fill="none" stroke="black" d="M308,-252.303C308,-260.017 308,-269.288 308,-277.888"/>
<polygon fill="black" stroke="black" points="304.5,-277.896 308,-287.896 311.5,-277.896 304.5,-277.896"/> <polygon fill="black" stroke="black" points="304.5,-277.896 308,-287.896 311.5,-277.896 304.5,-277.896"/>
</g> </g>
<!-- FishDish --> <!-- FishDish -->
<g id="node12" class="node"><title>FishDish</title> <g id="node13" class="node"><title>FishDish</title>
<polygon fill="#2980b9" stroke="#2980b9" points="324,-180 268,-180 268,-144 324,-144 324,-180"/> <polygon fill="#2980b9" stroke="#2980b9" points="324,-180 268,-180 268,-144 324,-144 324,-180"/>
<text text-anchor="middle" x="296" y="-159.5" font-family="Sans" font-size="10.00" fill="#ffffff">FishDish</text> <text text-anchor="middle" x="296" y="-159.5" font-family="Sans" font-size="10.00" fill="#ffffff">FishDish</text>
</g> </g>
<!-- FishDish&#45;&gt;TrafficLightsBuzzer --> <!-- FishDish&#45;&gt;TrafficLightsBuzzer -->
<g id="edge11" class="edge"><title>FishDish&#45;&gt;TrafficLightsBuzzer</title> <g id="edge12" class="edge"><title>FishDish&#45;&gt;TrafficLightsBuzzer</title>
<path fill="none" stroke="black" d="M298.966,-180.303C300.289,-188.017 301.878,-197.288 303.352,-205.888"/> <path fill="none" stroke="black" d="M298.966,-180.303C300.289,-188.017 301.878,-197.288 303.352,-205.888"/>
<polygon fill="black" stroke="black" points="299.928,-206.631 305.068,-215.896 306.828,-205.448 299.928,-206.631"/> <polygon fill="black" stroke="black" points="299.928,-206.631 305.068,-215.896 306.828,-205.448 299.928,-206.631"/>
</g> </g>
<!-- TrafficHat --> <!-- TrafficHat -->
<g id="node13" class="node"><title>TrafficHat</title> <g id="node14" class="node"><title>TrafficHat</title>
<polygon fill="#2980b9" stroke="#2980b9" points="403.5,-180 342.5,-180 342.5,-144 403.5,-144 403.5,-180"/> <polygon fill="#2980b9" stroke="#2980b9" points="403.5,-180 342.5,-180 342.5,-144 403.5,-144 403.5,-180"/>
<text text-anchor="middle" x="373" y="-159.5" font-family="Sans" font-size="10.00" fill="#ffffff">TrafficHat</text> <text text-anchor="middle" x="373" y="-159.5" font-family="Sans" font-size="10.00" fill="#ffffff">TrafficHat</text>
</g> </g>
<!-- TrafficHat&#45;&gt;TrafficLightsBuzzer --> <!-- TrafficHat&#45;&gt;TrafficLightsBuzzer -->
<g id="edge12" class="edge"><title>TrafficHat&#45;&gt;TrafficLightsBuzzer</title> <g id="edge13" class="edge"><title>TrafficHat&#45;&gt;TrafficLightsBuzzer</title>
<path fill="none" stroke="black" d="M356.933,-180.303C349.061,-188.78 339.445,-199.136 330.827,-208.417"/> <path fill="none" stroke="black" d="M356.933,-180.303C349.061,-188.78 339.445,-199.136 330.827,-208.417"/>
<polygon fill="black" stroke="black" points="328.122,-206.186 323.883,-215.896 333.252,-210.949 328.122,-206.186"/> <polygon fill="black" stroke="black" points="328.122,-206.186 323.883,-215.896 333.252,-210.949 328.122,-206.186"/>
</g> </g>
<!-- Robot --> <!-- Robot -->
<g id="node14" class="node"><title>Robot</title> <g id="node15" class="node"><title>Robot</title>
<polygon fill="#2980b9" stroke="#2980b9" points="485,-324 431,-324 431,-288 485,-288 485,-324"/> <polygon fill="#2980b9" stroke="#2980b9" points="485,-324 431,-324 431,-288 485,-288 485,-324"/>
<text text-anchor="middle" x="458" y="-303.5" font-family="Sans" font-size="10.00" fill="#ffffff">Robot</text> <text text-anchor="middle" x="458" y="-303.5" font-family="Sans" font-size="10.00" fill="#ffffff">Robot</text>
</g> </g>
<!-- Robot&#45;&gt;CompositeDevice --> <!-- Robot&#45;&gt;CompositeDevice -->
<g id="edge13" class="edge"><title>Robot&#45;&gt;CompositeDevice</title> <g id="edge14" class="edge"><title>Robot&#45;&gt;CompositeDevice</title>
<path fill="none" stroke="black" d="M475.798,-324.303C484.604,-332.865 495.382,-343.344 505.001,-352.696"/> <path fill="none" stroke="black" d="M475.798,-324.303C484.604,-332.865 495.382,-343.344 505.001,-352.696"/>
<polygon fill="black" stroke="black" points="502.797,-355.434 512.407,-359.896 507.677,-350.415 502.797,-355.434"/> <polygon fill="black" stroke="black" points="502.797,-355.434 512.407,-359.896 507.677,-350.415 502.797,-355.434"/>
</g> </g>
<!-- RyanteckRobot --> <!-- RyanteckRobot -->
<g id="node15" class="node"><title>RyanteckRobot</title> <g id="node16" class="node"><title>RyanteckRobot</title>
<polygon fill="#2980b9" stroke="#2980b9" points="465,-252 379,-252 379,-216 465,-216 465,-252"/> <polygon fill="#2980b9" stroke="#2980b9" points="465,-252 379,-252 379,-216 465,-216 465,-252"/>
<text text-anchor="middle" x="422" y="-231.5" font-family="Sans" font-size="10.00" fill="#ffffff">RyanteckRobot</text> <text text-anchor="middle" x="422" y="-231.5" font-family="Sans" font-size="10.00" fill="#ffffff">RyanteckRobot</text>
</g> </g>
<!-- RyanteckRobot&#45;&gt;Robot --> <!-- RyanteckRobot&#45;&gt;Robot -->
<g id="edge14" class="edge"><title>RyanteckRobot&#45;&gt;Robot</title> <g id="edge15" class="edge"><title>RyanteckRobot&#45;&gt;Robot</title>
<path fill="none" stroke="black" d="M430.899,-252.303C434.997,-260.272 439.949,-269.9 444.493,-278.736"/> <path fill="none" stroke="black" d="M430.899,-252.303C434.997,-260.272 439.949,-269.9 444.493,-278.736"/>
<polygon fill="black" stroke="black" points="441.517,-280.604 449.203,-287.896 447.742,-277.402 441.517,-280.604"/> <polygon fill="black" stroke="black" points="441.517,-280.604 449.203,-287.896 447.742,-277.402 441.517,-280.604"/>
</g> </g>
<!-- CamJamKitRobot --> <!-- CamJamKitRobot -->
<g id="node16" class="node"><title>CamJamKitRobot</title> <g id="node17" class="node"><title>CamJamKitRobot</title>
<polygon fill="#2980b9" stroke="#2980b9" points="579,-252 483,-252 483,-216 579,-216 579,-252"/> <polygon fill="#2980b9" stroke="#2980b9" points="579,-252 483,-252 483,-216 579,-216 579,-252"/>
<text text-anchor="middle" x="531" y="-231.5" font-family="Sans" font-size="10.00" fill="#ffffff">CamJamKitRobot</text> <text text-anchor="middle" x="531" y="-231.5" font-family="Sans" font-size="10.00" fill="#ffffff">CamJamKitRobot</text>
</g> </g>
<!-- CamJamKitRobot&#45;&gt;Robot --> <!-- CamJamKitRobot&#45;&gt;Robot -->
<g id="edge15" class="edge"><title>CamJamKitRobot&#45;&gt;Robot</title> <g id="edge16" class="edge"><title>CamJamKitRobot&#45;&gt;Robot</title>
<path fill="none" stroke="black" d="M512.955,-252.303C503.938,-260.95 492.882,-271.551 483.057,-280.973"/> <path fill="none" stroke="black" d="M512.955,-252.303C503.938,-260.95 492.882,-271.551 483.057,-280.973"/>
<polygon fill="black" stroke="black" points="480.633,-278.448 475.837,-287.896 485.478,-283.501 480.633,-278.448"/> <polygon fill="black" stroke="black" points="480.633,-278.448 475.837,-287.896 485.478,-283.501 480.633,-278.448"/>
</g> </g>
<!-- Motor --> <!-- Motor -->
<g id="node17" class="node"><title>Motor</title> <g id="node18" class="node"><title>Motor</title>
<polygon fill="#2980b9" stroke="#2980b9" points="557,-324 503,-324 503,-288 557,-288 557,-324"/> <polygon fill="#2980b9" stroke="#2980b9" points="557,-324 503,-324 503,-288 557,-288 557,-324"/>
<text text-anchor="middle" x="530" y="-303.5" font-family="Sans" font-size="10.00" fill="#ffffff">Motor</text> <text text-anchor="middle" x="530" y="-303.5" font-family="Sans" font-size="10.00" fill="#ffffff">Motor</text>
</g> </g>
<!-- Motor&#45;&gt;CompositeDevice --> <!-- Motor&#45;&gt;CompositeDevice -->
<g id="edge16" class="edge"><title>Motor&#45;&gt;CompositeDevice</title> <g id="edge17" class="edge"><title>Motor&#45;&gt;CompositeDevice</title>
<path fill="none" stroke="black" d="M530,-324.303C530,-332.017 530,-341.288 530,-349.888"/> <path fill="none" stroke="black" d="M530,-324.303C530,-332.017 530,-341.288 530,-349.888"/>
<polygon fill="black" stroke="black" points="526.5,-349.896 530,-359.896 533.5,-349.896 526.5,-349.896"/> <polygon fill="black" stroke="black" points="526.5,-349.896 530,-359.896 533.5,-349.896 526.5,-349.896"/>
</g> </g>
<!-- Servo --> <!-- Servo -->
<g id="node18" class="node"><title>Servo</title> <g id="node19" class="node"><title>Servo</title>
<polygon fill="#2980b9" stroke="#2980b9" points="629,-324 575,-324 575,-288 629,-288 629,-324"/> <polygon fill="#2980b9" stroke="#2980b9" points="629,-324 575,-324 575,-288 629,-288 629,-324"/>
<text text-anchor="middle" x="602" y="-303.5" font-family="Sans" font-size="10.00" fill="#ffffff">Servo</text> <text text-anchor="middle" x="602" y="-303.5" font-family="Sans" font-size="10.00" fill="#ffffff">Servo</text>
</g> </g>
<!-- Servo&#45;&gt;CompositeDevice --> <!-- Servo&#45;&gt;CompositeDevice -->
<g id="edge17" class="edge"><title>Servo&#45;&gt;CompositeDevice</title> <g id="edge18" class="edge"><title>Servo&#45;&gt;CompositeDevice</title>
<path fill="none" stroke="black" d="M584.202,-324.303C575.396,-332.865 564.618,-343.344 554.999,-352.696"/> <path fill="none" stroke="black" d="M584.202,-324.303C575.396,-332.865 564.618,-343.344 554.999,-352.696"/>
<polygon fill="black" stroke="black" points="552.323,-350.415 547.593,-359.896 557.203,-355.434 552.323,-350.415"/> <polygon fill="black" stroke="black" points="552.323,-350.415 547.593,-359.896 557.203,-355.434 552.323,-350.415"/>
</g> </g>
<!-- AngularServo --> <!-- AngularServo -->
<g id="node19" class="node"><title>AngularServo</title> <g id="node20" class="node"><title>AngularServo</title>
<polygon fill="#2980b9" stroke="#2980b9" points="678.5,-252 597.5,-252 597.5,-216 678.5,-216 678.5,-252"/> <polygon fill="#2980b9" stroke="#2980b9" points="678.5,-252 597.5,-252 597.5,-216 678.5,-216 678.5,-252"/>
<text text-anchor="middle" x="638" y="-231.5" font-family="Sans" font-size="10.00" fill="#ffffff">AngularServo</text> <text text-anchor="middle" x="638" y="-231.5" font-family="Sans" font-size="10.00" fill="#ffffff">AngularServo</text>
</g> </g>
<!-- AngularServo&#45;&gt;Servo --> <!-- AngularServo&#45;&gt;Servo -->
<g id="edge18" class="edge"><title>AngularServo&#45;&gt;Servo</title> <g id="edge19" class="edge"><title>AngularServo&#45;&gt;Servo</title>
<path fill="none" stroke="black" d="M629.101,-252.303C625.003,-260.272 620.051,-269.9 615.507,-278.736"/> <path fill="none" stroke="black" d="M629.101,-252.303C625.003,-260.272 620.051,-269.9 615.507,-278.736"/>
<polygon fill="black" stroke="black" points="612.258,-277.402 610.797,-287.896 618.483,-280.604 612.258,-277.402"/> <polygon fill="black" stroke="black" points="612.258,-277.402 610.797,-287.896 618.483,-280.604 612.258,-277.402"/>
</g> </g>
<!-- Energenie --> <!-- Energenie -->
<g id="node20" class="node"><title>Energenie</title> <g id="node21" class="node"><title>Energenie</title>
<polygon fill="#2980b9" stroke="#2980b9" points="663.5,-396 598.5,-396 598.5,-360 663.5,-360 663.5,-396"/> <polygon fill="#2980b9" stroke="#2980b9" points="663.5,-396 598.5,-396 598.5,-360 663.5,-360 663.5,-396"/>
<text text-anchor="middle" x="631" y="-375.5" font-family="Sans" font-size="10.00" fill="#ffffff">Energenie</text> <text text-anchor="middle" x="631" y="-375.5" font-family="Sans" font-size="10.00" fill="#ffffff">Energenie</text>
</g> </g>
<!-- Energenie&#45;&gt;Device --> <!-- Energenie&#45;&gt;Device -->
<g id="edge19" class="edge"><title>Energenie&#45;&gt;Device</title> <g id="edge20" class="edge"><title>Energenie&#45;&gt;Device</title>
<path fill="none" stroke="black" d="M618.393,-396.303C612.403,-404.526 605.124,-414.517 598.521,-423.579"/> <path fill="none" stroke="black" d="M618.393,-396.303C612.403,-404.526 605.124,-414.517 598.521,-423.579"/>
<polygon fill="black" stroke="black" points="595.522,-421.752 592.462,-431.896 601.179,-425.874 595.522,-421.752"/> <polygon fill="black" stroke="black" points="595.522,-421.752 592.462,-431.896 601.179,-425.874 595.522,-421.752"/>
</g> </g>
<!-- ButtonBoard --> <!-- ButtonBoard -->
<g id="node21" class="node"><title>ButtonBoard</title> <g id="node22" class="node"><title>ButtonBoard</title>
<polygon fill="#2980b9" stroke="#2980b9" points="724.5,-324 647.5,-324 647.5,-288 724.5,-288 724.5,-324"/> <polygon fill="#2980b9" stroke="#2980b9" points="724.5,-324 647.5,-324 647.5,-288 724.5,-288 724.5,-324"/>
<text text-anchor="middle" x="686" y="-303.5" font-family="Sans" font-size="10.00" fill="#ffffff">ButtonBoard</text> <text text-anchor="middle" x="686" y="-303.5" font-family="Sans" font-size="10.00" fill="#ffffff">ButtonBoard</text>
</g> </g>
<!-- ButtonBoard&#45;&gt;CompositeDevice --> <!-- ButtonBoard&#45;&gt;CompositeDevice -->
<g id="edge20" class="edge"><title>ButtonBoard&#45;&gt;CompositeDevice</title> <g id="edge21" class="edge"><title>ButtonBoard&#45;&gt;CompositeDevice</title>
<path fill="none" stroke="black" d="M647.838,-324.124C626.607,-333.651 599.992,-345.593 577.431,-355.717"/> <path fill="none" stroke="black" d="M647.838,-324.124C626.607,-333.651 599.992,-345.593 577.431,-355.717"/>
<polygon fill="black" stroke="black" points="575.729,-352.644 568.038,-359.932 578.594,-359.031 575.729,-352.644"/> <polygon fill="black" stroke="black" points="575.729,-352.644 568.038,-359.932 578.594,-359.031 575.729,-352.644"/>
</g> </g>

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -116,6 +116,7 @@ from .boards import (
PiLiterBarGraph, PiLiterBarGraph,
TrafficLights, TrafficLights,
PiTraffic, PiTraffic,
PiStop,
SnowPi, SnowPi,
TrafficLightsBuzzer, TrafficLightsBuzzer,
FishDish, FishDish,

View File

@@ -753,6 +753,55 @@ class PiTraffic(TrafficLights):
pwm=pwm, initial_value=initial_value) pwm=pwm, initial_value=initial_value)
class PiStop(TrafficLights):
"""
Extends :class:`TrafficLights` for the `PiHardware Pi-Stop`_: a vertical
traffic lights board.
The following example turns on the amber LED on a Pi-Stop
connected to location ``A+``::
from gpiozero import PiStop
traffic = PiStop('A+')
traffic.amber.on()
:param str location:
The `location`_ on the GPIO header to which the Pi-Stop is connected.
Must be one of: ``A``, ``A+``, ``B``, ``B+``, ``C``, ``D``.
:param bool pwm:
If ``True``, construct :class:`PWMLED` instances to represent each
LED. If ``False`` (the default), construct regular :class:`LED`
instances.
:param bool initial_value:
If ``False`` (the default), all LEDs will be off initially. If
``None``, each device will be left in whatever state the pin is found
in when configured for output (warning: this can be on). If ``True``,
the device will be switched on initially.
.. _PiHardware Pi-Stop: https://pihw.wordpress.com/meltwaters-pi-hardware-kits/pi-stop/
.. _location: https://github.com/PiHw/Pi-Stop/blob/master/markdown_source/markdown/Discover-PiStop.md
"""
LOCATIONS = {
'A': (7, 8, 25),
'A+': (21, 20, 16),
'B': (10, 9, 11),
'B+': (13, 19, 26),
'C': (18, 15, 14),
'D': (2, 3, 4),
}
def __init__(self, location=None, pwm=False, initial_value=False):
gpios = self.LOCATIONS.get(location, None)
if gpios is None:
raise ValueError('location must be one of: %s' %
', '.join(sorted(self.LOCATIONS.keys())))
super(PiStop, self).__init__(*gpios,
pwm=pwm, initial_value=initial_value)
class SnowPi(LEDBoard): class SnowPi(LEDBoard):
""" """
Extends :class:`LEDBoard` for the `Ryanteck SnowPi`_ board. Extends :class:`LEDBoard` for the `Ryanteck SnowPi`_ board.

View File

@@ -580,6 +580,30 @@ def test_pi_traffic():
with PiTraffic() as board: with PiTraffic() as board:
assert [device.pin for device in board] == pins assert [device.pin for device in board] == pins
def test_pi_stop():
with pytest.raises(ValueError):
PiStop()
with pytest.raises(ValueError):
PiStop('E')
pins_a = [MockPin(n) for n in (7, 8, 25)]
with PiStop('A') as board:
assert [device.pin for device in board] == pins_a
pins_aplus = [MockPin(n) for n in (21, 20, 16)]
with PiStop('A+') as board:
assert [device.pin for device in board] == pins_aplus
pins_b = [MockPin(n) for n in (10, 9, 11)]
with PiStop('B') as board:
assert [device.pin for device in board] == pins_b
pins_bplus = [MockPin(n) for n in (13, 19, 26)]
with PiStop('B+') as board:
assert [device.pin for device in board] == pins_bplus
pins_c = [MockPin(n) for n in (18, 15, 14)]
with PiStop('C') as board:
assert [device.pin for device in board] == pins_c
pins_d = [MockPin(n) for n in (2, 3, 4)]
with PiStop('D') as board:
assert [device.pin for device in board] == pins_d
def test_snow_pi(): def test_snow_pi():
pins = [MockPin(n) for n in (23, 24, 25, 17, 18, 22, 7, 8, 9)] pins = [MockPin(n) for n in (23, 24, 25, 17, 18, 22, 7, 8, 9)]
with SnowPi() as board: with SnowPi() as board: