mirror of
				https://github.com/KevinMidboe/python-gpiozero.git
				synced 2025-10-29 17:50:37 +00:00 
			
		
		
		
	Me and my big mouth. No sooner do I declare the base classes "relatively stable" than I go and mess around with it all again. Anyway, this is the long promised set of utilities to make source/values more interesting. It includes a few interesting little utility functions, a whole bunch of examples and introduces the notion of "pseudo" devices with no (obvious) hardware representation like a time-of-day device. This necessitated making the event system a little more generic (it's not exclusive the GPIO devices after all; no reason we can't use it on composite devices in future) and by this point the mixins have gotten large enough to justify their own module. The pseudo-devices are a bit spartan and basic at the moment but I'm sure there'll be plenty of future ideas...
		
			
				
	
	
		
			169 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
			
		
		
	
	
			169 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
| <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 | |
| <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
 | |
|  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
 | |
| <!-- Generated by graphviz version 2.36.0 (20140111.2315)
 | |
|  -->
 | |
| <!-- Title: classes Pages: 1 -->
 | |
| <svg width="721pt" height="332pt"
 | |
|  viewBox="0.00 0.00 721.00 332.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 328)">
 | |
| <title>classes</title>
 | |
| <polygon fill="white" stroke="none" points="-4,4 -4,-328 717,-328 717,4 -4,4"/>
 | |
| <!-- Device -->
 | |
| <g id="node1" class="node"><title>Device</title>
 | |
| <polygon fill="#9ec6e0" stroke="#9ec6e0" points="499,-324 445,-324 445,-288 499,-288 499,-324"/>
 | |
| <text text-anchor="middle" x="472" y="-303.5" font-family="Sans" font-size="10.00" fill="#000000">Device</text>
 | |
| </g>
 | |
| <!-- GPIODevice -->
 | |
| <g id="node2" class="node"><title>GPIODevice</title>
 | |
| <polygon fill="#9ec6e0" stroke="#9ec6e0" points="508,-252 436,-252 436,-216 508,-216 508,-252"/>
 | |
| <text text-anchor="middle" x="472" y="-231.5" font-family="Sans" font-size="10.00" fill="#000000">GPIODevice</text>
 | |
| </g>
 | |
| <!-- GPIODevice->Device -->
 | |
| <g id="edge1" class="edge"><title>GPIODevice->Device</title>
 | |
| <path fill="none" stroke="black" d="M472,-252.303C472,-260.017 472,-269.288 472,-277.888"/>
 | |
| <polygon fill="black" stroke="black" points="468.5,-277.896 472,-287.896 475.5,-277.896 468.5,-277.896"/>
 | |
| </g>
 | |
| <!-- SmoothedInputDevice -->
 | |
| <g id="node3" class="node"><title>SmoothedInputDevice</title>
 | |
| <polygon fill="#9ec6e0" stroke="#9ec6e0" points="289.5,-108 166.5,-108 166.5,-72 289.5,-72 289.5,-108"/>
 | |
| <text text-anchor="middle" x="228" y="-87.5" font-family="Sans" font-size="10.00" fill="#000000">SmoothedInputDevice</text>
 | |
| </g>
 | |
| <!-- InputDevice -->
 | |
| <g id="node4" class="node"><title>InputDevice</title>
 | |
| <polygon fill="#2980b9" stroke="#2980b9" points="445.5,-180 372.5,-180 372.5,-144 445.5,-144 445.5,-180"/>
 | |
| <text text-anchor="middle" x="409" y="-159.5" font-family="Sans" font-size="10.00" fill="#ffffff">InputDevice</text>
 | |
| </g>
 | |
| <!-- SmoothedInputDevice->InputDevice -->
 | |
| <g id="edge4" class="edge"><title>SmoothedInputDevice->InputDevice</title>
 | |
| <path fill="none" stroke="black" d="M272.278,-108.124C299.802,-118.769 335.123,-132.429 362.97,-143.198"/>
 | |
| <polygon fill="black" stroke="black" points="361.893,-146.535 372.483,-146.877 364.418,-140.006 361.893,-146.535"/>
 | |
| </g>
 | |
| <!-- InputDevice->GPIODevice -->
 | |
| <g id="edge2" class="edge"><title>InputDevice->GPIODevice</title>
 | |
| <path fill="none" stroke="black" d="M424.573,-180.303C432.202,-188.78 441.523,-199.136 449.876,-208.417"/>
 | |
| <polygon fill="black" stroke="black" points="447.315,-210.804 456.606,-215.896 452.518,-206.121 447.315,-210.804"/>
 | |
| </g>
 | |
| <!-- DigitalInputDevice -->
 | |
| <g id="node5" class="node"><title>DigitalInputDevice</title>
 | |
| <polygon fill="#2980b9" stroke="#2980b9" points="460.5,-108 357.5,-108 357.5,-72 460.5,-72 460.5,-108"/>
 | |
| <text text-anchor="middle" x="409" y="-87.5" font-family="Sans" font-size="10.00" fill="#ffffff">DigitalInputDevice</text>
 | |
| </g>
 | |
| <!-- DigitalInputDevice->InputDevice -->
 | |
| <g id="edge3" class="edge"><title>DigitalInputDevice->InputDevice</title>
 | |
| <path fill="none" stroke="black" d="M409,-108.303C409,-116.017 409,-125.288 409,-133.888"/>
 | |
| <polygon fill="black" stroke="black" points="405.5,-133.896 409,-143.896 412.5,-133.896 405.5,-133.896"/>
 | |
| </g>
 | |
| <!-- Button -->
 | |
| <g id="node6" class="node"><title>Button</title>
 | |
| <polygon fill="#2980b9" stroke="#2980b9" points="445,-36 391,-36 391,-0 445,-0 445,-36"/>
 | |
| <text text-anchor="middle" x="418" y="-15.5" font-family="Sans" font-size="10.00" fill="#ffffff">Button</text>
 | |
| </g>
 | |
| <!-- Button->DigitalInputDevice -->
 | |
| <g id="edge5" class="edge"><title>Button->DigitalInputDevice</title>
 | |
| <path fill="none" stroke="black" d="M415.775,-36.3034C414.783,-44.0173 413.592,-53.2875 412.486,-61.8876"/>
 | |
| <polygon fill="black" stroke="black" points="409.003,-61.531 411.199,-71.8957 415.946,-62.4237 409.003,-61.531"/>
 | |
| </g>
 | |
| <!-- MotionSensor -->
 | |
| <g id="node7" class="node"><title>MotionSensor</title>
 | |
| <polygon fill="#2980b9" stroke="#2980b9" points="82.5,-36 -0.5,-36 -0.5,-0 82.5,-0 82.5,-36"/>
 | |
| <text text-anchor="middle" x="41" y="-15.5" font-family="Sans" font-size="10.00" fill="#ffffff">MotionSensor</text>
 | |
| </g>
 | |
| <!-- MotionSensor->SmoothedInputDevice -->
 | |
| <g id="edge6" class="edge"><title>MotionSensor->SmoothedInputDevice</title>
 | |
| <path fill="none" stroke="black" d="M82.5014,-34.5353C109.086,-44.4869 143.895,-57.5168 172.8,-68.3368"/>
 | |
| <polygon fill="black" stroke="black" points="171.763,-71.6859 182.356,-71.9139 174.217,-65.1302 171.763,-71.6859"/>
 | |
| </g>
 | |
| <!-- LightSensor -->
 | |
| <g id="node8" class="node"><title>LightSensor</title>
 | |
| <polygon fill="#2980b9" stroke="#2980b9" points="175,-36 101,-36 101,-0 175,-0 175,-36"/>
 | |
| <text text-anchor="middle" x="138" y="-15.5" font-family="Sans" font-size="10.00" fill="#ffffff">LightSensor</text>
 | |
| </g>
 | |
| <!-- LightSensor->SmoothedInputDevice -->
 | |
| <g id="edge7" class="edge"><title>LightSensor->SmoothedInputDevice</title>
 | |
| <path fill="none" stroke="black" d="M160.247,-36.3034C171.582,-45.1193 185.53,-55.9679 197.819,-65.5258"/>
 | |
| <polygon fill="black" stroke="black" points="195.966,-68.519 206.009,-71.8957 200.264,-62.9935 195.966,-68.519"/>
 | |
| </g>
 | |
| <!-- LineSensor -->
 | |
| <g id="node9" class="node"><title>LineSensor</title>
 | |
| <polygon fill="#2980b9" stroke="#2980b9" points="263,-36 193,-36 193,-0 263,-0 263,-36"/>
 | |
| <text text-anchor="middle" x="228" y="-15.5" font-family="Sans" font-size="10.00" fill="#ffffff">LineSensor</text>
 | |
| </g>
 | |
| <!-- LineSensor->SmoothedInputDevice -->
 | |
| <g id="edge8" class="edge"><title>LineSensor->SmoothedInputDevice</title>
 | |
| <path fill="none" stroke="black" d="M228,-36.3034C228,-44.0173 228,-53.2875 228,-61.8876"/>
 | |
| <polygon fill="black" stroke="black" points="224.5,-61.8956 228,-71.8957 231.5,-61.8957 224.5,-61.8956"/>
 | |
| </g>
 | |
| <!-- DistanceSensor -->
 | |
| <g id="node10" class="node"><title>DistanceSensor</title>
 | |
| <polygon fill="#2980b9" stroke="#2980b9" points="373,-36 281,-36 281,-0 373,-0 373,-36"/>
 | |
| <text text-anchor="middle" x="327" y="-15.5" font-family="Sans" font-size="10.00" fill="#ffffff">DistanceSensor</text>
 | |
| </g>
 | |
| <!-- DistanceSensor->SmoothedInputDevice -->
 | |
| <g id="edge9" class="edge"><title>DistanceSensor->SmoothedInputDevice</title>
 | |
| <path fill="none" stroke="black" d="M302.782,-36.1239C290.077,-45.1069 274.336,-56.2375 260.577,-65.9659"/>
 | |
| <polygon fill="black" stroke="black" points="258.456,-63.1791 252.311,-71.8102 262.497,-68.8947 258.456,-63.1791"/>
 | |
| </g>
 | |
| <!-- OutputDevice -->
 | |
| <g id="node11" class="node"><title>OutputDevice</title>
 | |
| <polygon fill="#2980b9" stroke="#2980b9" points="576,-180 494,-180 494,-144 576,-144 576,-180"/>
 | |
| <text text-anchor="middle" x="535" y="-159.5" font-family="Sans" font-size="10.00" fill="#ffffff">OutputDevice</text>
 | |
| </g>
 | |
| <!-- OutputDevice->GPIODevice -->
 | |
| <g id="edge10" class="edge"><title>OutputDevice->GPIODevice</title>
 | |
| <path fill="none" stroke="black" d="M519.427,-180.303C511.798,-188.78 502.477,-199.136 494.124,-208.417"/>
 | |
| <polygon fill="black" stroke="black" points="491.482,-206.121 487.394,-215.896 496.685,-210.804 491.482,-206.121"/>
 | |
| </g>
 | |
| <!-- DigitalOutputDevice -->
 | |
| <g id="node12" class="node"><title>DigitalOutputDevice</title>
 | |
| <polygon fill="#2980b9" stroke="#2980b9" points="591,-108 479,-108 479,-72 591,-72 591,-108"/>
 | |
| <text text-anchor="middle" x="535" y="-87.5" font-family="Sans" font-size="10.00" fill="#ffffff">DigitalOutputDevice</text>
 | |
| </g>
 | |
| <!-- DigitalOutputDevice->OutputDevice -->
 | |
| <g id="edge11" class="edge"><title>DigitalOutputDevice->OutputDevice</title>
 | |
| <path fill="none" stroke="black" d="M535,-108.303C535,-116.017 535,-125.288 535,-133.888"/>
 | |
| <polygon fill="black" stroke="black" points="531.5,-133.896 535,-143.896 538.5,-133.896 531.5,-133.896"/>
 | |
| </g>
 | |
| <!-- LED -->
 | |
| <g id="node13" class="node"><title>LED</title>
 | |
| <polygon fill="#2980b9" stroke="#2980b9" points="534,-36 480,-36 480,-0 534,-0 534,-36"/>
 | |
| <text text-anchor="middle" x="507" y="-15.5" font-family="Sans" font-size="10.00" fill="#ffffff">LED</text>
 | |
| </g>
 | |
| <!-- LED->DigitalOutputDevice -->
 | |
| <g id="edge12" class="edge"><title>LED->DigitalOutputDevice</title>
 | |
| <path fill="none" stroke="black" d="M513.921,-36.3034C517.075,-44.1868 520.878,-53.6958 524.381,-62.4536"/>
 | |
| <polygon fill="black" stroke="black" points="521.195,-63.9108 528.158,-71.8957 527.694,-61.311 521.195,-63.9108"/>
 | |
| </g>
 | |
| <!-- Buzzer -->
 | |
| <g id="node14" class="node"><title>Buzzer</title>
 | |
| <polygon fill="#2980b9" stroke="#2980b9" points="606,-36 552,-36 552,-0 606,-0 606,-36"/>
 | |
| <text text-anchor="middle" x="579" y="-15.5" font-family="Sans" font-size="10.00" fill="#ffffff">Buzzer</text>
 | |
| </g>
 | |
| <!-- Buzzer->DigitalOutputDevice -->
 | |
| <g id="edge13" class="edge"><title>Buzzer->DigitalOutputDevice</title>
 | |
| <path fill="none" stroke="black" d="M568.124,-36.3034C563.008,-44.4411 556.805,-54.311 551.155,-63.2987"/>
 | |
| <polygon fill="black" stroke="black" points="548.11,-61.5667 545.751,-71.8957 554.036,-65.2919 548.11,-61.5667"/>
 | |
| </g>
 | |
| <!-- PWMOutputDevice -->
 | |
| <g id="node15" class="node"><title>PWMOutputDevice</title>
 | |
| <polygon fill="#2980b9" stroke="#2980b9" points="713,-108 609,-108 609,-72 713,-72 713,-108"/>
 | |
| <text text-anchor="middle" x="661" y="-87.5" font-family="Sans" font-size="10.00" fill="#ffffff">PWMOutputDevice</text>
 | |
| </g>
 | |
| <!-- PWMOutputDevice->OutputDevice -->
 | |
| <g id="edge14" class="edge"><title>PWMOutputDevice->OutputDevice</title>
 | |
| <path fill="none" stroke="black" d="M630.177,-108.124C613.55,-117.361 592.835,-128.869 574.981,-138.788"/>
 | |
| <polygon fill="black" stroke="black" points="572.983,-135.894 565.942,-143.81 576.383,-142.013 572.983,-135.894"/>
 | |
| </g>
 | |
| <!-- PWMLED -->
 | |
| <g id="node16" class="node"><title>PWMLED</title>
 | |
| <polygon fill="#2980b9" stroke="#2980b9" points="690,-36 632,-36 632,-0 690,-0 690,-36"/>
 | |
| <text text-anchor="middle" x="661" y="-15.5" font-family="Sans" font-size="10.00" fill="#ffffff">PWMLED</text>
 | |
| </g>
 | |
| <!-- PWMLED->PWMOutputDevice -->
 | |
| <g id="edge15" class="edge"><title>PWMLED->PWMOutputDevice</title>
 | |
| <path fill="none" stroke="black" d="M661,-36.3034C661,-44.0173 661,-53.2875 661,-61.8876"/>
 | |
| <polygon fill="black" stroke="black" points="657.5,-61.8956 661,-71.8957 664.5,-61.8957 657.5,-61.8956"/>
 | |
| </g>
 | |
| </g>
 | |
| </svg>
 |