mirror of
				https://github.com/KevinMidboe/python-gpiozero.git
				synced 2025-10-29 17:50:37 +00:00 
			
		
		
		
	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.
		
			
				
	
	
		
			129 lines
		
	
	
		
			7.3 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
			
		
		
	
	
			129 lines
		
	
	
		
			7.3 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="469pt" height="404pt"
 | |
|  viewBox="0.00 0.00 469.00 404.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 400)">
 | |
| <title>classes</title>
 | |
| <polygon fill="white" stroke="none" points="-4,4 -4,-400 465,-400 465,4 -4,4"/>
 | |
| <!-- Device -->
 | |
| <g id="node1" class="node"><title>Device</title>
 | |
| <polygon fill="#9ec6e0" stroke="#9ec6e0" points="297,-396 243,-396 243,-360 297,-360 297,-396"/>
 | |
| <text text-anchor="middle" x="270" y="-375.5" font-family="Sans" font-size="10.00" fill="#000000">Device</text>
 | |
| </g>
 | |
| <!-- SPIDevice -->
 | |
| <g id="node2" class="node"><title>SPIDevice</title>
 | |
| <polygon fill="#9ec6e0" stroke="#9ec6e0" points="302,-324 238,-324 238,-288 302,-288 302,-324"/>
 | |
| <text text-anchor="middle" x="270" y="-303.5" font-family="Sans" font-size="10.00" fill="#000000">SPIDevice</text>
 | |
| </g>
 | |
| <!-- SPIDevice->Device -->
 | |
| <g id="edge1" class="edge"><title>SPIDevice->Device</title>
 | |
| <path fill="none" stroke="black" d="M270,-324.303C270,-332.017 270,-341.288 270,-349.888"/>
 | |
| <polygon fill="black" stroke="black" points="266.5,-349.896 270,-359.896 273.5,-349.896 266.5,-349.896"/>
 | |
| </g>
 | |
| <!-- AnalogInputDevice -->
 | |
| <g id="node3" class="node"><title>AnalogInputDevice</title>
 | |
| <polygon fill="#9ec6e0" stroke="#9ec6e0" points="323,-252 217,-252 217,-216 323,-216 323,-252"/>
 | |
| <text text-anchor="middle" x="270" y="-231.5" font-family="Sans" font-size="10.00" fill="#000000">AnalogInputDevice</text>
 | |
| </g>
 | |
| <!-- AnalogInputDevice->SPIDevice -->
 | |
| <g id="edge2" class="edge"><title>AnalogInputDevice->SPIDevice</title>
 | |
| <path fill="none" stroke="black" d="M270,-252.303C270,-260.017 270,-269.288 270,-277.888"/>
 | |
| <polygon fill="black" stroke="black" points="266.5,-277.896 270,-287.896 273.5,-277.896 266.5,-277.896"/>
 | |
| </g>
 | |
| <!-- MCP3xxx -->
 | |
| <g id="node4" class="node"><title>MCP3xxx</title>
 | |
| <polygon fill="#9ec6e0" stroke="#9ec6e0" points="299.5,-180 240.5,-180 240.5,-144 299.5,-144 299.5,-180"/>
 | |
| <text text-anchor="middle" x="270" y="-159.5" font-family="Sans" font-size="10.00" fill="#000000">MCP3xxx</text>
 | |
| </g>
 | |
| <!-- MCP3xxx->AnalogInputDevice -->
 | |
| <g id="edge3" class="edge"><title>MCP3xxx->AnalogInputDevice</title>
 | |
| <path fill="none" stroke="black" d="M270,-180.303C270,-188.017 270,-197.288 270,-205.888"/>
 | |
| <polygon fill="black" stroke="black" points="266.5,-205.896 270,-215.896 273.5,-205.896 266.5,-205.896"/>
 | |
| </g>
 | |
| <!-- MCP33xx -->
 | |
| <g id="node5" class="node"><title>MCP33xx</title>
 | |
| <polygon fill="#9ec6e0" stroke="#9ec6e0" points="141,-108 81,-108 81,-72 141,-72 141,-108"/>
 | |
| <text text-anchor="middle" x="111" y="-87.5" font-family="Sans" font-size="10.00" fill="#000000">MCP33xx</text>
 | |
| </g>
 | |
| <!-- MCP33xx->MCP3xxx -->
 | |
| <g id="edge4" class="edge"><title>MCP33xx->MCP3xxx</title>
 | |
| <path fill="none" stroke="black" d="M140.534,-104.002C166.081,-115.249 203.204,-131.593 231.154,-143.898"/>
 | |
| <polygon fill="black" stroke="black" points="230.062,-147.241 240.624,-148.067 232.882,-140.835 230.062,-147.241"/>
 | |
| </g>
 | |
| <!-- MCP3004 -->
 | |
| <g id="node6" class="node"><title>MCP3004</title>
 | |
| <polygon fill="#2980b9" stroke="#2980b9" points="221,-108 159,-108 159,-72 221,-72 221,-108"/>
 | |
| <text text-anchor="middle" x="190" y="-87.5" font-family="Sans" font-size="10.00" fill="#ffffff">MCP3004</text>
 | |
| </g>
 | |
| <!-- MCP3004->MCP3xxx -->
 | |
| <g id="edge5" class="edge"><title>MCP3004->MCP3xxx</title>
 | |
| <path fill="none" stroke="black" d="M209.775,-108.303C219.754,-117.035 232.011,-127.76 242.857,-137.25"/>
 | |
| <polygon fill="black" stroke="black" points="240.622,-139.945 250.452,-143.896 245.231,-134.677 240.622,-139.945"/>
 | |
| </g>
 | |
| <!-- MCP3008 -->
 | |
| <g id="node7" class="node"><title>MCP3008</title>
 | |
| <polygon fill="#2980b9" stroke="#2980b9" points="301,-108 239,-108 239,-72 301,-72 301,-108"/>
 | |
| <text text-anchor="middle" x="270" y="-87.5" font-family="Sans" font-size="10.00" fill="#ffffff">MCP3008</text>
 | |
| </g>
 | |
| <!-- MCP3008->MCP3xxx -->
 | |
| <g id="edge6" class="edge"><title>MCP3008->MCP3xxx</title>
 | |
| <path fill="none" stroke="black" d="M270,-108.303C270,-116.017 270,-125.288 270,-133.888"/>
 | |
| <polygon fill="black" stroke="black" points="266.5,-133.896 270,-143.896 273.5,-133.896 266.5,-133.896"/>
 | |
| </g>
 | |
| <!-- MCP3204 -->
 | |
| <g id="node8" class="node"><title>MCP3204</title>
 | |
| <polygon fill="#2980b9" stroke="#2980b9" points="381,-108 319,-108 319,-72 381,-72 381,-108"/>
 | |
| <text text-anchor="middle" x="350" y="-87.5" font-family="Sans" font-size="10.00" fill="#ffffff">MCP3204</text>
 | |
| </g>
 | |
| <!-- MCP3204->MCP3xxx -->
 | |
| <g id="edge7" class="edge"><title>MCP3204->MCP3xxx</title>
 | |
| <path fill="none" stroke="black" d="M330.225,-108.303C320.246,-117.035 307.989,-127.76 297.143,-137.25"/>
 | |
| <polygon fill="black" stroke="black" points="294.769,-134.677 289.548,-143.896 299.378,-139.945 294.769,-134.677"/>
 | |
| </g>
 | |
| <!-- MCP3208 -->
 | |
| <g id="node9" class="node"><title>MCP3208</title>
 | |
| <polygon fill="#2980b9" stroke="#2980b9" points="461,-108 399,-108 399,-72 461,-72 461,-108"/>
 | |
| <text text-anchor="middle" x="430" y="-87.5" font-family="Sans" font-size="10.00" fill="#ffffff">MCP3208</text>
 | |
| </g>
 | |
| <!-- MCP3208->MCP3xxx -->
 | |
| <g id="edge8" class="edge"><title>MCP3208->MCP3xxx</title>
 | |
| <path fill="none" stroke="black" d="M399.15,-104.497C373.4,-115.762 336.557,-131.881 308.808,-144.022"/>
 | |
| <polygon fill="black" stroke="black" points="307.163,-140.921 299.405,-148.135 309.969,-147.334 307.163,-140.921"/>
 | |
| </g>
 | |
| <!-- MCP3301 -->
 | |
| <g id="node10" class="node"><title>MCP3301</title>
 | |
| <polygon fill="#2980b9" stroke="#2980b9" points="62,-36 3.55271e-15,-36 3.55271e-15,-0 62,-0 62,-36"/>
 | |
| <text text-anchor="middle" x="31" y="-15.5" font-family="Sans" font-size="10.00" fill="#ffffff">MCP3301</text>
 | |
| </g>
 | |
| <!-- MCP3301->MCP33xx -->
 | |
| <g id="edge9" class="edge"><title>MCP3301->MCP33xx</title>
 | |
| <path fill="none" stroke="black" d="M50.7753,-36.3034C60.7537,-45.0345 73.0109,-55.7595 83.8568,-65.2497"/>
 | |
| <polygon fill="black" stroke="black" points="81.6216,-67.9446 91.4522,-71.8957 86.2312,-62.6766 81.6216,-67.9446"/>
 | |
| </g>
 | |
| <!-- MCP3302 -->
 | |
| <g id="node11" class="node"><title>MCP3302</title>
 | |
| <polygon fill="#2980b9" stroke="#2980b9" points="142,-36 80,-36 80,-0 142,-0 142,-36"/>
 | |
| <text text-anchor="middle" x="111" y="-15.5" font-family="Sans" font-size="10.00" fill="#ffffff">MCP3302</text>
 | |
| </g>
 | |
| <!-- MCP3302->MCP33xx -->
 | |
| <g id="edge10" class="edge"><title>MCP3302->MCP33xx</title>
 | |
| <path fill="none" stroke="black" d="M111,-36.3034C111,-44.0173 111,-53.2875 111,-61.8876"/>
 | |
| <polygon fill="black" stroke="black" points="107.5,-61.8956 111,-71.8957 114.5,-61.8957 107.5,-61.8956"/>
 | |
| </g>
 | |
| <!-- MCP3304 -->
 | |
| <g id="node12" class="node"><title>MCP3304</title>
 | |
| <polygon fill="#2980b9" stroke="#2980b9" points="222,-36 160,-36 160,-0 222,-0 222,-36"/>
 | |
| <text text-anchor="middle" x="191" y="-15.5" font-family="Sans" font-size="10.00" fill="#ffffff">MCP3304</text>
 | |
| </g>
 | |
| <!-- MCP3304->MCP33xx -->
 | |
| <g id="edge11" class="edge"><title>MCP3304->MCP33xx</title>
 | |
| <path fill="none" stroke="black" d="M171.225,-36.3034C161.246,-45.0345 148.989,-55.7595 138.143,-65.2497"/>
 | |
| <polygon fill="black" stroke="black" points="135.769,-62.6766 130.548,-71.8957 140.378,-67.9446 135.769,-62.6766"/>
 | |
| </g>
 | |
| </g>
 | |
| </svg>
 |