Compare commits
27 Commits
6ef60a3f2f
...
i2c-helper
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2824bdac6e | ||
|
|
b040662551 | ||
|
|
0b620a76ca | ||
|
|
89f494ba58 | ||
|
|
c73a9212eb | ||
|
|
9ab6cbe097 | ||
|
|
2a038367a8 | ||
|
|
1f5148dcdd | ||
|
|
1e317adedd | ||
|
|
caf7586b5b | ||
|
|
08154454fa | ||
|
|
7dd6686b01 | ||
|
|
db464efa36 | ||
|
|
aa9d00bf6e | ||
|
|
bac01e3a9b | ||
|
|
1fd8737fe4 | ||
|
|
cbf702c6d5 | ||
|
|
894d5f4380 | ||
|
|
78a5148a1e | ||
|
|
0bb125fad9 | ||
|
|
ad61e7e9b7 | ||
|
|
c136056ed2 | ||
|
|
edc2dd6294 | ||
|
|
58043ee0d5 | ||
|
|
65df7b1912 | ||
|
|
877040362c | ||
|
|
ec2225aa4e |
BIN
.gitignore
(Stored with Git LFS)
vendored
BIN
.gitignore
(Stored with Git LFS)
vendored
Binary file not shown.
BIN
.gitmodules
(Stored with Git LFS)
vendored
BIN
.gitmodules
(Stored with Git LFS)
vendored
Binary file not shown.
BIN
i2c-hub/asd
Normal file
BIN
i2c-hub/asd
Normal file
Binary file not shown.
BIN
i2c-hub/backend/Protocol.md
(Stored with Git LFS)
Normal file
BIN
i2c-hub/backend/Protocol.md
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i2c-hub/backend/src/gobotRPC_ctrl_interface.py
(Stored with Git LFS)
Normal file
BIN
i2c-hub/backend/src/gobotRPC_ctrl_interface.py
(Stored with Git LFS)
Normal file
Binary file not shown.
0
i2c-hub/backend/src/main.py
Normal file
0
i2c-hub/backend/src/main.py
Normal file
9
i2c-hub/backend/test.txt
Normal file
9
i2c-hub/backend/test.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
fe fe fe fe fc 10 10 10 20 ff 48 65 6c 6c 6f 20
|
||||
6f 72 6c 64 21 0a 84 00 01 00 42 00 00 00 12
|
||||
00 00 00 c0 84 01 01 01 43 00 00 00 22 00 00
|
||||
3f 00 84 00 01 00 42 00 00 00 32 00 00 00 80
|
||||
54 68 69 73 20 69 73 20 52 61 6e 64 6f 6d 20
|
||||
65 78 74 0a 84 01 01 02 43 00 00 00 63 00 00
|
||||
3f 00 84 01 01 00 42 00 00 00 73 00 00 00 bf
|
||||
81 10 40 42 00 00 00 01 02 03 04 05 06 00 11
|
||||
13 14 fe fe fe fe fe fe fc
|
||||
372
i2c-hub/circuit/.$I2CHubCircuit.drawio.bkp
Normal file
372
i2c-hub/circuit/.$I2CHubCircuit.drawio.bkp
Normal file
@@ -0,0 +1,372 @@
|
||||
<mxfile host="Electron" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/26.0.3 Chrome/130.0.6723.137 Electron/33.2.1 Safari/537.36" version="26.0.3">
|
||||
<diagram name="Page-1" id="AMVLBRZDkjnkadgTC83C">
|
||||
<mxGraphModel dx="1366" dy="798" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1169" pageHeight="827" math="0" shadow="0">
|
||||
<root>
|
||||
<mxCell id="0" />
|
||||
<mxCell id="1" parent="0" />
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-1" value="" style="shape=image;verticalLabelPosition=bottom;labelBackgroundColor=default;verticalAlign=top;aspect=fixed;imageAspect=0;image=https://www.elektronik-kompendium.de/sites/raspberry-pi/bilder/raspberry-pi-pico-gpio.png;movable=0;resizable=0;rotatable=0;deletable=0;editable=0;locked=1;connectable=0;" vertex="1" parent="1">
|
||||
<mxGeometry x="343" y="150" width="522.06" height="306" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-2" value="" style="shape=image;verticalLabelPosition=bottom;labelBackgroundColor=default;verticalAlign=top;aspect=fixed;imageAspect=0;image=https://www.build-electronic-circuits.com/wp-content/uploads/2023/04/7432-pinout.png;movable=0;resizable=0;rotatable=0;deletable=0;editable=0;locked=1;connectable=0;" vertex="1" parent="1">
|
||||
<mxGeometry x="190" y="520" width="166.39" height="170" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-54" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;endArrow=none;endFill=0;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-3" target="3qXY1K8jvDizOHU8Sasa-12">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<Array as="points">
|
||||
<mxPoint x="180" y="170" />
|
||||
<mxPoint x="180" y="290" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-3" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="160" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-49" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;strokeColor=#CC0000;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-4">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="390" y="240" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="220" y="190" />
|
||||
<mxPoint x="220" y="240" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-4" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="180" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-45" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#FFFF00;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-5">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="390" y="260" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="230" y="210" />
|
||||
<mxPoint x="230" y="260" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-5" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="200" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-31" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;strokeColor=#0000FF;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-6">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="220" y="600" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="130" y="230" />
|
||||
<mxPoint x="130" y="600" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-6" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="220" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-8" value="<font color="#ffffff">SDA</font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#CC0000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="180" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-9" value="<font>SCL</font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#FFFF00;fontColor=#000000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="200" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-10" value="<font color="#ffffff">GND</font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#000000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="160" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-11" value="INT" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#FFFFFF;fontColor=#000000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="220" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-55" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;endArrow=none;endFill=0;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-12" target="3qXY1K8jvDizOHU8Sasa-20">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<Array as="points">
|
||||
<mxPoint x="180" y="290" />
|
||||
<mxPoint x="180" y="410" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-12" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="280" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-47" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#CC0000;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-13">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="390" y="240" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="220" y="310" />
|
||||
<mxPoint x="220" y="240" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-13" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="300" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-44" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#FFFF00;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-14">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="390" y="260" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="230" y="330" />
|
||||
<mxPoint x="230" y="260" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-14" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="320" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-30" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#0000FF;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-15">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="220" y="560" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="120" y="350" />
|
||||
<mxPoint x="120" y="560" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-15" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="340" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-16" value="<font color="#ffffff">SDA</font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#CC0000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="300" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-17" value="<font>SCL</font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#FFFF00;fontColor=#000000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="320" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-18" value="<font color="#ffffff">GND</font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#000000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="280" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-19" value="INT" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#FFFFFF;fontColor=#000000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="340" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-20" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="400" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-48" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#CC0000;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-21">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="390" y="240" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="220" y="430" />
|
||||
<mxPoint x="220" y="240" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-21" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="420" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-46" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;strokeColor=#FFFF00;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-22">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="390" y="260" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="230" y="450" />
|
||||
<mxPoint x="230" y="260" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-22" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="440" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-29" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;strokeColor=#0000FF;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-23">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="220" y="540" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="110" y="470" />
|
||||
<mxPoint x="110" y="540" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-23" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="460" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-24" value="<font color="#ffffff">SDA</font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#CC0000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="420" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-25" value="<font>SCL</font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#FFFF00;fontColor=#000000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="440" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-26" value="<font color="#ffffff">GND</font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#000000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="400" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-27" value="INT" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#FFFFFF;fontColor=#000000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="460" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-53" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;endArrow=none;endFill=0;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-32" target="3qXY1K8jvDizOHU8Sasa-3">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<Array as="points">
|
||||
<mxPoint x="180" y="50" />
|
||||
<mxPoint x="180" y="170" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-32" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="40" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-50" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;strokeColor=#CC0000;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-33">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="390" y="240" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="220" y="70" />
|
||||
<mxPoint x="220" y="240" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-33" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="60" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-43" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#FFFF00;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-34">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="390" y="260" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="230" y="90" />
|
||||
<mxPoint x="230" y="260" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-34" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="80" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-40" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#0000FF;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-35">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="220" y="620" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="140" y="110" />
|
||||
<mxPoint x="140" y="620" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-35" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="100" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-36" value="<font color="#ffffff">SDA</font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#CC0000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="60" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-37" value="<font>SCL</font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#FFFF00;fontColor=#000000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="80" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-38" value="<font color="#ffffff">GND</font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#000000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="40" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-39" value="INT" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#FFFFFF;fontColor=#000000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="100" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-41" value="" style="endArrow=classic;html=1;rounded=0;strokeColor=#0000FF;" edge="1" parent="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="220" y="580" as="sourcePoint" />
|
||||
<mxPoint x="330" y="560" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="190" y="580" />
|
||||
<mxPoint x="190" y="510" />
|
||||
<mxPoint x="360" y="510" />
|
||||
<mxPoint x="360" y="560" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-42" value="" style="endArrow=classic;html=1;rounded=0;strokeColor=#0000FF;" edge="1" parent="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="220" y="640" as="sourcePoint" />
|
||||
<mxPoint x="330" y="580" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="180" y="640" />
|
||||
<mxPoint x="180" y="500" />
|
||||
<mxPoint x="370" y="500" />
|
||||
<mxPoint x="370" y="580" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-51" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;strokeColor=#0000FF;" edge="1" parent="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="330" y="600" as="sourcePoint" />
|
||||
<mxPoint x="480" y="210" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="390" y="600" />
|
||||
<mxPoint x="390" y="480" />
|
||||
<mxPoint x="250" y="480" />
|
||||
<mxPoint x="250" y="210" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-56" value="" style="endArrow=none;html=1;rounded=0;" edge="1" parent="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="180" y="170" as="sourcePoint" />
|
||||
<mxPoint x="480" y="200" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="320" y="170" />
|
||||
<mxPoint x="320" y="200" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-58" value="." style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="420" y="80" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-59" value="." style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="440" y="80" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-61" value="" style="endArrow=none;html=1;rounded=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-59">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="440" y="220" as="sourcePoint" />
|
||||
<mxPoint x="490" y="170" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="450" y="170" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-62" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" target="3qXY1K8jvDizOHU8Sasa-58">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="490" y="180" as="sourcePoint" />
|
||||
<mxPoint x="540" y="130" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="430" y="180" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-63" value="RX" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
|
||||
<mxGeometry x="440" y="60" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-64" value="TX" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
|
||||
<mxGeometry x="420" y="60" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-66" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=classic;startFill=1;endArrow=none;endFill=0;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-65">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="719.9999999999998" y="450" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="720" y="500" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-65" value="LED" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;" vertex="1" parent="1">
|
||||
<mxGeometry x="760" y="480" width="40" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-75" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-68">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="720" y="200" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="830" y="160" />
|
||||
<mxPoint x="830" y="200" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-68" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="880" y="150" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-76" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-69">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="720" y="180" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="880" y="180" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-69" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="880" y="170" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-72" value="GND" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
|
||||
<mxGeometry x="900" y="150" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-74" value="5V+" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
|
||||
<mxGeometry x="900" y="170" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-78" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-77">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="320" y="540" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="321" y="505" />
|
||||
<mxPoint x="321" y="540" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-77" value="3V&nbsp;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
|
||||
<mxGeometry x="400" y="490" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
</root>
|
||||
</mxGraphModel>
|
||||
</diagram>
|
||||
</mxfile>
|
||||
372
i2c-hub/circuit/I2CHubCircuit.drawio
Normal file
372
i2c-hub/circuit/I2CHubCircuit.drawio
Normal file
@@ -0,0 +1,372 @@
|
||||
<mxfile host="Electron" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/26.0.3 Chrome/130.0.6723.137 Electron/33.2.1 Safari/537.36" version="26.0.3">
|
||||
<diagram name="Page-1" id="AMVLBRZDkjnkadgTC83C">
|
||||
<mxGraphModel dx="1366" dy="798" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1169" pageHeight="827" math="0" shadow="0">
|
||||
<root>
|
||||
<mxCell id="0" />
|
||||
<mxCell id="1" parent="0" />
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-1" value="" style="shape=image;verticalLabelPosition=bottom;labelBackgroundColor=default;verticalAlign=top;aspect=fixed;imageAspect=0;image=https://www.elektronik-kompendium.de/sites/raspberry-pi/bilder/raspberry-pi-pico-gpio.png;movable=0;resizable=0;rotatable=0;deletable=0;editable=0;locked=1;connectable=0;" vertex="1" parent="1">
|
||||
<mxGeometry x="343" y="150" width="522.06" height="306" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-2" value="" style="shape=image;verticalLabelPosition=bottom;labelBackgroundColor=default;verticalAlign=top;aspect=fixed;imageAspect=0;image=https://www.build-electronic-circuits.com/wp-content/uploads/2023/04/7432-pinout.png;movable=0;resizable=0;rotatable=0;deletable=0;editable=0;locked=1;connectable=0;" vertex="1" parent="1">
|
||||
<mxGeometry x="190" y="520" width="166.39" height="170" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-54" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;endArrow=none;endFill=0;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-3" target="3qXY1K8jvDizOHU8Sasa-12">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<Array as="points">
|
||||
<mxPoint x="180" y="170" />
|
||||
<mxPoint x="180" y="290" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-3" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="160" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-49" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;strokeColor=#CC0000;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-4">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="390" y="240" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="220" y="190" />
|
||||
<mxPoint x="220" y="240" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-4" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="180" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-45" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#FFFF00;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-5">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="390" y="260" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="230" y="210" />
|
||||
<mxPoint x="230" y="260" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-5" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="200" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-31" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;strokeColor=#0000FF;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-6">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="220" y="600" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="130" y="230" />
|
||||
<mxPoint x="130" y="600" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-6" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="220" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-8" value="<font color="#ffffff">SDA</font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#CC0000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="180" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-9" value="<font>SCL</font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#FFFF00;fontColor=#000000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="200" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-10" value="<font color="#ffffff">GND</font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#000000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="160" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-11" value="INT" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#FFFFFF;fontColor=#000000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="220" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-55" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;endArrow=none;endFill=0;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-12" target="3qXY1K8jvDizOHU8Sasa-20">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<Array as="points">
|
||||
<mxPoint x="180" y="290" />
|
||||
<mxPoint x="180" y="410" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-12" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="280" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-47" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#CC0000;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-13">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="390" y="240" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="220" y="310" />
|
||||
<mxPoint x="220" y="240" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-13" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="300" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-44" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#FFFF00;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-14">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="390" y="260" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="230" y="330" />
|
||||
<mxPoint x="230" y="260" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-14" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="320" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-30" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#0000FF;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-15">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="220" y="560" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="120" y="350" />
|
||||
<mxPoint x="120" y="560" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-15" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="340" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-16" value="<font color="#ffffff">SDA</font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#CC0000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="300" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-17" value="<font>SCL</font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#FFFF00;fontColor=#000000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="320" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-18" value="<font color="#ffffff">GND</font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#000000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="280" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-19" value="INT" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#FFFFFF;fontColor=#000000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="340" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-20" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="400" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-48" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#CC0000;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-21">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="390" y="240" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="220" y="430" />
|
||||
<mxPoint x="220" y="240" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-21" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="420" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-46" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;strokeColor=#FFFF00;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-22">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="390" y="260" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="230" y="450" />
|
||||
<mxPoint x="230" y="260" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-22" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="440" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-29" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;strokeColor=#0000FF;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-23">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="220" y="540" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="110" y="470" />
|
||||
<mxPoint x="110" y="540" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-23" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="460" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-24" value="<font color="#ffffff">SDA</font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#CC0000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="420" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-25" value="<font>SCL</font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#FFFF00;fontColor=#000000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="440" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-26" value="<font color="#ffffff">GND</font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#000000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="400" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-27" value="INT" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#FFFFFF;fontColor=#000000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="460" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-53" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;endArrow=none;endFill=0;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-32" target="3qXY1K8jvDizOHU8Sasa-3">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<Array as="points">
|
||||
<mxPoint x="180" y="50" />
|
||||
<mxPoint x="180" y="170" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-32" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="40" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-50" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;strokeColor=#CC0000;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-33">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="390" y="240" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="220" y="70" />
|
||||
<mxPoint x="220" y="240" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-33" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="60" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-43" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#FFFF00;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-34">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="390" y="260" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="230" y="90" />
|
||||
<mxPoint x="230" y="260" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-34" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="80" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-40" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#0000FF;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-35">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="220" y="620" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="140" y="110" />
|
||||
<mxPoint x="140" y="620" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-35" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="100" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-36" value="<font color="#ffffff">SDA</font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#CC0000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="60" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-37" value="<font>SCL</font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#FFFF00;fontColor=#000000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="80" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-38" value="<font color="#ffffff">GND</font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#000000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="40" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-39" value="INT" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;fillColor=#FFFFFF;fontColor=#000000;" vertex="1" parent="1">
|
||||
<mxGeometry x="40" y="100" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-41" value="" style="endArrow=classic;html=1;rounded=0;strokeColor=#0000FF;" edge="1" parent="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="220" y="580" as="sourcePoint" />
|
||||
<mxPoint x="330" y="560" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="190" y="580" />
|
||||
<mxPoint x="190" y="510" />
|
||||
<mxPoint x="360" y="510" />
|
||||
<mxPoint x="360" y="560" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-42" value="" style="endArrow=classic;html=1;rounded=0;strokeColor=#0000FF;" edge="1" parent="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="220" y="640" as="sourcePoint" />
|
||||
<mxPoint x="330" y="580" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="180" y="640" />
|
||||
<mxPoint x="180" y="500" />
|
||||
<mxPoint x="370" y="500" />
|
||||
<mxPoint x="370" y="580" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-51" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;strokeColor=#0000FF;" edge="1" parent="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="330" y="600" as="sourcePoint" />
|
||||
<mxPoint x="480" y="210" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="390" y="600" />
|
||||
<mxPoint x="390" y="480" />
|
||||
<mxPoint x="250" y="480" />
|
||||
<mxPoint x="250" y="210" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-56" value="" style="endArrow=none;html=1;rounded=0;" edge="1" parent="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="180" y="170" as="sourcePoint" />
|
||||
<mxPoint x="480" y="200" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="320" y="170" />
|
||||
<mxPoint x="320" y="200" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-58" value="." style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="420" y="80" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-59" value="." style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="440" y="80" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-61" value="" style="endArrow=none;html=1;rounded=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-59">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="440" y="220" as="sourcePoint" />
|
||||
<mxPoint x="490" y="170" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="450" y="170" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-62" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" target="3qXY1K8jvDizOHU8Sasa-58">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="490" y="180" as="sourcePoint" />
|
||||
<mxPoint x="540" y="130" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="430" y="180" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-63" value="RX" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
|
||||
<mxGeometry x="440" y="60" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-64" value="TX" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
|
||||
<mxGeometry x="420" y="60" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-66" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=classic;startFill=1;endArrow=none;endFill=0;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-65">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="719.9999999999998" y="450" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="720" y="500" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-65" value="LED" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;" vertex="1" parent="1">
|
||||
<mxGeometry x="760" y="480" width="40" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-75" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-68">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="720" y="200" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="830" y="160" />
|
||||
<mxPoint x="830" y="200" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-68" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="880" y="150" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-76" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-69">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="720" y="180" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="880" y="180" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-69" value="O" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="880" y="170" width="20" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-72" value="GND" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
|
||||
<mxGeometry x="900" y="150" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-74" value="5V+" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
|
||||
<mxGeometry x="900" y="170" width="40" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-78" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="3qXY1K8jvDizOHU8Sasa-77">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="320" y="540" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="321" y="505" />
|
||||
<mxPoint x="321" y="540" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3qXY1K8jvDizOHU8Sasa-77" value="3V&nbsp;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
|
||||
<mxGeometry x="400" y="490" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
</root>
|
||||
</mxGraphModel>
|
||||
</diagram>
|
||||
</mxfile>
|
||||
BIN
i2c-hub/circuit/i2c-hub/i2c-hub-backups/i2c-hub-2024-12-30_211118.zip
(Stored with Git LFS)
Normal file
BIN
i2c-hub/circuit/i2c-hub/i2c-hub-backups/i2c-hub-2024-12-30_211118.zip
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i2c-hub/circuit/i2c-hub/i2c-hub.kicad_prl
(Stored with Git LFS)
Normal file
BIN
i2c-hub/circuit/i2c-hub/i2c-hub.kicad_prl
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i2c-hub/circuit/i2c-hub/i2c-hub.kicad_pro
(Stored with Git LFS)
BIN
i2c-hub/circuit/i2c-hub/i2c-hub.kicad_pro
(Stored with Git LFS)
Binary file not shown.
BIN
i2c-hub/firmware/i2c-hub-firmware/.gitignore
(Stored with Git LFS)
vendored
Normal file
BIN
i2c-hub/firmware/i2c-hub-firmware/.gitignore
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
23
i2c-hub/firmware/i2c-hub-firmware/.vscode/c_cpp_properties.json
vendored
Normal file
23
i2c-hub/firmware/i2c-hub-firmware/.vscode/c_cpp_properties.json
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Pico",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**",
|
||||
"${userHome}/.pico-sdk/sdk/2.1.0/**"
|
||||
],
|
||||
"forcedInclude": [
|
||||
"${userHome}/.pico-sdk/sdk/2.1.0/src/common/pico_base_headers/include/pico.h",
|
||||
"${workspaceFolder}/build/generated/pico_base/pico/config_autogen.h"
|
||||
],
|
||||
"defines": [],
|
||||
"compilerPath": "${userHome}/.pico-sdk/toolchain/13_3_Rel1/bin/arm-none-eabi-gcc",
|
||||
"compileCommands": "${workspaceFolder}/build/compile_commands.json",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++14",
|
||||
"intelliSenseMode": "linux-gcc-arm",
|
||||
"configurationProvider": "ms-vscode.cmake-tools"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
||||
15
i2c-hub/firmware/i2c-hub-firmware/.vscode/cmake-kits.json
vendored
Normal file
15
i2c-hub/firmware/i2c-hub-firmware/.vscode/cmake-kits.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
[
|
||||
{
|
||||
"name": "Pico",
|
||||
"compilers": {
|
||||
"C": "${command:raspberry-pi-pico.getCompilerPath}",
|
||||
"CXX": "${command:raspberry-pi-pico.getCxxCompilerPath}"
|
||||
},
|
||||
"environmentVariables": {
|
||||
"PATH": "${command:raspberry-pi-pico.getEnvPath};${env:PATH}"
|
||||
},
|
||||
"cmakeSettings": {
|
||||
"Python3_EXECUTABLE": "${command:raspberry-pi-pico.getPythonPath}"
|
||||
}
|
||||
}
|
||||
]
|
||||
9
i2c-hub/firmware/i2c-hub-firmware/.vscode/extensions.json
vendored
Normal file
9
i2c-hub/firmware/i2c-hub-firmware/.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"marus25.cortex-debug",
|
||||
"ms-vscode.cpptools",
|
||||
"ms-vscode.cpptools-extension-pack",
|
||||
"ms-vscode.vscode-serial-monitor",
|
||||
"raspberry-pi.raspberry-pi-pico"
|
||||
]
|
||||
}
|
||||
70
i2c-hub/firmware/i2c-hub-firmware/.vscode/launch.json
vendored
Normal file
70
i2c-hub/firmware/i2c-hub-firmware/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Pico Debug (Cortex-Debug)",
|
||||
"cwd": "${userHome}/.pico-sdk/openocd/0.12.0+dev/scripts",
|
||||
"executable": "${command:raspberry-pi-pico.launchTargetPath}",
|
||||
"request": "launch",
|
||||
"type": "cortex-debug",
|
||||
"servertype": "openocd",
|
||||
"serverpath": "${userHome}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
"gdbPath": "${command:raspberry-pi-pico.getGDBPath}",
|
||||
"device": "${command:raspberry-pi-pico.getChipUppercase}",
|
||||
"configFiles": [
|
||||
"interface/cmsis-dap.cfg",
|
||||
"target/${command:raspberry-pi-pico.getTarget}.cfg"
|
||||
],
|
||||
"svdFile": "${userHome}/.pico-sdk/sdk/2.1.0/src/${command:raspberry-pi-pico.getChip}/hardware_regs/${command:raspberry-pi-pico.getChipUppercase}.svd",
|
||||
"runToEntryPoint": "main",
|
||||
// Fix for no_flash binaries, where monitor reset halt doesn't do what is expected
|
||||
// Also works fine for flash binaries
|
||||
"overrideLaunchCommands": [
|
||||
"monitor reset init",
|
||||
"load \"${command:raspberry-pi-pico.launchTargetPath}\""
|
||||
],
|
||||
"openOCDLaunchCommands": [
|
||||
"adapter speed 5000"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Pico Debug (Cortex-Debug with external OpenOCD)",
|
||||
"cwd": "${workspaceRoot}",
|
||||
"executable": "${command:raspberry-pi-pico.launchTargetPath}",
|
||||
"request": "launch",
|
||||
"type": "cortex-debug",
|
||||
"servertype": "external",
|
||||
"gdbTarget": "localhost:3333",
|
||||
"gdbPath": "${command:raspberry-pi-pico.getGDBPath}",
|
||||
"device": "${command:raspberry-pi-pico.getChipUppercase}",
|
||||
"svdFile": "${userHome}/.pico-sdk/sdk/2.1.0/src/${command:raspberry-pi-pico.getChip}/hardware_regs/${command:raspberry-pi-pico.getChipUppercase}.svd",
|
||||
"runToEntryPoint": "main",
|
||||
// Fix for no_flash binaries, where monitor reset halt doesn't do what is expected
|
||||
// Also works fine for flash binaries
|
||||
"overrideLaunchCommands": [
|
||||
"monitor reset init",
|
||||
"load \"${command:raspberry-pi-pico.launchTargetPath}\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Pico Debug (C++ Debugger)",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"cwd": "${workspaceRoot}",
|
||||
"program": "${command:raspberry-pi-pico.launchTargetPath}",
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "${command:raspberry-pi-pico.getGDBPath}",
|
||||
"miDebuggerServerAddress": "localhost:3333",
|
||||
"debugServerPath": "${userHome}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
"debugServerArgs": "-f interface/cmsis-dap.cfg -f target/${command:raspberry-pi-pico.getTarget}.cfg -c \"adapter speed 5000\"",
|
||||
"serverStarted": "Listening on port .* for gdb connections",
|
||||
"filterStderr": true,
|
||||
"hardwareBreakpoints": {
|
||||
"require": true,
|
||||
"limit": 4
|
||||
},
|
||||
"preLaunchTask": "Flash",
|
||||
"svdPath": "${userHome}/.pico-sdk/sdk/2.1.0/src/${command:raspberry-pi-pico.getChip}/hardware_regs/${command:raspberry-pi-pico.getChipUppercase}.svd"
|
||||
},
|
||||
]
|
||||
}
|
||||
87
i2c-hub/firmware/i2c-hub-firmware/.vscode/settings.json
vendored
Normal file
87
i2c-hub/firmware/i2c-hub-firmware/.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
{
|
||||
"cmake.options.statusBarVisibility": "hidden",
|
||||
"cmake.options.advanced": {
|
||||
"build": {
|
||||
"statusBarVisibility": "hidden"
|
||||
},
|
||||
"launch": {
|
||||
"statusBarVisibility": "hidden"
|
||||
},
|
||||
"debug": {
|
||||
"statusBarVisibility": "hidden"
|
||||
}
|
||||
},
|
||||
"cmake.configureOnEdit": true,
|
||||
"cmake.automaticReconfigure": true,
|
||||
"cmake.configureOnOpen": true,
|
||||
"cmake.generator": "Ninja",
|
||||
"cmake.cmakePath": "${userHome}/.pico-sdk/cmake/v3.29.9/bin/cmake",
|
||||
"C_Cpp.debugShortcut": false,
|
||||
"terminal.integrated.env.windows": {
|
||||
"PICO_SDK_PATH": "${env:USERPROFILE}/.pico-sdk/sdk/2.1.0",
|
||||
"PICO_TOOLCHAIN_PATH": "${env:USERPROFILE}/.pico-sdk/toolchain/13_3_Rel1",
|
||||
"Path": "${env:USERPROFILE}/.pico-sdk/toolchain/13_3_Rel1/bin;${env:USERPROFILE}/.pico-sdk/picotool/2.1.0/picotool;${env:USERPROFILE}/.pico-sdk/cmake/v3.29.9/bin;${env:USERPROFILE}/.pico-sdk/ninja/v1.12.1;${env:PATH}"
|
||||
},
|
||||
"terminal.integrated.env.osx": {
|
||||
"PICO_SDK_PATH": "${env:HOME}/.pico-sdk/sdk/2.1.0",
|
||||
"PICO_TOOLCHAIN_PATH": "${env:HOME}/.pico-sdk/toolchain/13_3_Rel1",
|
||||
"PATH": "${env:HOME}/.pico-sdk/toolchain/13_3_Rel1/bin:${env:HOME}/.pico-sdk/picotool/2.1.0/picotool:${env:HOME}/.pico-sdk/cmake/v3.29.9/bin:${env:HOME}/.pico-sdk/ninja/v1.12.1:${env:PATH}"
|
||||
},
|
||||
"terminal.integrated.env.linux": {
|
||||
"PICO_SDK_PATH": "${env:HOME}/.pico-sdk/sdk/2.1.0",
|
||||
"PICO_TOOLCHAIN_PATH": "${env:HOME}/.pico-sdk/toolchain/13_3_Rel1",
|
||||
"PATH": "${env:HOME}/.pico-sdk/toolchain/13_3_Rel1/bin:${env:HOME}/.pico-sdk/picotool/2.1.0/picotool:${env:HOME}/.pico-sdk/cmake/v3.29.9/bin:${env:HOME}/.pico-sdk/ninja/v1.12.1:${env:PATH}"
|
||||
},
|
||||
"raspberry-pi-pico.cmakeAutoConfigure": false,
|
||||
"raspberry-pi-pico.useCmakeTools": true,
|
||||
"raspberry-pi-pico.cmakePath": "${HOME}/.pico-sdk/cmake/v3.29.9/bin/cmake",
|
||||
"raspberry-pi-pico.ninjaPath": "${HOME}/.pico-sdk/ninja/v1.12.1/ninja",
|
||||
"files.associations": {
|
||||
"uart.h": "c",
|
||||
"freertos.h": "c",
|
||||
"array": "cpp",
|
||||
"atomic": "cpp",
|
||||
"bit": "cpp",
|
||||
"*.tcc": "cpp",
|
||||
"cctype": "cpp",
|
||||
"clocale": "cpp",
|
||||
"cmath": "cpp",
|
||||
"compare": "cpp",
|
||||
"concepts": "cpp",
|
||||
"cstdarg": "cpp",
|
||||
"cstddef": "cpp",
|
||||
"cstdint": "cpp",
|
||||
"cstdio": "cpp",
|
||||
"cstdlib": "cpp",
|
||||
"cwchar": "cpp",
|
||||
"cwctype": "cpp",
|
||||
"deque": "cpp",
|
||||
"map": "cpp",
|
||||
"string": "cpp",
|
||||
"unordered_map": "cpp",
|
||||
"vector": "cpp",
|
||||
"exception": "cpp",
|
||||
"algorithm": "cpp",
|
||||
"functional": "cpp",
|
||||
"iterator": "cpp",
|
||||
"memory": "cpp",
|
||||
"memory_resource": "cpp",
|
||||
"numeric": "cpp",
|
||||
"optional": "cpp",
|
||||
"random": "cpp",
|
||||
"string_view": "cpp",
|
||||
"system_error": "cpp",
|
||||
"tuple": "cpp",
|
||||
"type_traits": "cpp",
|
||||
"utility": "cpp",
|
||||
"initializer_list": "cpp",
|
||||
"iosfwd": "cpp",
|
||||
"limits": "cpp",
|
||||
"new": "cpp",
|
||||
"numbers": "cpp",
|
||||
"ostream": "cpp",
|
||||
"stdexcept": "cpp",
|
||||
"streambuf": "cpp",
|
||||
"typeinfo": "cpp"
|
||||
}
|
||||
}
|
||||
106
i2c-hub/firmware/i2c-hub-firmware/.vscode/tasks.json
vendored
Normal file
106
i2c-hub/firmware/i2c-hub-firmware/.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Compile Project",
|
||||
"type": "process",
|
||||
"isBuildCommand": true,
|
||||
"command": "${userHome}/.pico-sdk/ninja/v1.12.1/ninja",
|
||||
"args": ["-C", "${workspaceFolder}/build"],
|
||||
"group": "build",
|
||||
"presentation": {
|
||||
"echo": true,
|
||||
"reveal": "always",
|
||||
"focus": true,
|
||||
"panel": "dedicated",
|
||||
"showReuseMessage": true,
|
||||
"clear": true
|
||||
},
|
||||
"problemMatcher": "$gcc",
|
||||
"windows": {
|
||||
"command": "${env:USERPROFILE}/.pico-sdk/ninja/v1.12.1/ninja.exe"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Run Project",
|
||||
"type": "process",
|
||||
"command": "${env:HOME}/.pico-sdk/picotool/2.1.0/picotool/picotool",
|
||||
"args": [
|
||||
"load",
|
||||
"${command:raspberry-pi-pico.launchTargetPath}",
|
||||
"-fx"
|
||||
],
|
||||
"presentation": {
|
||||
"echo": true,
|
||||
"reveal": "always",
|
||||
"focus": true,
|
||||
"panel": "shared",
|
||||
"showReuseMessage": true,
|
||||
"clear": true
|
||||
},
|
||||
"problemMatcher": [],
|
||||
"windows": {
|
||||
"command": "${env:USERPROFILE}/.pico-sdk/picotool/2.1.0/picotool/picotool.exe"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Flash",
|
||||
"type": "process",
|
||||
"command": "${userHome}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
"args": [
|
||||
"-s",
|
||||
"${userHome}/.pico-sdk/openocd/0.12.0+dev/scripts",
|
||||
"-f",
|
||||
"interface/cmsis-dap.cfg",
|
||||
"-f",
|
||||
"target/${command:raspberry-pi-pico.getTarget}.cfg",
|
||||
"-c", "adapter speed 5000; program \"${command:raspberry-pi-pico.launchTargetPath}\" verify",
|
||||
"-c", "reset halt",
|
||||
"-c", "rp2040.core1 arp_reset assert 0",
|
||||
"-c", "rp2040.core0 arp_reset assert 0",
|
||||
"-c", "exit"
|
||||
],
|
||||
"presentation": {
|
||||
"echo": true,
|
||||
"reveal": "always",
|
||||
"focus": true,
|
||||
"panel": "shared",
|
||||
"showReuseMessage": true,
|
||||
"clear": true
|
||||
},
|
||||
"dependsOn": ["Compile Project"],
|
||||
"problemMatcher": [],
|
||||
"windows": {
|
||||
"command": "${env:USERPROFILE}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Reset",
|
||||
"type": "process",
|
||||
"command": "${userHome}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
"args": [
|
||||
"-s",
|
||||
"${userHome}/.pico-sdk/openocd/0.12.0+dev/scripts",
|
||||
"-f",
|
||||
"interface/cmsis-dap.cfg",
|
||||
"-f", "target/${command:raspberry-pi-pico.getTarget}.cfg",
|
||||
"-c", "adapter speed 5000; init; reset halt;",
|
||||
"-c", "rp2040.core1 arp_reset assert 0",
|
||||
"-c", "rp2040.core0 arp_reset assert 0",
|
||||
"-c", "exit"
|
||||
],
|
||||
"presentation": {
|
||||
"echo": true,
|
||||
"reveal": "always",
|
||||
"focus": true,
|
||||
"panel": "shared",
|
||||
"showReuseMessage": true,
|
||||
"clear": true
|
||||
},
|
||||
"problemMatcher": [],
|
||||
"windows": {
|
||||
"command": "${env:USERPROFILE}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
75
i2c-hub/firmware/i2c-hub-firmware/CMakeLists.txt
Normal file
75
i2c-hub/firmware/i2c-hub-firmware/CMakeLists.txt
Normal file
@@ -0,0 +1,75 @@
|
||||
# Generated Cmake Pico project file
|
||||
set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "ON")
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# Initialise pico_sdk from installed location
|
||||
# (note this can come from environment, CMake cache etc)
|
||||
|
||||
# == DO NOT EDIT THE FOLLOWING LINES for the Raspberry Pi Pico VS Code Extension to work ==
|
||||
if(WIN32)
|
||||
set(USERHOME $ENV{USERPROFILE})
|
||||
else()
|
||||
set(USERHOME $ENV{HOME})
|
||||
endif()
|
||||
set(sdkVersion 2.1.0)
|
||||
set(toolchainVersion 13_3_Rel1)
|
||||
set(picotoolVersion 2.1.0)
|
||||
set(picoVscode ${USERHOME}/.pico-sdk/cmake/pico-vscode.cmake)
|
||||
if (EXISTS ${picoVscode})
|
||||
include(${picoVscode})
|
||||
endif()
|
||||
# ====================================================================================
|
||||
set(PICO_BOARD pico CACHE STRING "Board type")
|
||||
|
||||
# Pull in Raspberry Pi Pico SDK (must be before project)
|
||||
include(pico_sdk_import.cmake)
|
||||
|
||||
# Adding FreeRTOS
|
||||
set(FREERTOS_KERNEL_PATH ../lib/FreeRTOS-Kernel)
|
||||
include(cmake/FreeRTOS_Kernel_import.cmake)
|
||||
include(src/gobotrpc/cmake/CMakeLists.txt)
|
||||
|
||||
project(i2c-hub-firmware C CXX ASM)
|
||||
|
||||
# Initialise the Raspberry Pi Pico SDK
|
||||
pico_sdk_init()
|
||||
|
||||
# Add executable. Default name is the project name, version 0.1
|
||||
|
||||
add_executable(i2c-hub-firmware
|
||||
src/main_core0.cpp
|
||||
src/main_core1.cpp
|
||||
#src/freeRTOS_impl.c
|
||||
)
|
||||
|
||||
pico_set_program_name(i2c-hub-firmware "i2c-hub-firmware")
|
||||
pico_set_program_version(i2c-hub-firmware "0.1")
|
||||
|
||||
# Modify the below lines to enable/disable output over UART/USB
|
||||
pico_enable_stdio_uart(i2c-hub-firmware 1)
|
||||
pico_enable_stdio_usb(i2c-hub-firmware 0)
|
||||
|
||||
# Add the standard library to the build
|
||||
target_link_libraries(i2c-hub-firmware
|
||||
FreeRTOS-Kernel-Heap4
|
||||
GobotRPC
|
||||
pico_stdlib
|
||||
)
|
||||
|
||||
# Add the standard include files to the build
|
||||
target_include_directories(i2c-hub-firmware PRIVATE
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
${CMAKE_CURRENT_LIST_DIR}/include
|
||||
)
|
||||
|
||||
# Add any user requested libraries
|
||||
target_link_libraries(i2c-hub-firmware
|
||||
hardware_i2c
|
||||
)
|
||||
|
||||
pico_add_extra_outputs(i2c-hub-firmware)
|
||||
|
||||
143
i2c-hub/firmware/i2c-hub-firmware/FreeRTOSConfig.h
Normal file
143
i2c-hub/firmware/i2c-hub-firmware/FreeRTOSConfig.h
Normal file
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* FreeRTOS V202111.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* http://www.FreeRTOS.org
|
||||
* http://aws.amazon.com/freertos
|
||||
*
|
||||
* 1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
*
|
||||
* See http://www.freertos.org/a00110.html
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
/* Scheduler Related */
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_TICKLESS_IDLE 0
|
||||
#define configUSE_IDLE_HOOK 0
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
|
||||
#define configMAX_PRIORITIES 32
|
||||
#define configMINIMAL_STACK_SIZE ( configSTACK_DEPTH_TYPE ) 256
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
|
||||
/* Synchronization Related */
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configUSE_APPLICATION_TASK_TAG 0
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configQUEUE_REGISTRY_SIZE 8
|
||||
#define configUSE_QUEUE_SETS 1
|
||||
#define configUSE_TIME_SLICING 1
|
||||
#define configUSE_NEWLIB_REENTRANT 0
|
||||
// todo need this for lwip FreeRTOS sys_arch to compile
|
||||
#define configENABLE_BACKWARD_COMPATIBILITY 1
|
||||
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 5
|
||||
|
||||
/* System */
|
||||
#define configSTACK_DEPTH_TYPE uint32_t
|
||||
#define configMESSAGE_BUFFER_LENGTH_TYPE size_t
|
||||
|
||||
/* Memory allocation related definitions. */
|
||||
#define configSUPPORT_STATIC_ALLOCATION 0
|
||||
#define configSUPPORT_DYNAMIC_ALLOCATION 1
|
||||
#define configTOTAL_HEAP_SIZE (1024 * 128)
|
||||
#define configAPPLICATION_ALLOCATED_HEAP (1024 * 84)
|
||||
|
||||
/* Hook function related definitions. */
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 0
|
||||
#define configUSE_MALLOC_FAILED_HOOK 0
|
||||
#define configUSE_DAEMON_TASK_STARTUP_HOOK 0
|
||||
|
||||
/* Run time and task stats gathering related definitions. */
|
||||
#define configGENERATE_RUN_TIME_STATS 0
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
|
||||
|
||||
/* Co-routine related definitions. */
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES 1
|
||||
|
||||
/* Software timer related definitions. */
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
|
||||
#define configTIMER_QUEUE_LENGTH 10
|
||||
#define configTIMER_TASK_STACK_DEPTH 1024
|
||||
|
||||
/* Interrupt nesting behaviour configuration. */
|
||||
/*
|
||||
#define configKERNEL_INTERRUPT_PRIORITY [dependent of processor]
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY [dependent on processor and application]
|
||||
#define configMAX_API_CALL_INTERRUPT_PRIORITY [dependent on processor and application]
|
||||
*/
|
||||
|
||||
#if FREE_RTOS_KERNEL_SMP // set by the RP2040 SMP port of FreeRTOS
|
||||
/* SMP port only */
|
||||
#define configNUMBER_OF_CORES 2
|
||||
#define configTICK_CORE 0
|
||||
#define configRUN_MULTIPLE_PRIORITIES 1
|
||||
#define configUSE_CORE_AFFINITY 1
|
||||
#define configUSE_PASSIVE_IDLE_HOOK 0
|
||||
#endif
|
||||
|
||||
/* RP2040 specific */
|
||||
#define configSUPPORT_PICO_SYNC_INTEROP 1
|
||||
#define configSUPPORT_PICO_TIME_INTEROP 1
|
||||
|
||||
#include <assert.h>
|
||||
/* Define to trap errors during development. */
|
||||
#define configASSERT(x) assert(x)
|
||||
|
||||
/* Set the following definitions to 1 to include the API function, or zero
|
||||
to exclude the API function. */
|
||||
#define INCLUDE_vTaskPrioritySet 1
|
||||
#define INCLUDE_uxTaskPriorityGet 1
|
||||
#define INCLUDE_vTaskDelete 1
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_xTaskGetSchedulerState 1
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 1
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 1
|
||||
#define INCLUDE_xTaskGetIdleTaskHandle 1
|
||||
#define INCLUDE_eTaskGetState 1
|
||||
#define INCLUDE_xTimerPendFunctionCall 1
|
||||
#define INCLUDE_xTaskAbortDelay 1
|
||||
#define INCLUDE_xTaskGetHandle 1
|
||||
#define INCLUDE_xTaskResumeFromISR 1
|
||||
#define INCLUDE_xQueueGetMutexHolder 1
|
||||
|
||||
/* A header file that defines trace macro can be included here. */
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
||||
@@ -0,0 +1,61 @@
|
||||
# This is a copy of <FREERTOS_KERNEL_PATH>/portable/ThirdParty/GCC/RP2040/FREERTOS_KERNEL_import.cmake
|
||||
|
||||
# This can be dropped into an external project to help locate the FreeRTOS kernel
|
||||
# It should be include()ed prior to project(). Alternatively this file may
|
||||
# or the CMakeLists.txt in this directory may be included or added via add_subdirectory
|
||||
# respectively.
|
||||
|
||||
if (DEFINED ENV{FREERTOS_KERNEL_PATH} AND (NOT FREERTOS_KERNEL_PATH))
|
||||
set(FREERTOS_KERNEL_PATH $ENV{FREERTOS_KERNEL_PATH})
|
||||
message("Using FREERTOS_KERNEL_PATH from environment ('${FREERTOS_KERNEL_PATH}')")
|
||||
endif ()
|
||||
|
||||
set(FREERTOS_KERNEL_RP2040_RELATIVE_PATH "portable/ThirdParty/GCC/RP2040")
|
||||
# undo the above
|
||||
set(FREERTOS_KERNEL_RP2040_BACK_PATH "../../../..")
|
||||
|
||||
if (NOT FREERTOS_KERNEL_PATH)
|
||||
# check if we are inside the FreeRTOS kernel tree (i.e. this file has been included directly)
|
||||
get_filename_component(_ACTUAL_PATH ${CMAKE_CURRENT_LIST_DIR} REALPATH)
|
||||
get_filename_component(_POSSIBLE_PATH ${CMAKE_CURRENT_LIST_DIR}/${FREERTOS_KERNEL_RP2040_BACK_PATH}/${FREERTOS_KERNEL_RP2040_RELATIVE_PATH} REALPATH)
|
||||
if (_ACTUAL_PATH STREQUAL _POSSIBLE_PATH)
|
||||
get_filename_component(FREERTOS_KERNEL_PATH ${CMAKE_CURRENT_LIST_DIR}/${FREERTOS_KERNEL_RP2040_BACK_PATH} REALPATH)
|
||||
endif()
|
||||
if (_ACTUAL_PATH STREQUAL _POSSIBLE_PATH)
|
||||
get_filename_component(FREERTOS_KERNEL_PATH ${CMAKE_CURRENT_LIST_DIR}/${FREERTOS_KERNEL_RP2040_BACK_PATH} REALPATH)
|
||||
message("Setting FREERTOS_KERNEL_PATH to ${FREERTOS_KERNEL_PATH} based on location of FreeRTOS-Kernel-import.cmake")
|
||||
elseif (PICO_SDK_PATH AND EXISTS "${PICO_SDK_PATH}/../FreeRTOS-Kernel")
|
||||
set(FREERTOS_KERNEL_PATH ${PICO_SDK_PATH}/../FreeRTOS-Kernel)
|
||||
message("Defaulting FREERTOS_KERNEL_PATH as sibling of PICO_SDK_PATH: ${FREERTOS_KERNEL_PATH}")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if (NOT FREERTOS_KERNEL_PATH)
|
||||
foreach(POSSIBLE_SUFFIX Source FreeRTOS-Kernel FreeRTOS/Source)
|
||||
# check if FreeRTOS-Kernel exists under directory that included us
|
||||
set(SEARCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
get_filename_component(_POSSIBLE_PATH ${SEARCH_ROOT}/${POSSIBLE_SUFFIX} REALPATH)
|
||||
if (EXISTS ${_POSSIBLE_PATH}/${FREERTOS_KERNEL_RP2040_RELATIVE_PATH}/CMakeLists.txt)
|
||||
get_filename_component(FREERTOS_KERNEL_PATH ${_POSSIBLE_PATH} REALPATH)
|
||||
message("Setting FREERTOS_KERNEL_PATH to '${FREERTOS_KERNEL_PATH}' found relative to enclosing project")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if (NOT FREERTOS_KERNEL_PATH)
|
||||
message(FATAL_ERROR "FreeRTOS location was not specified. Please set FREERTOS_KERNEL_PATH.")
|
||||
endif()
|
||||
|
||||
set(FREERTOS_KERNEL_PATH "${FREERTOS_KERNEL_PATH}" CACHE PATH "Path to the FreeRTOS Kernel")
|
||||
|
||||
get_filename_component(FREERTOS_KERNEL_PATH "${FREERTOS_KERNEL_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
|
||||
if (NOT EXISTS ${FREERTOS_KERNEL_PATH})
|
||||
message(FATAL_ERROR "Directory '${FREERTOS_KERNEL_PATH}' not found")
|
||||
endif()
|
||||
if (NOT EXISTS ${FREERTOS_KERNEL_PATH}/${FREERTOS_KERNEL_RP2040_RELATIVE_PATH}/CMakeLists.txt)
|
||||
message(FATAL_ERROR "Directory '${FREERTOS_KERNEL_PATH}' does not contain an RP2040 port here: ${FREERTOS_KERNEL_RP2040_RELATIVE_PATH}")
|
||||
endif()
|
||||
set(FREERTOS_KERNEL_PATH ${FREERTOS_KERNEL_PATH} CACHE PATH "Path to the FreeRTOS_KERNEL" FORCE)
|
||||
|
||||
add_subdirectory(${FREERTOS_KERNEL_PATH}/${FREERTOS_KERNEL_RP2040_RELATIVE_PATH} FREERTOS_KERNEL)
|
||||
1708
i2c-hub/firmware/i2c-hub-firmware/docs/.$NetworkStack.drawio.bkp
Normal file
1708
i2c-hub/firmware/i2c-hub-firmware/docs/.$NetworkStack.drawio.bkp
Normal file
File diff suppressed because it is too large
Load Diff
1708
i2c-hub/firmware/i2c-hub-firmware/docs/NetworkStack.drawio
Normal file
1708
i2c-hub/firmware/i2c-hub-firmware/docs/NetworkStack.drawio
Normal file
File diff suppressed because it is too large
Load Diff
23
i2c-hub/firmware/i2c-hub-firmware/include/pinConfig.hpp
Normal file
23
i2c-hub/firmware/i2c-hub-firmware/include/pinConfig.hpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#define LED1_PIN 8
|
||||
#define LED2_PIN 9
|
||||
#define LED3_PIN 25
|
||||
|
||||
#define GOBOTRPC_CI_UART_RX 0
|
||||
#define GOBOTRPC_CI_UART_TX 1
|
||||
|
||||
#define GOBOTRPC_TI_I2C_SDA 4
|
||||
#define GOBOTRPC_TI_I2C_SCL 5
|
||||
#define GOBOTRPC_TI_CLOCK_SPEED 10000
|
||||
|
||||
#define GOBOTRPC_TI_INT_PIN_START 10
|
||||
#define GOBOTRPC_TI_INT_NUM 4
|
||||
#define GOBOTRPC_TI_COMBINED_INT_PIN 18
|
||||
|
||||
#define GOBOTRPC_TI_EXTERNAL_PULLUP 1
|
||||
|
||||
#define GOBOTRPC_HEARTBEAT_INTERVAL 3000
|
||||
|
||||
#define UART_CORE_MASK 0b01
|
||||
#define I2C_CORE_MASK 0b01
|
||||
Submodule i2c-hub/firmware/i2c-hub-firmware/lib/FreeRTOS-Kernel added at dbf70559b2
84
i2c-hub/firmware/i2c-hub-firmware/pico_sdk_import.cmake
Normal file
84
i2c-hub/firmware/i2c-hub-firmware/pico_sdk_import.cmake
Normal file
@@ -0,0 +1,84 @@
|
||||
# This is a copy of <PICO_SDK_PATH>/external/pico_sdk_import.cmake
|
||||
|
||||
# This can be dropped into an external project to help locate this SDK
|
||||
# It should be include()ed prior to project()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH))
|
||||
set(PICO_SDK_PATH $ENV{PICO_SDK_PATH})
|
||||
message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')")
|
||||
endif ()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT))
|
||||
set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT})
|
||||
message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')")
|
||||
endif ()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH))
|
||||
set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH})
|
||||
message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')")
|
||||
endif ()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_TAG} AND (NOT PICO_SDK_FETCH_FROM_GIT_TAG))
|
||||
set(PICO_SDK_FETCH_FROM_GIT_TAG $ENV{PICO_SDK_FETCH_FROM_GIT_TAG})
|
||||
message("Using PICO_SDK_FETCH_FROM_GIT_TAG from environment ('${PICO_SDK_FETCH_FROM_GIT_TAG}')")
|
||||
endif ()
|
||||
|
||||
if (PICO_SDK_FETCH_FROM_GIT AND NOT PICO_SDK_FETCH_FROM_GIT_TAG)
|
||||
set(PICO_SDK_FETCH_FROM_GIT_TAG "master")
|
||||
message("Using master as default value for PICO_SDK_FETCH_FROM_GIT_TAG")
|
||||
endif()
|
||||
|
||||
set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK")
|
||||
set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable")
|
||||
set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK")
|
||||
set(PICO_SDK_FETCH_FROM_GIT_TAG "${PICO_SDK_FETCH_FROM_GIT_TAG}" CACHE FILEPATH "release tag for SDK")
|
||||
|
||||
if (NOT PICO_SDK_PATH)
|
||||
if (PICO_SDK_FETCH_FROM_GIT)
|
||||
include(FetchContent)
|
||||
set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR})
|
||||
if (PICO_SDK_FETCH_FROM_GIT_PATH)
|
||||
get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")
|
||||
endif ()
|
||||
# GIT_SUBMODULES_RECURSE was added in 3.17
|
||||
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0")
|
||||
FetchContent_Declare(
|
||||
pico_sdk
|
||||
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
|
||||
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
|
||||
GIT_SUBMODULES_RECURSE FALSE
|
||||
)
|
||||
else ()
|
||||
FetchContent_Declare(
|
||||
pico_sdk
|
||||
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
|
||||
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (NOT pico_sdk)
|
||||
message("Downloading Raspberry Pi Pico SDK")
|
||||
FetchContent_Populate(pico_sdk)
|
||||
set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR})
|
||||
endif ()
|
||||
set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE})
|
||||
else ()
|
||||
message(FATAL_ERROR
|
||||
"SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git."
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
|
||||
if (NOT EXISTS ${PICO_SDK_PATH})
|
||||
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found")
|
||||
endif ()
|
||||
|
||||
set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake)
|
||||
if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE})
|
||||
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK")
|
||||
endif ()
|
||||
|
||||
set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE)
|
||||
|
||||
include(${PICO_SDK_INIT_CMAKE_FILE})
|
||||
@@ -0,0 +1,29 @@
|
||||
add_library(GobotRPC STATIC
|
||||
${CMAKE_CURRENT_LIST_DIR}/../ctrl_interface/base.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/../ctrl_interface/ci_instruction.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/../ctrl_interface/uart_rp2040/hardware_rp2040_uart.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/../ctrl_interface/uart_rp2040/rx.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/../crc16.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/../protocol_base.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/../transmission_interface/rp2040_i2c_init.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/../transmission_interface/rp2040_i2c_tx.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/../transmission_interface/rp2040_i2c_rx.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/../transmission_interface/rp2040_i2c_int.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/../transmission_interface/rp2040_i2c_ci_instructions.cpp
|
||||
)
|
||||
|
||||
target_include_directories(GobotRPC PUBLIC
|
||||
${CMAKE_CURRENT_LIST_DIR}/../include
|
||||
${CMAKE_CURRENT_LIST_DIR}/../include/util
|
||||
${CMAKE_CURRENT_LIST_DIR}/../include/ti
|
||||
${CMAKE_CURRENT_LIST_DIR}/../../..
|
||||
${CMAKE_CURRENT_LIST_DIR}/../../../include
|
||||
)
|
||||
|
||||
target_link_libraries(GobotRPC
|
||||
FreeRTOS-Kernel-Heap4
|
||||
pico_stdlib
|
||||
hardware_uart
|
||||
hardware_irq
|
||||
hardware_i2c
|
||||
)
|
||||
@@ -0,0 +1,19 @@
|
||||
add_library(GobotRPC_Node_RP2040_I2C STATIC
|
||||
${CMAKE_CURRENT_LIST_DIR}/../node_interface/rp2040/i2c/init.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/../node_interface/rp2040/i2c/rx_tx.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/../crc16.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/../protocol_base.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/../node_interface/init.cpp
|
||||
)
|
||||
target_include_directories(GobotRPC_Node_RP2040_I2C PUBLIC
|
||||
${CMAKE_CURRENT_LIST_DIR}/../node_interface/include
|
||||
${CMAKE_CURRENT_LIST_DIR}/../include/util
|
||||
${CMAKE_CURRENT_LIST_DIR}/../../..
|
||||
)
|
||||
|
||||
target_link_libraries(GobotRPC_Node_RP2040_I2C
|
||||
FreeRTOS-Kernel-Heap4
|
||||
pico_stdlib
|
||||
hardware_i2c
|
||||
hardware_irq
|
||||
)
|
||||
39
i2c-hub/firmware/i2c-hub-firmware/src/gobotrpc/crc16.cpp
Normal file
39
i2c-hub/firmware/i2c-hub-firmware/src/gobotrpc/crc16.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
#include "crc16.hpp"
|
||||
|
||||
#define POLY 0x8408
|
||||
/*
|
||||
// 16 12 5
|
||||
// this is the CCITT CRC 16 polynomial X + X + X + 1.
|
||||
// This works out to be 0x1021, but the way the algorithm works
|
||||
// lets us use 0x8408 (the reverse of the bit pattern). The high
|
||||
// bit is always assumed to be set, thus we only use 16 bits to
|
||||
// represent the 17 bit value.
|
||||
*/
|
||||
|
||||
unsigned short crc16(char *data_p, unsigned short length)
|
||||
{
|
||||
unsigned char i;
|
||||
unsigned int data;
|
||||
unsigned int crc = 0xffff;
|
||||
|
||||
if (length == 0)
|
||||
return (~crc);
|
||||
|
||||
do
|
||||
{
|
||||
for (i=0, data=(unsigned int)0xff & *data_p++;
|
||||
i < 8;
|
||||
i++, data >>= 1)
|
||||
{
|
||||
if ((crc & 0x0001) ^ (data & 0x0001))
|
||||
crc = (crc >> 1) ^ POLY;
|
||||
else crc >>= 1;
|
||||
}
|
||||
} while (--length);
|
||||
|
||||
crc = ~crc;
|
||||
data = crc;
|
||||
crc = (crc << 8) | (data >> 8 & 0xff);
|
||||
|
||||
return (crc);
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
#include "ci/base.hpp"
|
||||
#include "pinConfig.hpp"
|
||||
|
||||
#include "protocol.hpp"
|
||||
|
||||
#include "pico/stdlib.h"
|
||||
#include "hardware/watchdog.h"
|
||||
|
||||
#include "FreeRTOSConfig.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
|
||||
GobotRPC_CI::GobotRPC_CI(I_GobotRPC_CI_Hardware *hardware, UBaseType_t core, QueueHandle_t ciInstructionQueue, QueueHandle_t ciInstructionReverseQueue) {
|
||||
this->ciInstructionQueue = ciInstructionQueue;
|
||||
this->ciInstructionReverseQueue = ciInstructionReverseQueue;
|
||||
|
||||
this->hardware = hardware;
|
||||
this->hardware->registerCB_RxData(GobotRPC_CI_rxData_cb, this);
|
||||
|
||||
this->cb_TxPacket = NULL;
|
||||
this->cb_TxPacket_args = NULL;
|
||||
this->cb_SetAddressMap = NULL;
|
||||
this->cb_SetAddressMap_args = NULL;
|
||||
|
||||
xTaskCreateAffinitySet(GobotRPC_CI_heartBeatTaskFn, "Heartbeat Task", 2048, this, 2, core, &this->heartBeatTaskHandle);
|
||||
xTaskCreateAffinitySet(GobotRPC_CI_txCIInstructionTaskFn, "Tx CI Instruction Task", 2048, this, 3, core, &this->txCIInstructionTaskHandle);
|
||||
}
|
||||
|
||||
// Rx Side
|
||||
void GobotRPC_CI_rxData_cb(void * args, char *data, size_t len) {
|
||||
GobotRPC_CI *gobotRPC = (GobotRPC_CI *)args;
|
||||
gobotRPC->onRxData(data, len);
|
||||
}
|
||||
|
||||
void GobotRPC_CI::onRxData(char *data, size_t len) {
|
||||
GobotRPC_CI_CMD cmd = (GobotRPC_CI_CMD)data[0];
|
||||
|
||||
switch (cmd) {
|
||||
case TX_CI_PACKET:
|
||||
if(this->cb_TxPacket != NULL) {
|
||||
uint32_t addr = (data[2] << 24) | (data[3] << 16) | (data[4] << 8) | data[5];
|
||||
this->cb_TxPacket(this->cb_TxPacket_args, data+6, len-6, addr);
|
||||
}
|
||||
break;
|
||||
|
||||
case RESET_CI_PACKET:
|
||||
//softwareReset();
|
||||
break;
|
||||
|
||||
case SET_ADDR_PORT_MAP: {
|
||||
if(this->cb_SetAddressMap != NULL) {
|
||||
uint32_t addr = (data[2] << 24) | (data[3] << 16) | (data[4] << 8) | data[5];
|
||||
uint8_t port = data[6];
|
||||
this->cb_SetAddressMap(cb_SetAddressMap_args, addr, port);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GobotRPC_CI::registerCB_TxPacket(callback_TxPacket cb, void *args) {
|
||||
this->cb_TxPacket = cb;
|
||||
this->cb_TxPacket_args = args;
|
||||
}
|
||||
|
||||
void GobotRPC_CI::registerCB_SetAddress(callback_SetAddress cb, void *args) {
|
||||
this->cb_SetAddressMap = cb;
|
||||
this->cb_SetAddressMap_args = args;
|
||||
}
|
||||
|
||||
void GobotRPC_CI::send_RxPacket(char *data, size_t len, uint32_t addr) {
|
||||
data[0] = RX_CI_PACKET;
|
||||
data[1] = len + CI_RX_PACKAGE_DATA_OFFSET;
|
||||
|
||||
data[2] = (addr >> 24) & 0xff;
|
||||
data[3] = (addr >> 16) & 0xff;
|
||||
data[4] = (addr >> 8) & 0xff;
|
||||
data[5] = addr & 0xff;
|
||||
|
||||
this->hardware->send(data, len+6);
|
||||
}
|
||||
|
||||
// Heartbeat Task
|
||||
|
||||
void GobotRPC_CI_heartBeatTaskFn(void *args) {
|
||||
GobotRPC_CI *gobotRPC = (GobotRPC_CI *)args;
|
||||
gobotRPC->heartBeartTaskFn();
|
||||
}
|
||||
|
||||
void GobotRPC_CI::heartBeartTaskFn() {
|
||||
char heartBeatPacket[] = {HEARTBEAT, 0x02};
|
||||
while(1) {
|
||||
this->hardware->send(heartBeatPacket, 2);
|
||||
vTaskDelay(GOBOTRPC_HEARTBEAT_INTERVAL / portTICK_PERIOD_MS);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
#include "ci/base.hpp"
|
||||
|
||||
#include "ci/instructions.hpp"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "queue.h"
|
||||
|
||||
void GobotRPC_CI_txCIInstructionTaskFn(void *args) {
|
||||
GobotRPC_CI *gobotRPC = (GobotRPC_CI *)args;
|
||||
gobotRPC->txCIInstructionTask();
|
||||
}
|
||||
|
||||
void GobotRPC_CI::txCIInstructionTask() {
|
||||
while(1) {
|
||||
CI_Instruction_Transport ciInstruction;
|
||||
xQueueReceive(ciInstructionQueue, &ciInstruction, portMAX_DELAY);
|
||||
|
||||
switch (ciInstruction.type) {
|
||||
case CI_INSTRUCTION_SEND_TRANMISSION_ERROR: {
|
||||
uint32_t addr = ciInstruction.data[1] | (ciInstruction.data[2] << 8) | (ciInstruction.data[3] << 16) | (ciInstruction.data[4] << 24);
|
||||
uint8_t rx = ciInstruction.data[0];
|
||||
send_ErrorTransmission(rx, addr);
|
||||
break;
|
||||
}
|
||||
|
||||
case CI_INSTRUCTION_SEND_TRANMISSION_SUCCESS: {
|
||||
uint32_t addr = ciInstruction.data[0] \
|
||||
| (ciInstruction.data[1] << 8) \
|
||||
| (ciInstruction.data[2] << 16) \
|
||||
| (ciInstruction.data[3] << 24);
|
||||
send_SuccessTransmission(addr);
|
||||
break;
|
||||
}
|
||||
|
||||
case CI_INSTRUCTION_SEND_INFO_RESET:
|
||||
send_InfoReset();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GobotRPC_CI::send_ErrorTransmission(bool rx, uint64_t addr) {
|
||||
char errorPacket[7];
|
||||
|
||||
errorPacket[0] = ERROR_TRANMISSION;
|
||||
errorPacket[1] = 7;
|
||||
errorPacket[2] = rx ? 0x01 : 0x00;
|
||||
errorPacket[3] = (addr >> 24) & 0xff;
|
||||
errorPacket[4] = (addr >> 16) & 0xff;
|
||||
errorPacket[5] = (addr >> 8) & 0xff;
|
||||
errorPacket[6] = addr & 0xff;
|
||||
|
||||
this->hardware->send(errorPacket, 7);
|
||||
}
|
||||
|
||||
void GobotRPC_CI::send_SuccessTransmission(uint64_t addr) {
|
||||
char successPacket[6];
|
||||
|
||||
successPacket[0] = SUCESS_TRANMISSION;
|
||||
successPacket[1] = 6;
|
||||
successPacket[2] = (addr >> 24) & 0xff;
|
||||
successPacket[3] = (addr >> 16) & 0xff;
|
||||
successPacket[4] = (addr >> 8) & 0xff;
|
||||
successPacket[5] = addr & 0xff;
|
||||
|
||||
this->hardware->send(successPacket, 6);
|
||||
}
|
||||
|
||||
void GobotRPC_CI::send_InfoReset() {
|
||||
char resetPacket[2];
|
||||
|
||||
resetPacket[0] = RESET_INFO_CI_PACKET;
|
||||
resetPacket[1] = 2;
|
||||
|
||||
this->hardware->send(resetPacket, 2);
|
||||
}
|
||||
|
||||
// CI Reverse Instructions (CI -> TI)
|
||||
void GobotRPC_CI::send_rev_SetAddrMap(uint32_t addr, uint8_t port) {
|
||||
CI_Instruction_Transport ciInstruction;
|
||||
ciInstruction.type = CI_INSTRUCTION_REV_SEND_SET_ADDR_MAP;
|
||||
ciInstruction.data[0] = addr & 0xff;
|
||||
ciInstruction.data[1] = (addr >> 8) & 0xff;
|
||||
ciInstruction.data[2] = (addr >> 16) & 0xff;
|
||||
ciInstruction.data[3] = (addr >> 24) & 0xff;
|
||||
ciInstruction.data[4] = port;
|
||||
|
||||
xQueueSend(ciInstructionReverseQueue, &ciInstruction, portMAX_DELAY);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
#include "ci/hardware.hpp"
|
||||
#include "pinConfig.hpp"
|
||||
|
||||
#include "pico/stdlib.h"
|
||||
#include "hardware/uart.h"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "queue.h"
|
||||
#include <string.h>
|
||||
|
||||
// Initialize stuff
|
||||
GobotRPC_CI_Hardware_RP2040_UART * g_GobotRPC_CI_Hardware_RP2040_UART;
|
||||
|
||||
GobotRPC_CI_Hardware_RP2040_UART::GobotRPC_CI_Hardware_RP2040_UART(uart_inst_t *uart, uint baudrate, UBaseType_t core) {
|
||||
g_GobotRPC_CI_Hardware_RP2040_UART = this;
|
||||
this->core = core;
|
||||
|
||||
initRxTaskAndQueues();
|
||||
|
||||
uartTxMutex = xSemaphoreCreateMutex();
|
||||
|
||||
this->uart = uart;
|
||||
uart_init(this->uart, baudrate);
|
||||
|
||||
gpio_set_function(GOBOTRPC_CI_UART_RX, UART_FUNCSEL_NUM(uart, GOBOTRPC_CI_UART_RX));
|
||||
gpio_set_function(GOBOTRPC_CI_UART_TX, UART_FUNCSEL_NUM(uart, GOBOTRPC_CI_UART_TX));
|
||||
|
||||
uart_set_hw_flow(uart, false, false);
|
||||
uart_set_format(uart, 8, 1, UART_PARITY_NONE);
|
||||
uart_set_baudrate(uart, baudrate);
|
||||
uart_set_fifo_enabled(uart, true);
|
||||
|
||||
int UART_IRQ = uart == uart0 ? UART0_IRQ : UART1_IRQ;
|
||||
|
||||
irq_set_exclusive_handler(UART_IRQ, GobotRPC_CI_Hardware_RP2040_UART_isr);
|
||||
irq_set_enabled(UART_IRQ, true);
|
||||
|
||||
uart_set_irq_enables(uart, true, false);
|
||||
}
|
||||
|
||||
void GobotRPC_CI_Hardware_RP2040_UART::registerCB_RxData(callback_rxData cb, void *args) {
|
||||
this->cb_rxData = cb;
|
||||
this->cb_rxData_args = args;
|
||||
}
|
||||
|
||||
|
||||
// Sending data
|
||||
void GobotRPC_CI_Hardware_RP2040_UART::send(char *data, size_t len) {
|
||||
xSemaphoreTake(uartTxMutex, portMAX_DELAY);
|
||||
uart_write_blocking(this->uart, (uint8_t *)(data), len);
|
||||
uart_tx_wait_blocking(this->uart);
|
||||
xSemaphoreGive(uartTxMutex);
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
#include "ci/hardware.hpp"
|
||||
#include "pico/stdlib.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "FreeRTOSConfig.h"
|
||||
|
||||
// External Functions
|
||||
void GobotRPC_CI_Hardware_RP2040_UART_isr() {
|
||||
GobotRPC_CI_Hardware_RP2040_UART *uart = (GobotRPC_CI_Hardware_RP2040_UART *)g_GobotRPC_CI_Hardware_RP2040_UART;
|
||||
uart->onRx_ISR();
|
||||
};
|
||||
|
||||
void GobotRPC_CI_Hardware_RP2040_UART_Task_RXProcessing(void *args) {
|
||||
GobotRPC_CI_Hardware_RP2040_UART *uart = (GobotRPC_CI_Hardware_RP2040_UART *)args;
|
||||
uart->rxProcessingTaskFn();
|
||||
}
|
||||
|
||||
// Init
|
||||
|
||||
void GobotRPC_CI_Hardware_RP2040_UART::initRxTaskAndQueues() {
|
||||
emptyInputBuffersQueue = xQueueCreate(NUM_INPUT_BUFFERS, sizeof(inputBuffers_t *));
|
||||
filledInputBuffersQueue = xQueueCreate(NUM_INPUT_BUFFERS, sizeof(inputBuffers_t *));
|
||||
|
||||
for(int i = 0; i < NUM_INPUT_BUFFERS; i++) {
|
||||
inputBuffers_t * p = &inputBufferPool[i];
|
||||
memset(p->data, 0xff, 256);
|
||||
p->len = 0;
|
||||
p->state = NEW;
|
||||
p->expected_length = 0;
|
||||
xQueueSend(emptyInputBuffersQueue, &p, portMAX_DELAY);
|
||||
}
|
||||
|
||||
rxSignalSemaphore = xSemaphoreCreateBinary();
|
||||
|
||||
xTaskCreateAffinitySet(GobotRPC_CI_Hardware_RP2040_UART_Task_RXProcessing, "UART RX Processing", 1024, this, 3, core, &this->rxProcessingTaskHandle);
|
||||
}
|
||||
|
||||
inputBufferRXState_t fillBuffer(inputBuffers_t * buffer, char data) {
|
||||
switch(buffer->state) {
|
||||
case NEW:
|
||||
buffer->data[0] = data;
|
||||
buffer->len = 1;
|
||||
buffer->state = READ_SIZE;
|
||||
break;
|
||||
|
||||
case READ_SIZE:
|
||||
buffer->data[1] = data;
|
||||
buffer->expected_length = data;
|
||||
buffer->len += 1;
|
||||
|
||||
if(buffer->len == buffer->expected_length) {
|
||||
buffer->state = FULL;
|
||||
} else {
|
||||
buffer->state = READ_DATA;
|
||||
}
|
||||
break;
|
||||
|
||||
case READ_DATA:
|
||||
buffer->data[buffer->len] = data;
|
||||
buffer->len += 1;
|
||||
|
||||
if(buffer->len == buffer->expected_length) {
|
||||
buffer->state = FULL;
|
||||
} else {
|
||||
buffer->state = READ_DATA;
|
||||
}
|
||||
break;
|
||||
|
||||
case FULL:
|
||||
break;
|
||||
}
|
||||
return buffer->state;
|
||||
}
|
||||
|
||||
// real Task Fns
|
||||
void GobotRPC_CI_Hardware_RP2040_UART::onRx_ISR() {
|
||||
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||
|
||||
static inputBuffers_t * inputBuffer = NULL;
|
||||
|
||||
while (uart_is_readable(this->uart)) {
|
||||
|
||||
if(inputBuffer == NULL) {
|
||||
xQueueReceiveFromISR(emptyInputBuffersQueue, &inputBuffer, &xHigherPriorityTaskWoken);
|
||||
|
||||
if(inputBuffer == NULL) {
|
||||
return; // No more buffers -> device overload
|
||||
}
|
||||
|
||||
inputBuffer->state = NEW;
|
||||
inputBuffer->len = 0;
|
||||
inputBuffer->expected_length = 0;
|
||||
}
|
||||
|
||||
inputBufferRXState_t state = fillBuffer(inputBuffer, uart_getc(this->uart));
|
||||
|
||||
if (state == FULL) {
|
||||
xQueueSendFromISR(filledInputBuffersQueue, &inputBuffer, &xHigherPriorityTaskWoken);
|
||||
inputBuffer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
|
||||
}
|
||||
|
||||
|
||||
void GobotRPC_CI_Hardware_RP2040_UART::rxProcessingTaskFn() {
|
||||
inputBuffers_t * inputBuffer = NULL;
|
||||
|
||||
while(1) {
|
||||
xQueueReceive(filledInputBuffersQueue, &inputBuffer, portMAX_DELAY);
|
||||
|
||||
if(this->cb_rxData != NULL) {
|
||||
this->cb_rxData(this->cb_rxData_args, inputBuffer->data, inputBuffer->len);
|
||||
}
|
||||
|
||||
xQueueSend(emptyInputBuffersQueue, &inputBuffer, portMAX_DELAY);
|
||||
vTaskDelay(1000);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
#pragma once
|
||||
#include "ci/hardware.hpp"
|
||||
#include <strings.h>
|
||||
|
||||
enum GobotRPC_CI_CMD {
|
||||
TX_CI_PACKET = 0x01,
|
||||
RX_CI_PACKET = 0x02,
|
||||
SET_ADDR_PORT_MAP = 0x03,
|
||||
|
||||
SUCESS_TRANMISSION = 0xfc,
|
||||
ERROR_TRANMISSION = 0xfd,
|
||||
HEARTBEAT = 0xff,
|
||||
|
||||
RESET_CI_PACKET = 0xcc,
|
||||
RESET_INFO_CI_PACKET = 0xcd
|
||||
};
|
||||
|
||||
#define CI_TX_PACKAGE_DATA_OFFSET 6
|
||||
#define CI_TX_PACKAGE_SIZE(data_len) (data_len + CI_TX_PACKAGE_SIZE)
|
||||
|
||||
#define CI_RX_PACKAGE_DATA_OFFSET 6
|
||||
#define CI_RX_PACKAGE_SIZE(data_len) (data_len + CI_RX_PACKAGE_DATA_OFFSET)
|
||||
|
||||
typedef void (*callback_TxPacket)(void * args, char *data, size_t len, uint32_t addr);
|
||||
typedef void (*callback_SetAddress)(void * args, uint32_t addr, uint8_t port);
|
||||
|
||||
void GobotRPC_CI_rxData_cb(void * args, char *data, size_t len);
|
||||
void GobotRPC_CI_heartBeatTaskFn(void *args);
|
||||
void GobotRPC_CI_txCIInstructionTaskFn(void *args);
|
||||
|
||||
class GobotRPC_CI {
|
||||
private:
|
||||
I_GobotRPC_CI_Hardware *hardware;
|
||||
|
||||
callback_TxPacket cb_TxPacket;
|
||||
void * cb_TxPacket_args;
|
||||
|
||||
callback_SetAddress cb_SetAddressMap;
|
||||
void * cb_SetAddressMap_args;
|
||||
|
||||
TaskHandle_t heartBeatTaskHandle;
|
||||
TaskHandle_t txCIInstructionTaskHandle;
|
||||
|
||||
QueueHandle_t ciInstructionQueue;
|
||||
QueueHandle_t ciInstructionReverseQueue;
|
||||
public:
|
||||
GobotRPC_CI(I_GobotRPC_CI_Hardware *hardware, UBaseType_t core, QueueHandle_t ciInstructionQueue, QueueHandle_t ciInstructionReverseQueue);
|
||||
|
||||
void registerCB_TxPacket(callback_TxPacket cb, void *args);
|
||||
void registerCB_SetAddress(callback_SetAddress cb, void *args);
|
||||
|
||||
void send_RxPacket(char *data, size_t len, uint32_t addr);
|
||||
|
||||
void onRxData(char *data, size_t len);
|
||||
|
||||
void heartBeartTaskFn();
|
||||
|
||||
// CI Instruction Stuff
|
||||
void send_rev_SetAddrMap(uint32_t addr, uint8_t port);
|
||||
void txCIInstructionTask();
|
||||
void send_ErrorTransmission(bool rx, uint64_t addr);
|
||||
void send_SuccessTransmission(uint64_t addr);
|
||||
void send_InfoReset();
|
||||
};
|
||||
@@ -0,0 +1,73 @@
|
||||
#pragma once
|
||||
#include <strings.h>
|
||||
|
||||
#include "FreeRTOSConfig.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "semphr.h"
|
||||
#include "queue.h"
|
||||
|
||||
typedef void (*callback_rxData)(void * args, char *data, size_t len);
|
||||
|
||||
class I_GobotRPC_CI_Hardware {
|
||||
public:
|
||||
virtual void send(char *data, size_t len) = 0;
|
||||
virtual void registerCB_RxData(callback_rxData cb, void *args) = 0;
|
||||
};
|
||||
|
||||
|
||||
#include "hardware/uart.h"
|
||||
|
||||
void GobotRPC_CI_Hardware_RP2040_UART_isr();
|
||||
void GobotRPC_CI_Hardware_RP2040_UART_Task_RXBuffering(void *args);
|
||||
void GobotRPC_CI_Hardware_RP2040_UART_Task_RXProcessing(void *args);
|
||||
|
||||
#define NUM_INPUT_BUFFERS 16
|
||||
|
||||
enum inputBufferRXState_t {
|
||||
NEW,
|
||||
READ_SIZE,
|
||||
READ_DATA,
|
||||
FULL
|
||||
};
|
||||
|
||||
struct inputBuffers_t {
|
||||
char data[256];
|
||||
size_t expected_length;
|
||||
size_t len;
|
||||
inputBufferRXState_t state;
|
||||
};
|
||||
|
||||
class GobotRPC_CI_Hardware_RP2040_UART : public I_GobotRPC_CI_Hardware {
|
||||
private:
|
||||
uart_inst_t *uart;
|
||||
|
||||
inputBuffers_t inputBufferPool[NUM_INPUT_BUFFERS];
|
||||
|
||||
TaskHandle_t rxProcessingTaskHandle;
|
||||
|
||||
SemaphoreHandle_t rxSignalSemaphore;
|
||||
QueueHandle_t emptyInputBuffersQueue;
|
||||
QueueHandle_t filledInputBuffersQueue;
|
||||
|
||||
callback_rxData cb_rxData;
|
||||
void * cb_rxData_args;
|
||||
|
||||
SemaphoreHandle_t uartTxMutex;
|
||||
|
||||
UBaseType_t core;
|
||||
|
||||
public:
|
||||
GobotRPC_CI_Hardware_RP2040_UART(uart_inst_t *uart, uint baudrate, UBaseType_t core);
|
||||
void send(char *data, size_t len) override;
|
||||
void registerCB_RxData(callback_rxData cb, void *args);
|
||||
|
||||
void initRxTaskAndQueues();
|
||||
|
||||
void onRx_ISR();
|
||||
void rxBufferingTaskFn();
|
||||
void rxProcessingTaskFn();
|
||||
};
|
||||
|
||||
extern GobotRPC_CI_Hardware_RP2040_UART * g_GobotRPC_CI_Hardware_RP2040_UART;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
enum CI_Instruction_Type {
|
||||
CI_INSTRUCTION_SEND_TRANMISSION_ERROR,
|
||||
CI_INSTRUCTION_SEND_TRANMISSION_SUCCESS,
|
||||
CI_INSTRUCTION_SEND_INFO_RESET,
|
||||
CI_INSTRUCTION_REV_SEND_SET_ADDR_MAP,
|
||||
};
|
||||
|
||||
struct CI_Instruction_Transport {
|
||||
CI_Instruction_Type type;
|
||||
uint32_t addr;
|
||||
char data[16];
|
||||
};
|
||||
|
||||
struct CI_Instruction_Data_SEND_TRANMISSION_ERROR {
|
||||
bool rx;
|
||||
uint32_t addr;
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "FreeRTOSConfig.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "queue.h"
|
||||
|
||||
struct AppData {
|
||||
QueueHandle_t txQueue;
|
||||
QueueHandle_t rxQueue;
|
||||
QueueHandle_t ciInstructionQueue;
|
||||
QueueHandle_t ciInstructionReverseQueue;
|
||||
};
|
||||
|
||||
void main_core2(void * pvParameters);
|
||||
@@ -0,0 +1,98 @@
|
||||
#pragma once
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "semphr.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <strings.h>
|
||||
|
||||
#include "pico/stdlib.h"
|
||||
#include "hardware/i2c.h"
|
||||
|
||||
#include "pinConfig.hpp"
|
||||
|
||||
#include "ci/instructions.hpp"
|
||||
|
||||
struct GoRPCPackage_Transport {
|
||||
uint32_t addr;
|
||||
uint32_t len;
|
||||
char data[256];
|
||||
};
|
||||
|
||||
typedef void (*callback_pullPackage)(GoRPCPackage_Transport *src, void *args);
|
||||
typedef void (*callback_pushPackage)(GoRPCPackage_Transport *dest, void *args);
|
||||
typedef void (*callback_pushCIInstruction)(CI_Instruction_Transport *src, void *args);
|
||||
|
||||
class GobotRPC_TI_Hardware {
|
||||
public:
|
||||
virtual void registerPullPackageCB(callback_pullPackage cb, void *args) = 0;
|
||||
virtual void registerPushPackageCB(callback_pushPackage cb, void *args) = 0;
|
||||
virtual void registerPushCIInstructionCB(callback_pushCIInstruction cb, void *args) = 0;
|
||||
virtual void setAddrMap(uint32_t addr, int intNum) = 0;
|
||||
|
||||
void raiseTranmissionError(bool rx, uint32_t addr);
|
||||
void raiseTransmissionSuceess(uint32_t addr);
|
||||
void raiseInfoReset();
|
||||
};
|
||||
|
||||
void i2cRxTaskFn(void * args);
|
||||
void i2cTxTaskFn(void * args);
|
||||
|
||||
void intPin_ISR(uint gpio, uint32_t events);
|
||||
|
||||
class GobotRPC_TI_Hardware_RP2040_I2C : public GobotRPC_TI_Hardware {
|
||||
private:
|
||||
callback_pullPackage pullPackageCB;
|
||||
void *pullPackageCBArgs;
|
||||
|
||||
callback_pushPackage pushPackageCB;
|
||||
void *pushPackageCBArgs;
|
||||
|
||||
callback_pushCIInstruction pushCIInstructionCB;
|
||||
void *pushCIInstructionCBArgs;
|
||||
|
||||
SemaphoreHandle_t i2cMutex;
|
||||
SemaphoreHandle_t i2cRXSemaphore;
|
||||
|
||||
|
||||
TaskHandle_t i2cRxTaskHandle;
|
||||
TaskHandle_t i2cTxTaskHandle;
|
||||
TaskHandle_t i2cIntTaskHandle;
|
||||
TaskHandle_t revCIInstructionTaskHandle;
|
||||
|
||||
QueueHandle_t revCIInstructionQueue;
|
||||
|
||||
UBaseType_t core;
|
||||
|
||||
i2c_inst_t * i2c;
|
||||
|
||||
uint32_t intAddressMap[GOBOTRPC_TI_INT_NUM];
|
||||
|
||||
void initTasks();
|
||||
bool readI2C(GoRPCPackage_Transport * pkg, uint32_t addr);
|
||||
|
||||
public:
|
||||
GobotRPC_TI_Hardware_RP2040_I2C(UBaseType_t core, i2c_inst_t *i2c, QueueHandle_t revCIInstructionQueue);
|
||||
|
||||
void registerPullPackageCB(callback_pullPackage cb, void *args);
|
||||
void registerPushPackageCB(callback_pushPackage cb, void *args);
|
||||
void registerPushCIInstructionCB(callback_pushCIInstruction cb, void *args);
|
||||
|
||||
void setAddrMap(uint32_t addr, int intNum);
|
||||
|
||||
void i2cRxTask();
|
||||
void i2cTxTask();
|
||||
void manualTriggerIntTask();
|
||||
void intPinISR(BaseType_t * xHigherPriorityTaskWoken);
|
||||
uint32_t readIntPins();
|
||||
|
||||
void raiseTranmissionError(bool rx, uint32_t addr);
|
||||
void raiseTransmissionSuceess(uint32_t addr);
|
||||
void raiseInfoReset();
|
||||
|
||||
void revCIInstructionTask();
|
||||
};
|
||||
|
||||
|
||||
extern GobotRPC_TI_Hardware_RP2040_I2C * g_GobotRPC_TI_Hardware_RP2040_I2C;
|
||||
@@ -0,0 +1,2 @@
|
||||
#pragma once
|
||||
unsigned short crc16(char *data_p, unsigned short length);
|
||||
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
#include <strings.h>
|
||||
|
||||
enum GobotRPCNumber {
|
||||
HOME_XY = 0x1,
|
||||
SET_PADDING = 0x2,
|
||||
GOTO = 0x3,
|
||||
RELEASE_MOTORS = 0x4,
|
||||
|
||||
DROP_STONE = 0x5,
|
||||
MOVE_Z_AXIS = 0x7,
|
||||
|
||||
VACUM = 0x8,
|
||||
RESET = 0xc,
|
||||
GET_INFO = 0xd
|
||||
};
|
||||
|
||||
enum GobotRPCTypes {
|
||||
REQUEST = 0b00,
|
||||
RESPONSE = 0b01,
|
||||
ERROR = 0b10
|
||||
};
|
||||
|
||||
struct GobotRPCPackage_Req_Vacum {
|
||||
uint8_t enable : 8;
|
||||
};
|
||||
|
||||
#define GobotRPC_Package_DATA_OFFSET 2
|
||||
#define CALC_SIZE_GobotRPC_PACKAGE(data_len) (data_len + GobotRPC_Package_DATA_OFFSET + 2)
|
||||
|
||||
struct GobotRPCHeaderInfo {
|
||||
public:
|
||||
GobotRPCNumber number;
|
||||
GobotRPCTypes type;
|
||||
size_t len;
|
||||
};
|
||||
|
||||
void assembleGobotRPCHeader(char * buffer, GobotRPCNumber number, GobotRPCTypes data_size, size_t);
|
||||
void assembleCRC(char * buffer, size_t data_len);
|
||||
bool checkCRC(char * buffer, size_t data_len);
|
||||
|
||||
GobotRPCHeaderInfo extractGobotRPCHeader(char * buffer);
|
||||
|
||||
void softwareReset();
|
||||
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
#include "protocol.hpp"
|
||||
#include "node_interface_hardware.hpp"
|
||||
|
||||
#include "FreeRTOSConfig.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "queue.h"
|
||||
|
||||
typedef void (*onPackageRxCallback)(void * args, char *data, uint16_t len, GobotRPCTypes type, GobotRPCNumber number);
|
||||
|
||||
enum NODE_TYPE: uint8_t {
|
||||
NODE_TYPE_VACUM = 0xa1,
|
||||
NODE_TYPE_HEAD = 0xa2,
|
||||
NODE_TYPE_COREXY = 0xa3,
|
||||
};
|
||||
|
||||
struct InfoData {
|
||||
uint32_t addr;
|
||||
NODE_TYPE type;
|
||||
};
|
||||
|
||||
class GobotRPC_NI {
|
||||
private:
|
||||
onPackageRxCallback onPackageRx;
|
||||
void *onPackageRxArgs;
|
||||
|
||||
QueueHandle_t txQueue;
|
||||
QueueHandle_t rxQueue;
|
||||
TaskHandle_t rxTaskHandle;
|
||||
|
||||
InfoData info;
|
||||
|
||||
unsigned int core;
|
||||
|
||||
public:
|
||||
GobotRPC_NI(unsigned int core, QueueHandle_t txQueue, QueueHandle_t rxQueue, InfoData info);
|
||||
|
||||
void registerOnPackageRxCallback(onPackageRxCallback callback, void *context);
|
||||
void sendPackage(char *data, size_t len, GobotRPCTypes type, GobotRPCNumber number);
|
||||
|
||||
InfoData getInfo();
|
||||
|
||||
void rxTask();
|
||||
};
|
||||
@@ -0,0 +1,78 @@
|
||||
#pragma once
|
||||
|
||||
#include "FreeRTOSConfig.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "queue.h"
|
||||
|
||||
#include "pico/stdlib.h"
|
||||
#include "hardware/i2c.h"
|
||||
#include "hardware/irq.h"
|
||||
|
||||
struct GobotRPC_NI_Package_Transport {
|
||||
char data[256];
|
||||
uint length;
|
||||
uint index;
|
||||
};
|
||||
|
||||
enum I2C_WRITE_STATE {
|
||||
I2C_WRITE_STATE_FIRST,
|
||||
I2C_WRITE_STATE_LENGTH,
|
||||
I2C_WRITE_STATE_DATA,
|
||||
};
|
||||
|
||||
enum I2C_READ_STATE {
|
||||
I2C_READ_STAGE_FIRST,
|
||||
I2C_READ_STAGE_DONE,
|
||||
I2C_READ_STAGE_WIP,
|
||||
I2C_READ_STAGE_INVALID
|
||||
};
|
||||
|
||||
enum I2C_SLAVE_EVENT {
|
||||
I2C_SLAVE_RECEIVE,
|
||||
I2C_SLAVE_REQUEST,
|
||||
I2C_SLAVE_FINISH
|
||||
};
|
||||
|
||||
class GobotRPC_NI_Hardware {
|
||||
|
||||
};
|
||||
|
||||
struct GobotRPC_NI_Hardware_RP2040_I2C_PreTxQueues {
|
||||
QueueHandle_t isrPreTxQueue;
|
||||
QueueHandle_t isrTXQueue;
|
||||
};
|
||||
|
||||
class GobotRPC_NI_Hardware_RP2040_I2C : public GobotRPC_NI_Hardware {
|
||||
uint core;
|
||||
|
||||
QueueHandle_t isrPreTxQueue;
|
||||
QueueHandle_t isrTXQueue;
|
||||
QueueHandle_t isrRXQueue;
|
||||
TaskHandle_t preTxTaskHandle;
|
||||
|
||||
uint i2cSDA_PIN;
|
||||
uint i2cSCL_PIN;
|
||||
uint int_PIN;
|
||||
uint8_t i2cAddress;
|
||||
|
||||
I2C_WRITE_STATE writeState = I2C_WRITE_STATE_FIRST;
|
||||
I2C_READ_STATE readState = I2C_READ_STAGE_INVALID;
|
||||
|
||||
GobotRPC_NI_Package_Transport rxPackage;
|
||||
GobotRPC_NI_Package_Transport txPackage;
|
||||
|
||||
public:
|
||||
i2c_inst_t * i2c_inst;
|
||||
|
||||
GobotRPC_NI_Hardware_RP2040_I2C(
|
||||
xQueueHandle TXQueue, xQueueHandle RXQueue, uint core,
|
||||
i2c_inst_t * i2c_inst,
|
||||
uint8_t i2cAddress,
|
||||
uint i2cSDA_PIN, uint i2cSCL_PIN, uint int_PIN
|
||||
);
|
||||
|
||||
void onI2CIRQ(I2C_SLAVE_EVENT event, BaseType_t * xHigherPriorityTaskWoken);
|
||||
void preTxTask();
|
||||
};
|
||||
|
||||
extern GobotRPC_NI_Hardware_RP2040_I2C * g_gobotrpc_ni_hardware_rp2040_i2c;
|
||||
@@ -0,0 +1,73 @@
|
||||
#include "node_interface.hpp"
|
||||
|
||||
#include "FreeRTOSConfig.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include <string.h>
|
||||
|
||||
static void rxTaskFn(void *pvParameters) {
|
||||
GobotRPC_NI *ni = (GobotRPC_NI *)pvParameters;
|
||||
ni->rxTask();
|
||||
}
|
||||
|
||||
GobotRPC_NI::GobotRPC_NI(unsigned int core, QueueHandle_t txQueue, QueueHandle_t rxQueue, InfoData info) {
|
||||
this->core = core;
|
||||
this->info = info;
|
||||
|
||||
this->txQueue = txQueue;
|
||||
this->rxQueue = rxQueue;
|
||||
|
||||
this->onPackageRx = NULL;
|
||||
this->onPackageRxArgs = NULL;
|
||||
|
||||
xTaskCreateAffinitySet(
|
||||
rxTaskFn,
|
||||
"GobotRPC_NI RX Task",
|
||||
2048,
|
||||
this,
|
||||
4,
|
||||
this->core,
|
||||
&this->rxTaskHandle
|
||||
);
|
||||
}
|
||||
|
||||
void GobotRPC_NI::registerOnPackageRxCallback(onPackageRxCallback callback, void *context) {
|
||||
this->onPackageRx = callback;
|
||||
this->onPackageRxArgs = context;
|
||||
}
|
||||
|
||||
void GobotRPC_NI::rxTask() {
|
||||
while (true) {
|
||||
GobotRPC_NI_Package_Transport package;
|
||||
|
||||
if (xQueueReceive(this->rxQueue, &package, portMAX_DELAY) == pdTRUE) {
|
||||
GobotRPCHeaderInfo header = extractGobotRPCHeader(package.data);
|
||||
|
||||
if(this->onPackageRx != NULL) {
|
||||
if (!checkCRC(package.data, header.len)) {
|
||||
volatile int a = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
this->onPackageRx(
|
||||
onPackageRxArgs,
|
||||
package.data + GobotRPC_Package_DATA_OFFSET,
|
||||
header.len, header.type, header.number
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GobotRPC_NI::sendPackage(char *data, size_t len, GobotRPCTypes type, GobotRPCNumber number) {
|
||||
GobotRPC_NI_Package_Transport package;
|
||||
package.length = len + GobotRPC_Package_DATA_OFFSET + 2;
|
||||
memcpy(package.data + GobotRPC_Package_DATA_OFFSET, data, len);
|
||||
assembleGobotRPCHeader(package.data, number, type, len);
|
||||
assembleCRC(package.data, len);
|
||||
xQueueSend(this->txQueue, &package, portMAX_DELAY);
|
||||
}
|
||||
|
||||
InfoData GobotRPC_NI::getInfo() {
|
||||
return info;
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
#include "node_interface_hardware.hpp"
|
||||
#include "pico/stdlib.h"
|
||||
#include "hardware/i2c.h"
|
||||
#include <string.h>
|
||||
|
||||
GobotRPC_NI_Hardware_RP2040_I2C * g_gobotrpc_ni_hardware_rp2040_i2c;
|
||||
i2c_inst_t * g_i2c_inst;
|
||||
bool g_transfer_in_progress = false;
|
||||
|
||||
static void finish_transfer(BaseType_t * xHigherPriorityTaskWoken) {
|
||||
if(g_transfer_in_progress) {
|
||||
GobotRPC_NI_Hardware_RP2040_I2C * gobotrpc_ni = g_gobotrpc_ni_hardware_rp2040_i2c;
|
||||
g_transfer_in_progress = false;
|
||||
gobotrpc_ni->onI2CIRQ(I2C_SLAVE_FINISH, xHigherPriorityTaskWoken);
|
||||
}
|
||||
}
|
||||
|
||||
static void i2c_isr() {
|
||||
GobotRPC_NI_Hardware_RP2040_I2C * gobotrpc_ni = g_gobotrpc_ni_hardware_rp2040_i2c;
|
||||
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||
|
||||
i2c_hw_t * hw = i2c_get_hw(g_i2c_inst);
|
||||
uint32_t intr_stat = hw->intr_stat;
|
||||
|
||||
if (intr_stat == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (intr_stat & I2C_IC_INTR_STAT_R_TX_ABRT_BITS) {
|
||||
hw->clr_tx_abrt;
|
||||
finish_transfer(&xHigherPriorityTaskWoken);
|
||||
}
|
||||
|
||||
if (intr_stat & I2C_IC_INTR_STAT_R_START_DET_BITS) {
|
||||
hw->clr_start_det;
|
||||
finish_transfer(&xHigherPriorityTaskWoken);
|
||||
}
|
||||
|
||||
if (intr_stat & I2C_IC_INTR_STAT_R_STOP_DET_BITS) {
|
||||
hw->clr_stop_det;
|
||||
finish_transfer(&xHigherPriorityTaskWoken);
|
||||
}
|
||||
|
||||
if (intr_stat & I2C_IC_INTR_STAT_R_RX_FULL_BITS) {
|
||||
g_transfer_in_progress = true;
|
||||
gobotrpc_ni->onI2CIRQ(I2C_SLAVE_RECEIVE, &xHigherPriorityTaskWoken);
|
||||
}
|
||||
|
||||
if (intr_stat & I2C_IC_INTR_STAT_R_RD_REQ_BITS) {
|
||||
hw->clr_rd_req;
|
||||
g_transfer_in_progress = true;
|
||||
gobotrpc_ni->onI2CIRQ(I2C_SLAVE_REQUEST, &xHigherPriorityTaskWoken);
|
||||
}
|
||||
|
||||
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
|
||||
}
|
||||
|
||||
static void preTxTaskFn(void *pvParameters) {
|
||||
GobotRPC_NI_Hardware_RP2040_I2C * hw = (GobotRPC_NI_Hardware_RP2040_I2C *)(pvParameters);
|
||||
hw->preTxTask();
|
||||
};
|
||||
|
||||
GobotRPC_NI_Hardware_RP2040_I2C::GobotRPC_NI_Hardware_RP2040_I2C(
|
||||
xQueueHandle TXQueue, xQueueHandle RXQueue, uint core,
|
||||
i2c_inst_t * i2c_inst,
|
||||
uint8_t i2cAddress,
|
||||
uint i2cSDA_PIN, uint i2cSCL_PIN, uint int_PIN
|
||||
) {
|
||||
g_gobotrpc_ni_hardware_rp2040_i2c = this;
|
||||
g_i2c_inst = i2c_inst;
|
||||
|
||||
this->core = core;
|
||||
|
||||
this->readState = I2C_READ_STAGE_FIRST;
|
||||
this->writeState = I2C_WRITE_STATE_FIRST;
|
||||
|
||||
this->isrRXQueue = RXQueue;
|
||||
this->isrPreTxQueue = TXQueue;
|
||||
this->isrTXQueue = xQueueCreate(3, sizeof(GobotRPC_NI_Package_Transport));
|
||||
|
||||
xTaskCreateAffinitySet(
|
||||
preTxTaskFn,
|
||||
"GobotRPC_NI Hardware RP2040 I2C PreTx Task",
|
||||
2048,
|
||||
this,
|
||||
4,
|
||||
this->core,
|
||||
&this->preTxTaskHandle
|
||||
);
|
||||
|
||||
this->i2cSDA_PIN = i2cSDA_PIN;
|
||||
this->i2cSCL_PIN = i2cSCL_PIN;
|
||||
this->int_PIN = int_PIN;
|
||||
|
||||
this->i2cAddress = i2cAddress;
|
||||
this->i2c_inst = i2c_inst;
|
||||
|
||||
memset(&rxPackage.data, 0, sizeof(GobotRPC_NI_Package_Transport::data));
|
||||
memset(&txPackage.data, 0, sizeof(GobotRPC_NI_Package_Transport::data));
|
||||
|
||||
gpio_init(i2cSDA_PIN);
|
||||
gpio_init(i2cSCL_PIN);
|
||||
gpio_set_function(i2cSDA_PIN, GPIO_FUNC_I2C);
|
||||
gpio_set_function(i2cSCL_PIN, GPIO_FUNC_I2C);
|
||||
|
||||
gpio_init(int_PIN);
|
||||
gpio_set_dir(int_PIN, GPIO_OUT);
|
||||
gpio_put(int_PIN, 0);
|
||||
|
||||
// Note: The I2C slave does clock stretching implicitly after a RD_REQ, while the Tx FIFO is empty.
|
||||
// There is also an option to enable clock stretching while the Rx FIFO is full, but we leave it
|
||||
// disabled since the Rx FIFO should never fill up (unless slave->handler() is way too slow).
|
||||
i2c_set_slave_mode(i2c_inst, true, i2cAddress);
|
||||
|
||||
i2c_hw_t *hw = i2c_get_hw(i2c_inst);
|
||||
// unmask necessary interrupts
|
||||
hw->intr_mask = I2C_IC_INTR_MASK_M_RX_FULL_BITS |\
|
||||
I2C_IC_INTR_MASK_M_RD_REQ_BITS |\
|
||||
I2C_IC_RAW_INTR_STAT_TX_ABRT_BITS |\
|
||||
I2C_IC_INTR_MASK_M_STOP_DET_BITS |\
|
||||
I2C_IC_INTR_MASK_M_START_DET_BITS;
|
||||
|
||||
// enable interrupt for current core
|
||||
unsigned int intNum = i2c_inst == i2c0 ? I2C0_IRQ : I2C1_IRQ;
|
||||
irq_set_exclusive_handler(intNum, i2c_isr);
|
||||
irq_set_enabled(intNum, true);
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
#include "node_interface_hardware.hpp"
|
||||
#include "hardware/irq.h"
|
||||
|
||||
void GobotRPC_NI_Hardware_RP2040_I2C::onI2CIRQ(I2C_SLAVE_EVENT event, BaseType_t * xHigherPriorityTaskWoken) {
|
||||
|
||||
switch (event) {
|
||||
case I2C_SLAVE_RECEIVE: { // I2C Write from Master
|
||||
char data = i2c_read_byte_raw(i2c_inst);
|
||||
|
||||
switch (writeState) {
|
||||
case I2C_WRITE_STATE_FIRST:
|
||||
writeState = I2C_WRITE_STATE_LENGTH;
|
||||
rxPackage.index = 0;
|
||||
rxPackage.length = 0;
|
||||
rxPackage.data[rxPackage.index++] = data;
|
||||
break;
|
||||
|
||||
case I2C_WRITE_STATE_LENGTH:
|
||||
rxPackage.data[rxPackage.index++] = data;
|
||||
rxPackage.length = data;
|
||||
writeState = I2C_WRITE_STATE_DATA;
|
||||
break;
|
||||
|
||||
case I2C_WRITE_STATE_DATA:
|
||||
rxPackage.data[rxPackage.index++] = data;
|
||||
|
||||
if(rxPackage.index == rxPackage.length) {
|
||||
xQueueSendFromISR(isrRXQueue, &rxPackage, xHigherPriorityTaskWoken);
|
||||
writeState = I2C_WRITE_STATE_FIRST;
|
||||
} else {
|
||||
writeState = I2C_WRITE_STATE_DATA;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case I2C_SLAVE_REQUEST: {
|
||||
// I2C Read from Master
|
||||
//if(xQueueIsQueueEmptyFromISR(isrTXQueue) == pdTRUE) {
|
||||
// readState = I2C_READ_STAGE_INVALID;
|
||||
//}
|
||||
|
||||
switch (readState) {
|
||||
case I2C_READ_STAGE_INVALID:
|
||||
i2c_write_byte_raw(i2c_inst, 0x01);
|
||||
break;
|
||||
|
||||
case I2C_READ_STAGE_FIRST:
|
||||
xQueueReceiveFromISR(isrTXQueue, &txPackage, xHigherPriorityTaskWoken);
|
||||
txPackage.index = 0;
|
||||
i2c_write_byte_raw(i2c_inst, txPackage.data[txPackage.index++]);
|
||||
readState = I2C_READ_STAGE_WIP;
|
||||
break;
|
||||
|
||||
case I2C_READ_STAGE_WIP:
|
||||
i2c_write_byte_raw(i2c_inst, txPackage.data[txPackage.index++]);
|
||||
|
||||
if(txPackage.index == txPackage.length) {
|
||||
readState = I2C_READ_STAGE_FIRST;
|
||||
gpio_put(int_PIN, 0);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case I2C_SLAVE_FINISH:
|
||||
writeState = I2C_WRITE_STATE_FIRST;
|
||||
|
||||
rxPackage.index = 0;
|
||||
txPackage.index = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GobotRPC_NI_Hardware_RP2040_I2C::preTxTask() {
|
||||
GobotRPC_NI_Package_Transport pkg;
|
||||
|
||||
while (1) {
|
||||
xQueueReceive(isrPreTxQueue, &pkg, portMAX_DELAY);
|
||||
xQueueSend(isrTXQueue, &pkg, portMAX_DELAY);
|
||||
vTaskDelay(5 / portTICK_PERIOD_MS);
|
||||
gpio_put(int_PIN, 1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#include "protocol.hpp"
|
||||
#include <stdint.h>
|
||||
|
||||
#include "pico/stdlib.h"
|
||||
#include "hardware/watchdog.h"
|
||||
|
||||
#include "crc16.hpp"
|
||||
|
||||
void assembleGobotRPCHeader(char * buffer, GobotRPCNumber number, GobotRPCTypes type, size_t len) {
|
||||
buffer[0] = ((number & 0b1111) << 4) | ((type & 0b11) << 2);
|
||||
buffer[1] = (len + 4) & 0xff;
|
||||
}
|
||||
|
||||
GobotRPCHeaderInfo extractGobotRPCHeader(char * buffer) {
|
||||
GobotRPCHeaderInfo info;
|
||||
info.number = (GobotRPCNumber)((buffer[0] >> 4) & 0b1111);
|
||||
info.type = (GobotRPCTypes)((buffer[0] >> 2) & 0b11);
|
||||
info.len = buffer[1];
|
||||
return info;
|
||||
}
|
||||
|
||||
void assembleCRC(char * buffer, size_t data_len) {
|
||||
unsigned short crc = crc16(buffer, data_len + GobotRPC_Package_DATA_OFFSET);
|
||||
buffer[GobotRPC_Package_DATA_OFFSET + data_len + 1] = crc & 0xff;
|
||||
buffer[GobotRPC_Package_DATA_OFFSET + data_len + 0] = (crc >> 8) & 0xff;
|
||||
}
|
||||
|
||||
bool checkCRC(char * buffer, size_t data_len) {
|
||||
unsigned short crc = crc16(buffer, data_len - 2);
|
||||
unsigned short crc_received = buffer[data_len - GobotRPC_Package_DATA_OFFSET + 1] | (buffer[data_len - GobotRPC_Package_DATA_OFFSET + 0] << 8);
|
||||
return crc == crc_received;
|
||||
}
|
||||
|
||||
void softwareReset() {
|
||||
watchdog_enable(1, 1);
|
||||
while(1);
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
#include "transmission_interface.hpp"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "queue.h"
|
||||
|
||||
void GobotRPC_TI_Hardware_RP2040_I2C::raiseTranmissionError(bool rx, uint32_t addr) {
|
||||
CI_Instruction_Transport ciInstruction;
|
||||
ciInstruction.type = CI_INSTRUCTION_SEND_TRANMISSION_ERROR;
|
||||
ciInstruction.data[0] = rx;
|
||||
ciInstruction.data[1] = addr & 0xff;
|
||||
ciInstruction.data[2] = (addr >> 8) & 0xff;
|
||||
ciInstruction.data[3] = (addr >> 16) & 0xff;
|
||||
ciInstruction.data[4] = (addr >> 24) & 0xff;
|
||||
|
||||
this->pushCIInstructionCB(&ciInstruction, pushCIInstructionCBArgs);
|
||||
}
|
||||
|
||||
void GobotRPC_TI_Hardware_RP2040_I2C::raiseTransmissionSuceess(uint32_t addr) {
|
||||
CI_Instruction_Transport ciInstruction;
|
||||
ciInstruction.type = CI_INSTRUCTION_SEND_TRANMISSION_SUCCESS;
|
||||
ciInstruction.data[0] = addr & 0xff;
|
||||
ciInstruction.data[1] = (addr >> 8) & 0xff;
|
||||
ciInstruction.data[2] = (addr >> 16) & 0xff;
|
||||
ciInstruction.data[3] = (addr >> 24) & 0xff;
|
||||
|
||||
this->pushCIInstructionCB(&ciInstruction, pushCIInstructionCBArgs);
|
||||
}
|
||||
|
||||
void GobotRPC_TI_Hardware_RP2040_I2C::raiseInfoReset() {
|
||||
CI_Instruction_Transport ciInstruction;
|
||||
ciInstruction.type = CI_INSTRUCTION_SEND_INFO_RESET;
|
||||
|
||||
this->pushCIInstructionCB(&ciInstruction, pushCIInstructionCBArgs);
|
||||
}
|
||||
|
||||
void GobotRPC_TI_Hardware_RP2040_I2C::revCIInstructionTask() {
|
||||
CI_Instruction_Transport ciInstruction;
|
||||
while(1) {
|
||||
xQueueReceive(revCIInstructionQueue, &ciInstruction, portMAX_DELAY);
|
||||
|
||||
switch (ciInstruction.type) {
|
||||
case CI_INSTRUCTION_REV_SEND_SET_ADDR_MAP: {
|
||||
uint32_t addr = ciInstruction.data[0] |\
|
||||
(ciInstruction.data[1] << 8) |\
|
||||
(ciInstruction.data[2] << 16) |\
|
||||
(ciInstruction.data[3] << 24);
|
||||
uint8_t port = ciInstruction.data[4];
|
||||
this->setAddrMap(addr, port);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
#include "transmission_interface.hpp"
|
||||
#include "hardware/i2c.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "pinConfig.hpp"
|
||||
|
||||
GobotRPC_TI_Hardware_RP2040_I2C * g_GobotRPC_TI_Hardware_RP2040_I2C;
|
||||
|
||||
GobotRPC_TI_Hardware_RP2040_I2C::GobotRPC_TI_Hardware_RP2040_I2C(UBaseType_t core, i2c_inst_t *i2c, QueueHandle_t revCIInstructionQueue) {
|
||||
this->core = core;
|
||||
this->i2c = i2c0;
|
||||
this->revCIInstructionQueue = revCIInstructionQueue;
|
||||
|
||||
g_GobotRPC_TI_Hardware_RP2040_I2C = this;
|
||||
|
||||
i2c_init(i2c, GOBOTRPC_TI_CLOCK_SPEED);
|
||||
gpio_set_function(GOBOTRPC_TI_I2C_SDA, GPIO_FUNC_I2C);
|
||||
gpio_set_function(GOBOTRPC_TI_I2C_SCL, GPIO_FUNC_I2C);
|
||||
|
||||
if(!GOBOTRPC_TI_EXTERNAL_PULLUP) {
|
||||
gpio_pull_up(GOBOTRPC_TI_I2C_SDA);
|
||||
gpio_pull_up(GOBOTRPC_TI_I2C_SCL);
|
||||
}
|
||||
|
||||
for(int i=0; i<GOBOTRPC_TI_INT_NUM; i++) {
|
||||
intAddressMap[i] = 0xffffffff;
|
||||
gpio_init(GOBOTRPC_TI_INT_PIN_START + i);
|
||||
gpio_set_dir(GOBOTRPC_TI_INT_PIN_START + i, GPIO_IN);
|
||||
//gpio_pull_down(GOBOTRPC_TI_INT_PIN_START + i);
|
||||
gpio_set_irq_enabled_with_callback(GOBOTRPC_TI_INT_PIN_START + i, GPIO_IRQ_EDGE_RISE, true, intPin_ISR);
|
||||
}
|
||||
|
||||
initTasks();
|
||||
|
||||
//gpio_init(GOBOTRPC_TI_COMBINED_INT_PIN);
|
||||
//gpio_set_dir(GOBOTRPC_TI_COMBINED_INT_PIN, GPIO_IN);
|
||||
//gpio_pull_down(GOBOTRPC_TI_COMBINED_INT_PIN);
|
||||
|
||||
}
|
||||
|
||||
static void i2cIntTaskFn(void * pvParameters) {
|
||||
GobotRPC_TI_Hardware_RP2040_I2C * hw = (GobotRPC_TI_Hardware_RP2040_I2C *)pvParameters;
|
||||
hw->manualTriggerIntTask();
|
||||
}
|
||||
|
||||
static void revCIInstructionTaskFn(void * pvParameters) {
|
||||
GobotRPC_TI_Hardware_RP2040_I2C * hw = (GobotRPC_TI_Hardware_RP2040_I2C *)pvParameters;
|
||||
hw->revCIInstructionTask();
|
||||
}
|
||||
|
||||
void GobotRPC_TI_Hardware_RP2040_I2C::initTasks() {
|
||||
i2cMutex = xSemaphoreCreateMutex();
|
||||
i2cRXSemaphore = xSemaphoreCreateBinary();
|
||||
|
||||
pushPackageCB = NULL;
|
||||
pullPackageCB = NULL;
|
||||
pushPackageCBArgs = NULL;
|
||||
pullPackageCBArgs = NULL;
|
||||
|
||||
volatile int a = xPortGetFreeHeapSize();
|
||||
|
||||
xTaskCreateAffinitySet(i2cRxTaskFn, "i2c Rx Task", 4096, this, 3, core, &i2cRxTaskHandle);
|
||||
xTaskCreateAffinitySet(i2cTxTaskFn, "i2c Tx Task", 4096, this, 3, core, &i2cTxTaskHandle);
|
||||
xTaskCreateAffinitySet(i2cIntTaskFn, "i2c Int Task", 4096, this, 3, core, &i2cIntTaskHandle);
|
||||
xTaskCreateAffinitySet(revCIInstructionTaskFn, "Rev CI Instruction Task", 4096, this, 3, core, &revCIInstructionTaskHandle);
|
||||
}
|
||||
|
||||
void GobotRPC_TI_Hardware_RP2040_I2C::registerPullPackageCB(callback_pullPackage cb, void *args) {
|
||||
pullPackageCB = cb;
|
||||
pullPackageCBArgs = args;
|
||||
}
|
||||
|
||||
void GobotRPC_TI_Hardware_RP2040_I2C::registerPushPackageCB(callback_pushPackage cb, void *args) {
|
||||
pushPackageCB = cb;
|
||||
pushPackageCBArgs = args;
|
||||
}
|
||||
|
||||
void GobotRPC_TI_Hardware_RP2040_I2C::registerPushCIInstructionCB(callback_pushCIInstruction cb, void *args) {
|
||||
pushCIInstructionCB = cb;
|
||||
pushCIInstructionCBArgs = args;
|
||||
}
|
||||
|
||||
void GobotRPC_TI_Hardware_RP2040_I2C::setAddrMap(uint32_t addr, int intNum) {
|
||||
intAddressMap[intNum] = addr;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
#include "transmission_interface.hpp"
|
||||
|
||||
#include "FreeRTOSConfig.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
uint32_t GobotRPC_TI_Hardware_RP2040_I2C::readIntPins() {
|
||||
uint32_t intPinsStates = 0;
|
||||
|
||||
for(int i=0; i<GOBOTRPC_TI_INT_NUM; i++) {
|
||||
intPinsStates |= gpio_get(GOBOTRPC_TI_INT_PIN_START + i) << i;
|
||||
}
|
||||
return intPinsStates;
|
||||
}
|
||||
|
||||
void intPin_ISR(uint gpio, uint32_t events) {
|
||||
GobotRPC_TI_Hardware_RP2040_I2C * hw = g_GobotRPC_TI_Hardware_RP2040_I2C;
|
||||
|
||||
uint32_t intPinsStates = hw->readIntPins();
|
||||
|
||||
if(intPinsStates == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||
hw->intPinISR(&xHigherPriorityTaskWoken);
|
||||
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
|
||||
}
|
||||
|
||||
void GobotRPC_TI_Hardware_RP2040_I2C::intPinISR(BaseType_t * xHigherPriorityTaskWoken) {
|
||||
xSemaphoreGiveFromISR(i2cRXSemaphore, xHigherPriorityTaskWoken);
|
||||
}
|
||||
|
||||
void GobotRPC_TI_Hardware_RP2040_I2C::manualTriggerIntTask() {
|
||||
while (1) {
|
||||
uint32_t intPinsStates = readIntPins();
|
||||
|
||||
if(intPinsStates == 0) {
|
||||
vTaskDelay(500 / portTICK_PERIOD_MS);
|
||||
continue;
|
||||
}
|
||||
|
||||
vTaskDelay(500 / portTICK_PERIOD_MS);
|
||||
|
||||
xSemaphoreGive(i2cRXSemaphore);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
#include "transmission_interface.hpp"
|
||||
#include "ci/base.hpp"
|
||||
|
||||
void i2cRxTaskFn(void * args) {
|
||||
GobotRPC_TI_Hardware_RP2040_I2C * hw = (GobotRPC_TI_Hardware_RP2040_I2C *)args;
|
||||
hw->i2cRxTask();
|
||||
}
|
||||
|
||||
void GobotRPC_TI_Hardware_RP2040_I2C::i2cRxTask() {
|
||||
while (1) {
|
||||
xSemaphoreTake(i2cRXSemaphore, portMAX_DELAY);
|
||||
|
||||
uint32_t done_mask = 0xffffffff;
|
||||
|
||||
uint32_t pinStates = readIntPins();
|
||||
|
||||
do {
|
||||
for(int i=0; i<GOBOTRPC_TI_INT_NUM; i++) {
|
||||
if((pinStates & done_mask) & (1 << i)) {
|
||||
done_mask &= ~(1 << i);
|
||||
|
||||
|
||||
uint32_t addr = intAddressMap[i];
|
||||
|
||||
if(addr > 0xff)
|
||||
continue;
|
||||
|
||||
GoRPCPackage_Transport pkg;
|
||||
|
||||
xSemaphoreTake(i2cMutex, portMAX_DELAY);
|
||||
bool read_res = readI2C(&pkg, addr);
|
||||
xSemaphoreGive(i2cMutex);
|
||||
|
||||
if(!read_res)
|
||||
continue;
|
||||
|
||||
pkg.addr |= (i) << 8;
|
||||
|
||||
if(pushPackageCB != NULL)
|
||||
pushPackageCB(&pkg, pushPackageCBArgs);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pinStates = readIntPins();
|
||||
} while(pinStates & done_mask);
|
||||
}
|
||||
}
|
||||
|
||||
bool GobotRPC_TI_Hardware_RP2040_I2C::readI2C(GoRPCPackage_Transport * pkg, uint32_t addr) {
|
||||
unsigned int res;
|
||||
//uint res = i2c_read_blocking(i2c, addr, (uint8_t *)pkg->data, 2, true);
|
||||
|
||||
i2c_read_blocking(i2c, addr, (uint8_t *)pkg->data + CI_RX_PACKAGE_DATA_OFFSET, 2, true);
|
||||
|
||||
|
||||
size_t len = pkg->data[CI_RX_PACKAGE_DATA_OFFSET + 1];
|
||||
|
||||
if(len > 64) {
|
||||
return false;
|
||||
}
|
||||
|
||||
res = i2c_read_blocking(i2c, addr, ((uint8_t *)pkg->data) + CI_RX_PACKAGE_DATA_OFFSET, len, false);
|
||||
pkg->len = len;
|
||||
pkg->addr = addr;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
#include "transmission_interface.hpp"
|
||||
|
||||
void i2cTxTaskFn(void * args) {
|
||||
GobotRPC_TI_Hardware_RP2040_I2C * hw = (GobotRPC_TI_Hardware_RP2040_I2C *)args;
|
||||
hw->i2cTxTask();
|
||||
}
|
||||
|
||||
void GobotRPC_TI_Hardware_RP2040_I2C::i2cTxTask() {
|
||||
while (1) {
|
||||
GoRPCPackage_Transport pkg;
|
||||
|
||||
if(pullPackageCB == NULL) {
|
||||
vTaskDelay(pdMS_TO_TICKS(100));
|
||||
continue;
|
||||
}
|
||||
|
||||
pullPackageCB(&pkg, pullPackageCBArgs);
|
||||
|
||||
xSemaphoreTake(i2cMutex, portMAX_DELAY);
|
||||
unsigned int res = i2c_write_blocking(i2c, pkg.addr & 0x7f, (uint8_t * )(pkg.data), pkg.len, false);
|
||||
xSemaphoreGive(i2cMutex);
|
||||
|
||||
if(res == PICO_ERROR_GENERIC) {
|
||||
raiseTranmissionError(false, pkg.addr);
|
||||
} else {
|
||||
raiseTransmissionSuceess(pkg.addr);
|
||||
}
|
||||
}
|
||||
}
|
||||
86
i2c-hub/firmware/i2c-hub-firmware/src/main_core0.cpp
Normal file
86
i2c-hub/firmware/i2c-hub-firmware/src/main_core0.cpp
Normal file
@@ -0,0 +1,86 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "pico/stdlib.h"
|
||||
|
||||
#include "ci/base.hpp"
|
||||
#include "ci/hardware.hpp"
|
||||
#include "transmission_interface.hpp"
|
||||
|
||||
#include "main.hpp"
|
||||
|
||||
#include "FreeRTOSConfig.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "message_buffer.h"
|
||||
|
||||
#include "protocol.hpp"
|
||||
|
||||
#define LED_PIN 25
|
||||
|
||||
AppData appData;
|
||||
|
||||
void vTaskMain(void * pvParameters) {
|
||||
while(1) {
|
||||
gpio_put(LED_PIN, 1);
|
||||
vTaskDelay(pdMS_TO_TICKS(500));
|
||||
gpio_put(LED_PIN, 0);
|
||||
vTaskDelay(pdMS_TO_TICKS(500));
|
||||
}
|
||||
}
|
||||
|
||||
void onTxPacket(void * args, char *data, size_t len, uint32_t addr) {
|
||||
GobotRPC_CI * gobotRPC_ci = (GobotRPC_CI *)args;
|
||||
|
||||
GoRPCPackage_Transport pkg;
|
||||
|
||||
memcpy(pkg.data, data, len);
|
||||
pkg.len = len;
|
||||
pkg.addr = addr;
|
||||
|
||||
xQueueSend(appData.txQueue, &pkg, portMAX_DELAY);
|
||||
|
||||
//gobotRPC_ci->send_RxPacket(pkg.data, CALC_SIZE_GobotRPC_PACKAGE(0), addr);
|
||||
}
|
||||
|
||||
void onRXFromI2CTask(void * pvParameters) {
|
||||
GobotRPC_CI * gobotRPC_ci = (GobotRPC_CI *)pvParameters;
|
||||
|
||||
GoRPCPackage_Transport pkg;
|
||||
while (true) {
|
||||
xQueueReceive(appData.rxQueue, &pkg, portMAX_DELAY);
|
||||
|
||||
gobotRPC_ci->send_RxPacket(pkg.data, pkg.len, pkg.addr);
|
||||
}
|
||||
}
|
||||
|
||||
static void onSetAddrMap(void * args, uint32_t addr, uint8_t port) {
|
||||
GobotRPC_CI * gobotrpc_ci = (GobotRPC_CI *)args;
|
||||
gobotrpc_ci->send_rev_SetAddrMap(addr, port);
|
||||
}
|
||||
|
||||
int main() {
|
||||
gpio_init(LED_PIN);
|
||||
gpio_set_dir(LED_PIN, true);
|
||||
|
||||
appData.txQueue = xQueueCreate(5, sizeof(GoRPCPackage_Transport));
|
||||
appData.rxQueue = xQueueCreate(5, sizeof(GoRPCPackage_Transport));
|
||||
appData.ciInstructionQueue = xQueueCreate(3, sizeof(CI_Instruction_Transport));
|
||||
appData.ciInstructionReverseQueue = xQueueCreate(3, sizeof(CI_Instruction_Transport));
|
||||
|
||||
GobotRPC_CI_Hardware_RP2040_UART gobotrpc_ci_hardware(uart0, 115200, UART_CORE_MASK);
|
||||
|
||||
GobotRPC_CI gobotRPC_ci(&gobotrpc_ci_hardware, UART_CORE_MASK, appData.ciInstructionQueue, appData.ciInstructionReverseQueue);
|
||||
gobotRPC_ci.registerCB_SetAddress(onSetAddrMap, &gobotRPC_ci);
|
||||
gobotRPC_ci.registerCB_TxPacket(onTxPacket, &gobotRPC_ci);
|
||||
|
||||
TaskHandle_t taskHandleCore0;
|
||||
TaskHandle_t taskHandleCore1;
|
||||
TaskHandle_t taskRXFromI2CTask;
|
||||
xTaskCreateAffinitySet(vTaskMain, "Main Task Core 0", 2048, &gobotRPC_ci, 1, UART_CORE_MASK, &taskHandleCore0);
|
||||
xTaskCreateAffinitySet(main_core2, "Main Task Core 1", 2048, &appData, 1, UART_CORE_MASK, &taskHandleCore1);
|
||||
xTaskCreateAffinitySet(onRXFromI2CTask, "RX From I2C Task", 2048, &gobotRPC_ci, 3, UART_CORE_MASK, &taskRXFromI2CTask);
|
||||
|
||||
vTaskStartScheduler();
|
||||
|
||||
while(1) {}
|
||||
}
|
||||
43
i2c-hub/firmware/i2c-hub-firmware/src/main_core1.cpp
Normal file
43
i2c-hub/firmware/i2c-hub-firmware/src/main_core1.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
#include "main.hpp"
|
||||
#include "transmission_interface.hpp"
|
||||
|
||||
#include "FreeRTOSConfig.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "queue.h"
|
||||
|
||||
#include "pinConfig.hpp"
|
||||
|
||||
extern AppData appData;
|
||||
|
||||
void pullPackageCB(GoRPCPackage_Transport * dest, void *args) {
|
||||
QueueHandle_t queue = appData.txQueue;
|
||||
xQueueReceive(queue, dest, portMAX_DELAY);
|
||||
}
|
||||
|
||||
void pushPackageCB(GoRPCPackage_Transport * src, void *args) {
|
||||
QueueHandle_t queue = appData.rxQueue;
|
||||
xQueueSend(queue, src, portMAX_DELAY);
|
||||
}
|
||||
|
||||
void pushCIInstruction(CI_Instruction_Transport * src, void *args) {
|
||||
QueueHandle_t queue = appData.ciInstructionQueue;
|
||||
xQueueSend(queue, src, portMAX_DELAY);
|
||||
}
|
||||
|
||||
void main_core2(void * pvParameters) {
|
||||
AppData appData1 = *(AppData *)pvParameters;
|
||||
|
||||
GobotRPC_TI_Hardware_RP2040_I2C gobotrpc_ti_hardware(UART_CORE_MASK, i2c0, appData1.ciInstructionReverseQueue);
|
||||
//gobotrpc_ti_hardware.setAddrMap(0x21, 0);
|
||||
|
||||
gobotrpc_ti_hardware.registerPullPackageCB(pullPackageCB, appData.txQueue);
|
||||
gobotrpc_ti_hardware.registerPushPackageCB(pushPackageCB, appData.rxQueue);
|
||||
gobotrpc_ti_hardware.registerPushCIInstructionCB(pushCIInstruction, appData.ciInstructionQueue);
|
||||
|
||||
gobotrpc_ti_hardware.raiseInfoReset();
|
||||
|
||||
while(1) {
|
||||
vTaskDelay(pdMS_TO_TICKS(10000));
|
||||
}
|
||||
}
|
||||
BIN
i2c-hub/pulseview-i2c-session
Normal file
BIN
i2c-hub/pulseview-i2c-session
Normal file
Binary file not shown.
BIN
i2c-hub/pulseview-session2
Normal file
BIN
i2c-hub/pulseview-session2
Normal file
Binary file not shown.
BIN
i2c-hub/session3
Normal file
BIN
i2c-hub/session3
Normal file
Binary file not shown.
15
i2c-hub/uart-adapter/.vscode/launch.json
vendored
Normal file
15
i2c-hub/uart-adapter/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Python Debugger: Current File",
|
||||
"type": "debugpy",
|
||||
"request": "launch",
|
||||
"program": "${file}",
|
||||
"console": "integratedTerminal"
|
||||
}
|
||||
]
|
||||
}
|
||||
1
i2c-hub/uart-adapter/cache/boardpos_1736386482.json
vendored
Normal file
1
i2c-hub/uart-adapter/cache/boardpos_1736386482.json
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"pos1": {"x": 1026, "y": 2096}, "pos2": {"x": 16651, "y": 18856}, "pos3": {"x": 1901, "y": 131}}
|
||||
1
i2c-hub/uart-adapter/cache/scan_result.json
vendored
Normal file
1
i2c-hub/uart-adapter/cache/scan_result.json
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"corexy_available": true, "head_available": true, "vacuum_available": true, "corexy_port": 0, "head_port": 2, "vacuum_port": 1}
|
||||
BIN
i2c-hub/uart-adapter/src/common/calibrate_boardpos.py
(Stored with Git LFS)
Normal file
BIN
i2c-hub/uart-adapter/src/common/calibrate_boardpos.py
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i2c-hub/uart-adapter/src/common/i2c_scan.py
(Stored with Git LFS)
Normal file
BIN
i2c-hub/uart-adapter/src/common/i2c_scan.py
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i2c-hub/uart-adapter/src/gobot.py
(Stored with Git LFS)
Normal file
BIN
i2c-hub/uart-adapter/src/gobot.py
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i2c-hub/uart-adapter/src/gobotrpc/__init__.py
(Stored with Git LFS)
Normal file
BIN
i2c-hub/uart-adapter/src/gobotrpc/__init__.py
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i2c-hub/uart-adapter/src/gobotrpc/mapping.py
(Stored with Git LFS)
Normal file
BIN
i2c-hub/uart-adapter/src/gobotrpc/mapping.py
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i2c-hub/uart-adapter/src/gobotrpc/packages/corexy/package_home.py
(Stored with Git LFS)
Normal file
BIN
i2c-hub/uart-adapter/src/gobotrpc/packages/corexy/package_home.py
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i2c-hub/uart-adapter/src/gobotrpc/packages/corexy/package_release_motors.py
(Stored with Git LFS)
Normal file
BIN
i2c-hub/uart-adapter/src/gobotrpc/packages/corexy/package_release_motors.py
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i2c-hub/uart-adapter/src/gobotrpc/packages/corexy/package_set_padding.py
(Stored with Git LFS)
Normal file
BIN
i2c-hub/uart-adapter/src/gobotrpc/packages/corexy/package_set_padding.py
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i2c-hub/uart-adapter/src/gobotrpc/packages/corexy/packages_goto.py
(Stored with Git LFS)
Normal file
BIN
i2c-hub/uart-adapter/src/gobotrpc/packages/corexy/packages_goto.py
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i2c-hub/uart-adapter/src/gobotrpc/rpc_packages.py
(Stored with Git LFS)
Normal file
BIN
i2c-hub/uart-adapter/src/gobotrpc/rpc_packages.py
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i2c-hub/uart-adapter/src/gobotrpc/rpc_packages_corexy.py
(Stored with Git LFS)
Normal file
BIN
i2c-hub/uart-adapter/src/gobotrpc/rpc_packages_corexy.py
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i2c-hub/uart-adapter/src/gobotrpc/rpc_packages_head.py
(Stored with Git LFS)
Normal file
BIN
i2c-hub/uart-adapter/src/gobotrpc/rpc_packages_head.py
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i2c-hub/uart-adapter/src/gobotrpc/util.py
(Stored with Git LFS)
Normal file
BIN
i2c-hub/uart-adapter/src/gobotrpc/util.py
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i2c-hub/uart-adapter/src/main.py
(Stored with Git LFS)
Normal file
BIN
i2c-hub/uart-adapter/src/main.py
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i2c-hub/uart-adapter/src/uart_interface/__init__.py
(Stored with Git LFS)
Normal file
BIN
i2c-hub/uart-adapter/src/uart_interface/__init__.py
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i2c-hub/uart-adapter/src/uart_interface/ci_highLevel.py
(Stored with Git LFS)
Normal file
BIN
i2c-hub/uart-adapter/src/uart_interface/ci_highLevel.py
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i2c-hub/uart-adapter/src/uart_interface/ci_packages.py
(Stored with Git LFS)
Normal file
BIN
i2c-hub/uart-adapter/src/uart_interface/ci_packages.py
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i2c-hub/uart-adapter/src/uart_interface/pares_packages.py
(Stored with Git LFS)
Normal file
BIN
i2c-hub/uart-adapter/src/uart_interface/pares_packages.py
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i2c-hub/uart-adapter/src/uart_interface/serial.py
(Stored with Git LFS)
Normal file
BIN
i2c-hub/uart-adapter/src/uart_interface/serial.py
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
motor-control/core-xy-firmware/.gitignore
(Stored with Git LFS)
vendored
Normal file
BIN
motor-control/core-xy-firmware/.gitignore
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
22
motor-control/core-xy-firmware/.vscode/c_cpp_properties.json
vendored
Normal file
22
motor-control/core-xy-firmware/.vscode/c_cpp_properties.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Pico",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**",
|
||||
"${userHome}/.pico-sdk/sdk/2.1.0/**"
|
||||
],
|
||||
"forcedInclude": [
|
||||
"${userHome}/.pico-sdk/sdk/2.1.0/src/common/pico_base_headers/include/pico.h",
|
||||
"${workspaceFolder}/build/generated/pico_base/pico/config_autogen.h"
|
||||
],
|
||||
"defines": [],
|
||||
"compilerPath": "${userHome}/.pico-sdk/toolchain/13_3_Rel1/bin/arm-none-eabi-gcc",
|
||||
"compileCommands": "${workspaceFolder}/build/compile_commands.json",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++14",
|
||||
"intelliSenseMode": "linux-gcc-arm"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
||||
15
motor-control/core-xy-firmware/.vscode/cmake-kits.json
vendored
Normal file
15
motor-control/core-xy-firmware/.vscode/cmake-kits.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
[
|
||||
{
|
||||
"name": "Pico",
|
||||
"compilers": {
|
||||
"C": "${command:raspberry-pi-pico.getCompilerPath}",
|
||||
"CXX": "${command:raspberry-pi-pico.getCxxCompilerPath}"
|
||||
},
|
||||
"environmentVariables": {
|
||||
"PATH": "${command:raspberry-pi-pico.getEnvPath};${env:PATH}"
|
||||
},
|
||||
"cmakeSettings": {
|
||||
"Python3_EXECUTABLE": "${command:raspberry-pi-pico.getPythonPath}"
|
||||
}
|
||||
}
|
||||
]
|
||||
9
motor-control/core-xy-firmware/.vscode/extensions.json
vendored
Normal file
9
motor-control/core-xy-firmware/.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"marus25.cortex-debug",
|
||||
"ms-vscode.cpptools",
|
||||
"ms-vscode.cpptools-extension-pack",
|
||||
"ms-vscode.vscode-serial-monitor",
|
||||
"raspberry-pi.raspberry-pi-pico"
|
||||
]
|
||||
}
|
||||
70
motor-control/core-xy-firmware/.vscode/launch.json
vendored
Normal file
70
motor-control/core-xy-firmware/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Pico Debug (Cortex-Debug)",
|
||||
"cwd": "${userHome}/.pico-sdk/openocd/0.12.0+dev/scripts",
|
||||
"executable": "${command:raspberry-pi-pico.launchTargetPath}",
|
||||
"request": "launch",
|
||||
"type": "cortex-debug",
|
||||
"servertype": "openocd",
|
||||
"serverpath": "${userHome}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
"gdbPath": "${command:raspberry-pi-pico.getGDBPath}",
|
||||
"device": "${command:raspberry-pi-pico.getChipUppercase}",
|
||||
"configFiles": [
|
||||
"interface/cmsis-dap.cfg",
|
||||
"target/${command:raspberry-pi-pico.getTarget}.cfg"
|
||||
],
|
||||
"svdFile": "${userHome}/.pico-sdk/sdk/2.1.0/src/${command:raspberry-pi-pico.getChip}/hardware_regs/${command:raspberry-pi-pico.getChipUppercase}.svd",
|
||||
"runToEntryPoint": "main",
|
||||
// Fix for no_flash binaries, where monitor reset halt doesn't do what is expected
|
||||
// Also works fine for flash binaries
|
||||
"overrideLaunchCommands": [
|
||||
"monitor reset init",
|
||||
"load \"${command:raspberry-pi-pico.launchTargetPath}\""
|
||||
],
|
||||
"openOCDLaunchCommands": [
|
||||
"adapter speed 5000"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Pico Debug (Cortex-Debug with external OpenOCD)",
|
||||
"cwd": "${workspaceRoot}",
|
||||
"executable": "${command:raspberry-pi-pico.launchTargetPath}",
|
||||
"request": "launch",
|
||||
"type": "cortex-debug",
|
||||
"servertype": "external",
|
||||
"gdbTarget": "localhost:3333",
|
||||
"gdbPath": "${command:raspberry-pi-pico.getGDBPath}",
|
||||
"device": "${command:raspberry-pi-pico.getChipUppercase}",
|
||||
"svdFile": "${userHome}/.pico-sdk/sdk/2.1.0/src/${command:raspberry-pi-pico.getChip}/hardware_regs/${command:raspberry-pi-pico.getChipUppercase}.svd",
|
||||
"runToEntryPoint": "main",
|
||||
// Fix for no_flash binaries, where monitor reset halt doesn't do what is expected
|
||||
// Also works fine for flash binaries
|
||||
"overrideLaunchCommands": [
|
||||
"monitor reset init",
|
||||
"load \"${command:raspberry-pi-pico.launchTargetPath}\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Pico Debug (C++ Debugger)",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"cwd": "${workspaceRoot}",
|
||||
"program": "${command:raspberry-pi-pico.launchTargetPath}",
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "${command:raspberry-pi-pico.getGDBPath}",
|
||||
"miDebuggerServerAddress": "localhost:3333",
|
||||
"debugServerPath": "${userHome}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
"debugServerArgs": "-f interface/cmsis-dap.cfg -f target/${command:raspberry-pi-pico.getTarget}.cfg -c \"adapter speed 5000\"",
|
||||
"serverStarted": "Listening on port .* for gdb connections",
|
||||
"filterStderr": true,
|
||||
"hardwareBreakpoints": {
|
||||
"require": true,
|
||||
"limit": 4
|
||||
},
|
||||
"preLaunchTask": "Flash",
|
||||
"svdPath": "${userHome}/.pico-sdk/sdk/2.1.0/src/${command:raspberry-pi-pico.getChip}/hardware_regs/${command:raspberry-pi-pico.getChipUppercase}.svd"
|
||||
},
|
||||
]
|
||||
}
|
||||
45
motor-control/core-xy-firmware/.vscode/settings.json
vendored
Normal file
45
motor-control/core-xy-firmware/.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"cmake.options.statusBarVisibility": "hidden",
|
||||
"cmake.options.advanced": {
|
||||
"build": {
|
||||
"statusBarVisibility": "hidden"
|
||||
},
|
||||
"launch": {
|
||||
"statusBarVisibility": "hidden"
|
||||
},
|
||||
"debug": {
|
||||
"statusBarVisibility": "hidden"
|
||||
}
|
||||
},
|
||||
"cmake.configureOnEdit": true,
|
||||
"cmake.automaticReconfigure": true,
|
||||
"cmake.configureOnOpen": true,
|
||||
"cmake.generator": "Ninja",
|
||||
"cmake.cmakePath": "${userHome}/.pico-sdk/cmake/v3.29.9/bin/cmake",
|
||||
"C_Cpp.debugShortcut": false,
|
||||
"terminal.integrated.env.windows": {
|
||||
"PICO_SDK_PATH": "${env:USERPROFILE}/.pico-sdk/sdk/2.1.0",
|
||||
"PICO_TOOLCHAIN_PATH": "${env:USERPROFILE}/.pico-sdk/toolchain/13_3_Rel1",
|
||||
"Path": "${env:USERPROFILE}/.pico-sdk/toolchain/13_3_Rel1/bin;${env:USERPROFILE}/.pico-sdk/picotool/2.1.0/picotool;${env:USERPROFILE}/.pico-sdk/cmake/v3.29.9/bin;${env:USERPROFILE}/.pico-sdk/ninja/v1.12.1;${env:PATH}"
|
||||
},
|
||||
"terminal.integrated.env.osx": {
|
||||
"PICO_SDK_PATH": "${env:HOME}/.pico-sdk/sdk/2.1.0",
|
||||
"PICO_TOOLCHAIN_PATH": "${env:HOME}/.pico-sdk/toolchain/13_3_Rel1",
|
||||
"PATH": "${env:HOME}/.pico-sdk/toolchain/13_3_Rel1/bin:${env:HOME}/.pico-sdk/picotool/2.1.0/picotool:${env:HOME}/.pico-sdk/cmake/v3.29.9/bin:${env:HOME}/.pico-sdk/ninja/v1.12.1:${env:PATH}"
|
||||
},
|
||||
"terminal.integrated.env.linux": {
|
||||
"PICO_SDK_PATH": "${env:HOME}/.pico-sdk/sdk/2.1.0",
|
||||
"PICO_TOOLCHAIN_PATH": "${env:HOME}/.pico-sdk/toolchain/13_3_Rel1",
|
||||
"PATH": "${env:HOME}/.pico-sdk/toolchain/13_3_Rel1/bin:${env:HOME}/.pico-sdk/picotool/2.1.0/picotool:${env:HOME}/.pico-sdk/cmake/v3.29.9/bin:${env:HOME}/.pico-sdk/ninja/v1.12.1:${env:PATH}"
|
||||
},
|
||||
"raspberry-pi-pico.cmakeAutoConfigure": false,
|
||||
"raspberry-pi-pico.useCmakeTools": true,
|
||||
"raspberry-pi-pico.cmakePath": "${HOME}/.pico-sdk/cmake/v3.29.9/bin/cmake",
|
||||
"raspberry-pi-pico.ninjaPath": "${HOME}/.pico-sdk/ninja/v1.12.1/ninja",
|
||||
"files.associations": {
|
||||
"cstdint": "cpp",
|
||||
"array": "cpp",
|
||||
"string": "cpp",
|
||||
"string_view": "cpp"
|
||||
}
|
||||
}
|
||||
94
motor-control/core-xy-firmware/.vscode/tasks.json
vendored
Normal file
94
motor-control/core-xy-firmware/.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Compile Project",
|
||||
"type": "process",
|
||||
"isBuildCommand": true,
|
||||
"command": "${userHome}/.pico-sdk/ninja/v1.12.1/ninja",
|
||||
"args": ["-C", "${workspaceFolder}/build"],
|
||||
"group": "build",
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "dedicated",
|
||||
"focus": true,
|
||||
"clear": true
|
||||
},
|
||||
"problemMatcher": "$gcc",
|
||||
"windows": {
|
||||
"command": "${env:USERPROFILE}/.pico-sdk/ninja/v1.12.1/ninja.exe"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Run Project",
|
||||
"type": "process",
|
||||
"command": "${env:HOME}/.pico-sdk/picotool/2.1.0/picotool/picotool",
|
||||
"args": [
|
||||
"load",
|
||||
"${command:raspberry-pi-pico.launchTargetPath}",
|
||||
"-fx"
|
||||
],
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "dedicated"
|
||||
},
|
||||
"problemMatcher": [],
|
||||
"windows": {
|
||||
"command": "${env:USERPROFILE}/.pico-sdk/picotool/2.1.0/picotool/picotool.exe"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Flash",
|
||||
"type": "process",
|
||||
"command": "${userHome}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
"args": [
|
||||
"-s",
|
||||
"${userHome}/.pico-sdk/openocd/0.12.0+dev/scripts",
|
||||
"-f",
|
||||
"interface/cmsis-dap.cfg",
|
||||
"-f",
|
||||
"target/${command:raspberry-pi-pico.getTarget}.cfg",
|
||||
"-c", "adapter speed 5000; program \"${command:raspberry-pi-pico.launchTargetPath}\" verify",
|
||||
"-c", "reset halt",
|
||||
"-c", "rp2040.core1 arp_reset assert 0",
|
||||
"-c", "rp2040.core0 arp_reset assert 0",
|
||||
"-c", "exit"
|
||||
],
|
||||
"dependsOn": [
|
||||
"Compile Project"
|
||||
],
|
||||
"problemMatcher": [],
|
||||
"windows": {
|
||||
"command": "${env:USERPROFILE}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Reset",
|
||||
"type": "process",
|
||||
"command": "${userHome}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
"args": [
|
||||
"-s",
|
||||
"${userHome}/.pico-sdk/openocd/0.12.0+dev/scripts",
|
||||
"-f",
|
||||
"interface/cmsis-dap.cfg",
|
||||
"-f", "target/${command:raspberry-pi-pico.getTarget}.cfg",
|
||||
"-c", "adapter speed 5000; init; reset halt;",
|
||||
"-c", "rp2040.core1 arp_reset assert 0",
|
||||
"-c", "rp2040.core0 arp_reset assert 0",
|
||||
"-c", "exit"
|
||||
],
|
||||
"presentation": {
|
||||
"echo": true,
|
||||
"reveal": "never",
|
||||
"focus": false,
|
||||
"panel": "shared",
|
||||
"showReuseMessage": true,
|
||||
"clear": true
|
||||
},
|
||||
"problemMatcher": [],
|
||||
"windows": {
|
||||
"command": "${env:USERPROFILE}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
90
motor-control/core-xy-firmware/CMakeLists.txt
Normal file
90
motor-control/core-xy-firmware/CMakeLists.txt
Normal file
@@ -0,0 +1,90 @@
|
||||
# Generated Cmake Pico project file
|
||||
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# Initialise pico_sdk from installed location
|
||||
# (note this can come from environment, CMake cache etc)
|
||||
|
||||
# == DO NOT EDIT THE FOLLOWING LINES for the Raspberry Pi Pico VS Code Extension to work ==
|
||||
if(WIN32)
|
||||
set(USERHOME $ENV{USERPROFILE})
|
||||
else()
|
||||
set(USERHOME $ENV{HOME})
|
||||
endif()
|
||||
set(sdkVersion 2.1.0)
|
||||
set(toolchainVersion 13_3_Rel1)
|
||||
set(picotoolVersion 2.1.0)
|
||||
set(picoVscode ${USERHOME}/.pico-sdk/cmake/pico-vscode.cmake)
|
||||
if (EXISTS ${picoVscode})
|
||||
include(${picoVscode})
|
||||
endif()
|
||||
# ====================================================================================
|
||||
set(PICO_BOARD pico CACHE STRING "Board type")
|
||||
|
||||
# Pull in Raspberry Pi Pico SDK (must be before project)
|
||||
include(pico_sdk_import.cmake)
|
||||
|
||||
set(FREERTOS_KERNEL_PATH ${CMAKE_CURRENT_LIST_DIR}/lib/FreeRTOS-Kernel)
|
||||
project(core-xy-firmware C CXX ASM)
|
||||
|
||||
# Add FreeRTOS
|
||||
include(cmake/FreeRTOS_Kernel_import.cmake)
|
||||
|
||||
# Adding GobotRPC Node Library
|
||||
include(lib/gobotrpc/cmake/gobotRPC_Node.cmake)
|
||||
|
||||
# Initialise the Raspberry Pi Pico SDK
|
||||
pico_sdk_init()
|
||||
|
||||
# Add executable. Default name is the project name, version 0.1
|
||||
include(cmake/tmc2209.cmake)
|
||||
|
||||
add_executable(core-xy-firmware
|
||||
src/main.cpp
|
||||
src/motors.cpp
|
||||
src/corexy/init.cpp
|
||||
src/corexy/motorFunctions.cpp
|
||||
src/corexy/limitSwitches.cpp
|
||||
src/corexy/position.cpp
|
||||
)
|
||||
|
||||
target_include_directories(core-xy-firmware PUBLIC
|
||||
include/
|
||||
build/
|
||||
./
|
||||
)
|
||||
|
||||
pico_set_program_name(core-xy-firmware "core-xy-firmware")
|
||||
pico_set_program_version(core-xy-firmware "0.1")
|
||||
|
||||
# Generate PIO header
|
||||
pico_generate_pio_header(core-xy-firmware ${CMAKE_CURRENT_LIST_DIR}/src/tmc2209/pulser.pio)
|
||||
|
||||
# Modify the below lines to enable/disable output over UART/USB
|
||||
pico_enable_stdio_uart(core-xy-firmware 0)
|
||||
pico_enable_stdio_usb(core-xy-firmware 1)
|
||||
|
||||
# Add any user requested libraries
|
||||
target_link_libraries(core-xy-firmware
|
||||
pico_stdlib
|
||||
pico_time
|
||||
pico_multicore
|
||||
pico_stdio_usb
|
||||
hardware_pio
|
||||
|
||||
tmc2209_driver
|
||||
FreeRTOS-Kernel-Heap4
|
||||
GobotRPC_Node_RP2040_I2C
|
||||
)
|
||||
|
||||
# Add the standard include files to the build
|
||||
target_include_directories(core-xy-firmware PRIVATE
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
)
|
||||
|
||||
pico_add_extra_outputs(core-xy-firmware)
|
||||
|
||||
143
motor-control/core-xy-firmware/FreeRTOSConfig.h
Normal file
143
motor-control/core-xy-firmware/FreeRTOSConfig.h
Normal file
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* FreeRTOS V202111.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* http://www.FreeRTOS.org
|
||||
* http://aws.amazon.com/freertos
|
||||
*
|
||||
* 1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
*
|
||||
* See http://www.freertos.org/a00110.html
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
/* Scheduler Related */
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_TICKLESS_IDLE 0
|
||||
#define configUSE_IDLE_HOOK 0
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
|
||||
#define configMAX_PRIORITIES 32
|
||||
#define configMINIMAL_STACK_SIZE ( configSTACK_DEPTH_TYPE ) 256
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
|
||||
/* Synchronization Related */
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configUSE_APPLICATION_TASK_TAG 0
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configQUEUE_REGISTRY_SIZE 8
|
||||
#define configUSE_QUEUE_SETS 1
|
||||
#define configUSE_TIME_SLICING 1
|
||||
#define configUSE_NEWLIB_REENTRANT 0
|
||||
// todo need this for lwip FreeRTOS sys_arch to compile
|
||||
#define configENABLE_BACKWARD_COMPATIBILITY 1
|
||||
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 5
|
||||
|
||||
/* System */
|
||||
#define configSTACK_DEPTH_TYPE uint32_t
|
||||
#define configMESSAGE_BUFFER_LENGTH_TYPE size_t
|
||||
|
||||
/* Memory allocation related definitions. */
|
||||
#define configSUPPORT_STATIC_ALLOCATION 0
|
||||
#define configSUPPORT_DYNAMIC_ALLOCATION 1
|
||||
#define configTOTAL_HEAP_SIZE (1024 * 128)
|
||||
#define configAPPLICATION_ALLOCATED_HEAP (1024 * 64)
|
||||
|
||||
/* Hook function related definitions. */
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 0
|
||||
#define configUSE_MALLOC_FAILED_HOOK 0
|
||||
#define configUSE_DAEMON_TASK_STARTUP_HOOK 0
|
||||
|
||||
/* Run time and task stats gathering related definitions. */
|
||||
#define configGENERATE_RUN_TIME_STATS 0
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
|
||||
|
||||
/* Co-routine related definitions. */
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES 1
|
||||
|
||||
/* Software timer related definitions. */
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
|
||||
#define configTIMER_QUEUE_LENGTH 10
|
||||
#define configTIMER_TASK_STACK_DEPTH 1024
|
||||
|
||||
/* Interrupt nesting behaviour configuration. */
|
||||
/*
|
||||
#define configKERNEL_INTERRUPT_PRIORITY [dependent of processor]
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY [dependent on processor and application]
|
||||
#define configMAX_API_CALL_INTERRUPT_PRIORITY [dependent on processor and application]
|
||||
*/
|
||||
|
||||
#if FREE_RTOS_KERNEL_SMP // set by the RP2040 SMP port of FreeRTOS
|
||||
/* SMP port only */
|
||||
#define configNUMBER_OF_CORES 2
|
||||
#define configTICK_CORE 0
|
||||
#define configRUN_MULTIPLE_PRIORITIES 1
|
||||
#define configUSE_CORE_AFFINITY 1
|
||||
#define configUSE_PASSIVE_IDLE_HOOK 0
|
||||
#endif
|
||||
|
||||
/* RP2040 specific */
|
||||
#define configSUPPORT_PICO_SYNC_INTEROP 1
|
||||
#define configSUPPORT_PICO_TIME_INTEROP 1
|
||||
|
||||
#include <assert.h>
|
||||
/* Define to trap errors during development. */
|
||||
#define configASSERT(x) assert(x)
|
||||
|
||||
/* Set the following definitions to 1 to include the API function, or zero
|
||||
to exclude the API function. */
|
||||
#define INCLUDE_vTaskPrioritySet 1
|
||||
#define INCLUDE_uxTaskPriorityGet 1
|
||||
#define INCLUDE_vTaskDelete 1
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_xTaskGetSchedulerState 1
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 1
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 1
|
||||
#define INCLUDE_xTaskGetIdleTaskHandle 1
|
||||
#define INCLUDE_eTaskGetState 1
|
||||
#define INCLUDE_xTimerPendFunctionCall 1
|
||||
#define INCLUDE_xTaskAbortDelay 1
|
||||
#define INCLUDE_xTaskGetHandle 1
|
||||
#define INCLUDE_xTaskResumeFromISR 1
|
||||
#define INCLUDE_xQueueGetMutexHolder 1
|
||||
|
||||
/* A header file that defines trace macro can be included here. */
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
||||
34
motor-control/core-xy-firmware/blink.pio
Normal file
34
motor-control/core-xy-firmware/blink.pio
Normal file
@@ -0,0 +1,34 @@
|
||||
;
|
||||
; Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
;
|
||||
; SPDX-License-Identifier: BSD-3-Clause
|
||||
;
|
||||
|
||||
; SET pin 0 should be mapped to your LED GPIO
|
||||
|
||||
.program blink
|
||||
pull block
|
||||
out y, 32
|
||||
.wrap_target
|
||||
mov x, y
|
||||
set pins, 1 ; Turn LED on
|
||||
lp1:
|
||||
jmp x-- lp1 ; Delay for (x + 1) cycles, x is a 32 bit number
|
||||
mov x, y
|
||||
set pins, 0 ; Turn LED off
|
||||
lp2:
|
||||
jmp x-- lp2 ; Delay for the same number of cycles again
|
||||
.wrap ; Blink forever!
|
||||
|
||||
|
||||
% c-sdk {
|
||||
// this is a raw helper function for use by the user which sets up the GPIO output, and configures the SM to output on a particular pin
|
||||
|
||||
void blink_program_init(PIO pio, uint sm, uint offset, uint pin) {
|
||||
pio_gpio_init(pio, pin);
|
||||
pio_sm_set_consecutive_pindirs(pio, sm, pin, 1, true);
|
||||
pio_sm_config c = blink_program_get_default_config(offset);
|
||||
sm_config_set_set_pins(&c, pin, 1);
|
||||
pio_sm_init(pio, sm, offset, &c);
|
||||
}
|
||||
%}
|
||||
@@ -0,0 +1,61 @@
|
||||
# This is a copy of <FREERTOS_KERNEL_PATH>/portable/ThirdParty/GCC/RP2040/FREERTOS_KERNEL_import.cmake
|
||||
|
||||
# This can be dropped into an external project to help locate the FreeRTOS kernel
|
||||
# It should be include()ed prior to project(). Alternatively this file may
|
||||
# or the CMakeLists.txt in this directory may be included or added via add_subdirectory
|
||||
# respectively.
|
||||
|
||||
if (DEFINED ENV{FREERTOS_KERNEL_PATH} AND (NOT FREERTOS_KERNEL_PATH))
|
||||
set(FREERTOS_KERNEL_PATH $ENV{FREERTOS_KERNEL_PATH})
|
||||
message("Using FREERTOS_KERNEL_PATH from environment ('${FREERTOS_KERNEL_PATH}')")
|
||||
endif ()
|
||||
|
||||
set(FREERTOS_KERNEL_RP2040_RELATIVE_PATH "portable/ThirdParty/GCC/RP2040")
|
||||
# undo the above
|
||||
set(FREERTOS_KERNEL_RP2040_BACK_PATH "../../../..")
|
||||
|
||||
if (NOT FREERTOS_KERNEL_PATH)
|
||||
# check if we are inside the FreeRTOS kernel tree (i.e. this file has been included directly)
|
||||
get_filename_component(_ACTUAL_PATH ${CMAKE_CURRENT_LIST_DIR} REALPATH)
|
||||
get_filename_component(_POSSIBLE_PATH ${CMAKE_CURRENT_LIST_DIR}/${FREERTOS_KERNEL_RP2040_BACK_PATH}/${FREERTOS_KERNEL_RP2040_RELATIVE_PATH} REALPATH)
|
||||
if (_ACTUAL_PATH STREQUAL _POSSIBLE_PATH)
|
||||
get_filename_component(FREERTOS_KERNEL_PATH ${CMAKE_CURRENT_LIST_DIR}/${FREERTOS_KERNEL_RP2040_BACK_PATH} REALPATH)
|
||||
endif()
|
||||
if (_ACTUAL_PATH STREQUAL _POSSIBLE_PATH)
|
||||
get_filename_component(FREERTOS_KERNEL_PATH ${CMAKE_CURRENT_LIST_DIR}/${FREERTOS_KERNEL_RP2040_BACK_PATH} REALPATH)
|
||||
message("Setting FREERTOS_KERNEL_PATH to ${FREERTOS_KERNEL_PATH} based on location of FreeRTOS-Kernel-import.cmake")
|
||||
elseif (PICO_SDK_PATH AND EXISTS "${PICO_SDK_PATH}/../FreeRTOS-Kernel")
|
||||
set(FREERTOS_KERNEL_PATH ${PICO_SDK_PATH}/../FreeRTOS-Kernel)
|
||||
message("Defaulting FREERTOS_KERNEL_PATH as sibling of PICO_SDK_PATH: ${FREERTOS_KERNEL_PATH}")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if (NOT FREERTOS_KERNEL_PATH)
|
||||
foreach(POSSIBLE_SUFFIX Source FreeRTOS-Kernel FreeRTOS/Source)
|
||||
# check if FreeRTOS-Kernel exists under directory that included us
|
||||
set(SEARCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
get_filename_component(_POSSIBLE_PATH ${SEARCH_ROOT}/${POSSIBLE_SUFFIX} REALPATH)
|
||||
if (EXISTS ${_POSSIBLE_PATH}/${FREERTOS_KERNEL_RP2040_RELATIVE_PATH}/CMakeLists.txt)
|
||||
get_filename_component(FREERTOS_KERNEL_PATH ${_POSSIBLE_PATH} REALPATH)
|
||||
message("Setting FREERTOS_KERNEL_PATH to '${FREERTOS_KERNEL_PATH}' found relative to enclosing project")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if (NOT FREERTOS_KERNEL_PATH)
|
||||
message(FATAL_ERROR "FreeRTOS location was not specified. Please set FREERTOS_KERNEL_PATH.")
|
||||
endif()
|
||||
|
||||
set(FREERTOS_KERNEL_PATH "${FREERTOS_KERNEL_PATH}" CACHE PATH "Path to the FreeRTOS Kernel")
|
||||
|
||||
get_filename_component(FREERTOS_KERNEL_PATH "${FREERTOS_KERNEL_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
|
||||
if (NOT EXISTS ${FREERTOS_KERNEL_PATH})
|
||||
message(FATAL_ERROR "Directory '${FREERTOS_KERNEL_PATH}' not found")
|
||||
endif()
|
||||
if (NOT EXISTS ${FREERTOS_KERNEL_PATH}/${FREERTOS_KERNEL_RP2040_RELATIVE_PATH}/CMakeLists.txt)
|
||||
message(FATAL_ERROR "Directory '${FREERTOS_KERNEL_PATH}' does not contain an RP2040 port here: ${FREERTOS_KERNEL_RP2040_RELATIVE_PATH}")
|
||||
endif()
|
||||
set(FREERTOS_KERNEL_PATH ${FREERTOS_KERNEL_PATH} CACHE PATH "Path to the FreeRTOS_KERNEL" FORCE)
|
||||
|
||||
add_subdirectory(${FREERTOS_KERNEL_PATH}/${FREERTOS_KERNEL_RP2040_RELATIVE_PATH} FREERTOS_KERNEL)
|
||||
19
motor-control/core-xy-firmware/cmake/tmc2209.cmake
Normal file
19
motor-control/core-xy-firmware/cmake/tmc2209.cmake
Normal file
@@ -0,0 +1,19 @@
|
||||
add_library(tmc2209_driver STATIC
|
||||
src/tmc2209/step.cpp
|
||||
src/tmc2209/uart_interface.cpp
|
||||
src/tmc2209/uart_registers.cpp
|
||||
)
|
||||
|
||||
target_include_directories(tmc2209_driver PUBLIC
|
||||
include/tmc2209/
|
||||
build/
|
||||
./
|
||||
)
|
||||
|
||||
target_link_libraries(tmc2209_driver
|
||||
pico_stdlib
|
||||
hardware_uart
|
||||
hardware_pio
|
||||
FreeRTOS-Kernel-Heap4
|
||||
)
|
||||
|
||||
108
motor-control/core-xy-firmware/include/CoreXY.hpp
Normal file
108
motor-control/core-xy-firmware/include/CoreXY.hpp
Normal file
@@ -0,0 +1,108 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
#include "tmc2209/tmc2209.hpp"
|
||||
#include "tmc2209/step.hpp"
|
||||
|
||||
// LimitSwitch Pins
|
||||
#define LIMIT0_PIN 10
|
||||
#define LIMIT1_PIN 11
|
||||
#define LIMIT2_PIN 12
|
||||
#define LIMIT3_PIN 13
|
||||
|
||||
// LimitSwich Physical Wiring
|
||||
// DONT TOUCH THIS
|
||||
#define LIMIT_X0 LIMIT1_PIN
|
||||
#define LIMIT_X1 LIMIT3_PIN
|
||||
#define LIMIT_Y0 LIMIT2_PIN
|
||||
#define LIMIT_Y1 LIMIT0_PIN
|
||||
|
||||
// Motor Directions
|
||||
#define X_DIRECTION_TOP 0b01
|
||||
#define X_DIRECTION_BOTTOM 0b00
|
||||
#define Y_DIRECTION_LEFT 0b10
|
||||
#define Y_DIRECTION_RIGHT 0b00
|
||||
|
||||
// Motor Mapping
|
||||
// DONT TOUCH THIS
|
||||
#define MOTOR_X 1
|
||||
#define MOTOR_Y 0
|
||||
|
||||
// Homing Speeds
|
||||
#define HOME_SPEED_FAST 10000
|
||||
#define HOME_SPEED_SLOW 2000
|
||||
#define HOME_SPEED_VERY_SLOW 500
|
||||
#define OPERATING_SPEED 9000
|
||||
|
||||
enum HOME_AXIS_DIRECTION {
|
||||
TOP_LEFT = X_DIRECTION_TOP | Y_DIRECTION_LEFT,
|
||||
TOP_RIGHT = X_DIRECTION_TOP | Y_DIRECTION_RIGHT,
|
||||
BOTTOM_RIGHT = X_DIRECTION_BOTTOM | Y_DIRECTION_RIGHT,
|
||||
BOTTOM_LEFT = X_DIRECTION_BOTTOM | Y_DIRECTION_LEFT
|
||||
};
|
||||
|
||||
struct MotorPosition {
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
struct BoardMessurements {
|
||||
int x_padding;
|
||||
int y_padding;
|
||||
|
||||
int x_num;
|
||||
int y_num;
|
||||
|
||||
int x_offset;
|
||||
int y_offset;
|
||||
|
||||
int cell_x;
|
||||
int cell_y;
|
||||
};
|
||||
|
||||
BoardMessurements calcBoardMessurements(MotorPosition p0, MotorPosition p1, int grid_x, int grid_y, MotorPosition offset);
|
||||
MotorPosition calcPosition(BoardMessurements * messurements, int x, int y, bool offset);
|
||||
|
||||
void vTaskInitMotorHome(void *pvParameters);
|
||||
|
||||
#define HOME_COUNT 20
|
||||
class CoreXYMaschine {
|
||||
private:
|
||||
TMC2209_UART * uart_driver0;
|
||||
TMC2209_UART * uart_driver1;
|
||||
TMC2209_step_dual * step_driver;
|
||||
|
||||
bool enableMotors = false;
|
||||
|
||||
bool posUnknow = true;
|
||||
MotorPosition current_pos;
|
||||
|
||||
BoardMessurements boardMessurements;
|
||||
SemaphoreHandle_t xMoveMutex;
|
||||
|
||||
enum HOME_AXIS_DIRECTION ORIGIN = TOP_LEFT;
|
||||
|
||||
int untilNextHome = HOME_COUNT;
|
||||
|
||||
public:
|
||||
CoreXYMaschine(TMC2209_UART * uart_driver0, TMC2209_UART * uart_driver1, TMC2209_step_dual * step_driver, uint core);
|
||||
|
||||
void homeFast(MotorPosition * last_pos, bool ignoreMutex);
|
||||
void home(MotorPosition * last_pos);
|
||||
|
||||
void initLimitSW();
|
||||
void debugPrintSwitch(uint32_t switchPin);
|
||||
void debugAllSwitchStates();
|
||||
|
||||
void setMotorEnabled(bool enabled);
|
||||
bool getMotorEnabled();
|
||||
|
||||
void setBoardMessurements(BoardMessurements messurements);
|
||||
void gotoPosition(int x, int y, bool offset);
|
||||
};
|
||||
|
||||
void homeXY(TMC2209_step_dual * driver, HOME_AXIS_DIRECTION direction, unsigned int speed, unsigned int backupSpace, MotorPosition * last_pos);
|
||||
|
||||
extern absolute_time_t debounce_cooldown_ticks;
|
||||
extern absolute_time_t limit_debounce_tick;
|
||||
void isr_LimitSwitch(unsigned int gpio, uint32_t event_mask);
|
||||
|
||||
17
motor-control/core-xy-firmware/include/pinConfigNode.hpp
Normal file
17
motor-control/core-xy-firmware/include/pinConfigNode.hpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#define CORE_MASK_GOBOTRPC 0b01
|
||||
#define CORE_MASK_MOTOR 0b01
|
||||
|
||||
#define LED1_PIN 25
|
||||
#define LED2_PIN 16
|
||||
|
||||
#define RELAY_PIN 15
|
||||
|
||||
#define GORPC_INT_PIN 17
|
||||
#define GORPC_SDA_PIN 18
|
||||
#define GORPC_SCL_PIN 19
|
||||
|
||||
#define INTERRUPTION_DURATION ((int)(2.5 * 1000))
|
||||
#define INTERRUPTION_DELAY 5 * 1000
|
||||
|
||||
#define I2C_ADDR 0x23
|
||||
517
motor-control/core-xy-firmware/include/tmc2209/registers_map.hpp
Normal file
517
motor-control/core-xy-firmware/include/tmc2209/registers_map.hpp
Normal file
@@ -0,0 +1,517 @@
|
||||
#pragma once
|
||||
|
||||
// =================================================================================================
|
||||
// General Registers (p.23)
|
||||
// =================================================================================================
|
||||
#define REG_ADDR_GENERAL_GCONF 0x00
|
||||
#define REG_ADDR_GENERAL_GSTAT 0x01
|
||||
#define REG_ADDR_GENERAL_IFCNT 0x02
|
||||
#define REG_ADDR_GENERAL_NODECONF 0x03
|
||||
#define REG_ADDR_GENERAL_OTP_PROG 0x04
|
||||
#define REG_ADDR_GENERAL_OTP_READ 0x05
|
||||
#define REG_ADDR_GENERAL_IOIN 0x06
|
||||
#define REG_ADDR_GENERAL_FACTORY_CONF 0x07
|
||||
|
||||
/// @brief Global configuration flags
|
||||
struct REG_GCONF {
|
||||
/**
|
||||
* (Reset default=1)
|
||||
* 0: Use internal reference derived from 5VOUT
|
||||
* 1: Use voltage supplied to VREF as current reference
|
||||
*/
|
||||
unsigned int I_scale_analog: 1;
|
||||
|
||||
/**
|
||||
* (Reset default: OTP)
|
||||
* 0: Operation with external sense resistors
|
||||
* 1: Internal sense resistors. Use current supplied into VREF as reference for internal sense resistor. VREF pin internally is driven to GND in this mode.
|
||||
*/
|
||||
unsigned int internal_Rsense: 1;
|
||||
|
||||
/**
|
||||
* (Reset default: OTP)
|
||||
* 0: StealthChop PWM mode enabled (depending on velocity thresholds). Initially switch from off to on state while in stand still, only.
|
||||
* 1: SpreadCycle mode enabled A high level on the pin SPREAD inverts this flag to switch between both chopper modes.
|
||||
*/
|
||||
unsigned int en_SpreadCycle: 1;
|
||||
|
||||
/**
|
||||
* 1: Inverse motor direction
|
||||
*/
|
||||
unsigned int shaft: 1;
|
||||
|
||||
/**
|
||||
* 0: INDEX shows the first microstep position of sequencer
|
||||
* 1: INDEX pin outputs overtemperature prewarning flag (otpw) instead
|
||||
*/
|
||||
unsigned int index_otpw: 1;
|
||||
|
||||
/**
|
||||
* 0: INDEX output as selected by index_otpw
|
||||
* 1: INDEX output shows step pulses from internal pulse generator (toggle upon each step)
|
||||
*/
|
||||
unsigned int index_step: 1;
|
||||
|
||||
/**
|
||||
* 0: PDN_UART controls standstill current reduction
|
||||
* 1: PDN_UART input function disabled. Set this bit, when using the UART interface!
|
||||
*/
|
||||
unsigned int pdn_disable: 1;
|
||||
|
||||
/**
|
||||
* 0: Microstep resolution selected by pins MS1, MS2
|
||||
* 1: Microstep resolution selected by MRES register
|
||||
*/
|
||||
unsigned int mstep_reg_select: 1;
|
||||
|
||||
/**
|
||||
* 0: No filtering of STEP pulses
|
||||
* 1: Software pulse generator optimization enabled when fullstep frequency > 750Hz (roughly). TSTEP shows filtered step time values when active
|
||||
*/
|
||||
unsigned int multistep_filt: 1;
|
||||
|
||||
/**
|
||||
* 0: Normal operation
|
||||
* 1: Enable analog test output on pin ENN (pull down resistor off), ENN treated as enabled. IHOLD[1..0] selects the function of DCO: 0…2: T120, DAC, VDDH
|
||||
*/
|
||||
unsigned int test_mode: 1;
|
||||
|
||||
unsigned int :22;
|
||||
};
|
||||
|
||||
/// @brief Global status flags
|
||||
struct REG_GSTAT {
|
||||
/**
|
||||
* 1: Indicates that the IC has been reset since the last read access to GSTAT. All registers have been cleared to reset values.
|
||||
*/
|
||||
unsigned int reset: 1;
|
||||
|
||||
/**
|
||||
* 1: Indicates, that the driver has been shut down due to overtemperature or short circuit detection since the last read access. Read DRV_STATUS for details. The flag can only be cleared when all error conditions are cleared
|
||||
*/
|
||||
unsigned int drv_err: 1;
|
||||
|
||||
/**
|
||||
* Indicates an undervoltage on the charge pump. The driver is disabled in this case. This flag is not latched and thus does not need to be cleared
|
||||
*/
|
||||
unsigned int uv_cp: 1;
|
||||
|
||||
unsigned int :29;
|
||||
};
|
||||
|
||||
/// @brief Interface transmission counter
|
||||
struct REG_IFCNT {
|
||||
/**
|
||||
* Interface transmission counter. This register becomes incremented with each successful UART interface write access. Read out to check the serial transmission for lost data. Read accesses do not change the content. The counter wraps around from 255 to 0.
|
||||
*/
|
||||
unsigned int mstep: 8;
|
||||
|
||||
unsigned int :24;
|
||||
};
|
||||
|
||||
/// @brief Node configuration
|
||||
struct REG_NODECONF {
|
||||
unsigned int :8;
|
||||
|
||||
/**
|
||||
* SENDDELAY for read access (time until reply is sent):
|
||||
* 0, 1: 8 bit times (Attention: Don’t use in multi-node)
|
||||
* 2, 3: 3*8 bit times
|
||||
* 4, 5: 5*8 bit times
|
||||
* 6, 7: 7*8 bit times
|
||||
* 8, 9: 9*8 bit times
|
||||
* 10, 11: 11*8 bit times
|
||||
* 12, 13: 13*8 bit times
|
||||
* 14, 15: 15*8 bit times
|
||||
*/
|
||||
unsigned int senddelay: 4;
|
||||
|
||||
unsigned int :16;
|
||||
};
|
||||
|
||||
/// @brief OTP programming
|
||||
struct REG_OPT_PROG {
|
||||
/**
|
||||
* Selection of OTP bit to be programmed to the selected byte location (n=0..7: programs bit n to a logic 1)
|
||||
*/
|
||||
unsigned int otpbit: 3;
|
||||
|
||||
/**
|
||||
* Selection of OTP programming location (0, 1 or 2)
|
||||
*/
|
||||
unsigned int optbyte: 1;
|
||||
|
||||
/**
|
||||
* Set to 0xbd to enable programming. A programming time of minimum 10ms per bit is recommended (check by reading OTP_READ).
|
||||
*/
|
||||
unsigned int optmagic: 8;
|
||||
|
||||
unsigned int :16;
|
||||
};
|
||||
|
||||
/// @brief OTP read (Access to OTP memory result and update)
|
||||
struct OTP_READ {
|
||||
/// @brief OTP0 byte 0 read data
|
||||
unsigned int opt0: 8;
|
||||
|
||||
/// @brief OTP1 byte 1 read data
|
||||
unsigned int opt1: 8;
|
||||
|
||||
/// @brief OTP2 byte 2 read data
|
||||
unsigned int opt2: 8;
|
||||
|
||||
unsigned int :8;
|
||||
};
|
||||
|
||||
|
||||
/// @brief Inputs (Reads the state of all input pins available)
|
||||
struct REG_IOIN {
|
||||
unsigned int enn: 1;
|
||||
unsigned int :1;
|
||||
unsigned int ms1: 1;
|
||||
unsigned int ms2: 1;
|
||||
unsigned int diag: 1;
|
||||
unsigned int :1;
|
||||
unsigned int pdn_uart: 1;
|
||||
unsigned int step: 1;
|
||||
unsigned int spread_en: 1;
|
||||
unsigned int dir: 1;
|
||||
|
||||
/**
|
||||
* @brief VERSION: 0x21=first version of the IC Identical numbers mean full digital compatibility.
|
||||
*/
|
||||
unsigned int version: 8;
|
||||
};
|
||||
|
||||
struct REG_FACTORY_CONF {
|
||||
/**
|
||||
* Lowest to highest clock frequency. Check at charge pump output. The frequency span is not guaranteed, but it is tested, that tuning to 12MHz internal clock is possible. The devices come preset to 12MHz clock frequency by OTP programming.
|
||||
*/
|
||||
unsigned int fclktrim: 5;
|
||||
|
||||
/**
|
||||
* %00: OT=143°C, OTPW=120°C
|
||||
* %01: OT=150°C, OTPW=120°C
|
||||
* %10: OT=150°C, OTPW=143°C
|
||||
* %11: OT=157°C, OTPW=143°C
|
||||
*/
|
||||
unsigned int ottrim: 2;
|
||||
|
||||
unsigned int :25;
|
||||
};
|
||||
|
||||
// =================================================================================================
|
||||
// Velocity Dependent Control (p.28)
|
||||
// =================================================================================================
|
||||
#define REG_ADDR_VELOCITY_IHOLD_IRUN 0x10
|
||||
#define REG_ADDR_VELOCITY_TPOWERDOWN 0x11
|
||||
#define REG_ADDR_VELOCITY_TSTEP 0x12
|
||||
#define REG_ADDR_VELOCITY_TPWMTHRS 0x13
|
||||
#define REG_ADDR_VELOCITY_VACTUAL 0x22
|
||||
|
||||
/// @brief Driver current control
|
||||
struct REG_IHOLD_IRUN {
|
||||
/**
|
||||
* (Reset default: OTP)
|
||||
* IHOLD (Reset default: OTP)
|
||||
* Standstill current (0=1/32 … 31=32/32)
|
||||
* In combination with StealthChop mode, setting
|
||||
* IHOLD=0 allows to choose freewheeling or coil short circuit (passive braking) for motor stand still.
|
||||
*/
|
||||
unsigned int ihold: 5;
|
||||
|
||||
/**
|
||||
* (Reset default=31)
|
||||
* Motor run current (0=1/32 … 31=32/32)
|
||||
*
|
||||
* Tint: Choose sense resistors in a way, that normal IRUN is 16 to 31 for best microstep performance.
|
||||
*/
|
||||
unsigned int irun: 5;
|
||||
|
||||
/**
|
||||
* (Reset default: OTP)
|
||||
* Controls the number of clock cycles for motor power down after standstill is detected (stst=1) and TPOWERDOWN has expired. The smooth transition avoids a motor jerk upon power down.
|
||||
* 0: instant power down
|
||||
* 1..15: Delay per current reduction step in multiple of 2^18 clocks
|
||||
*/
|
||||
unsigned int iholddelay: 4;
|
||||
unsigned int :18;
|
||||
};
|
||||
|
||||
|
||||
struct REG_TPOWERDOWN {
|
||||
/**
|
||||
* (Reset default=20)
|
||||
* Sets the delay time from stand still (stst) detection to motor current power down. Time range is about 0 to 5.6 seconds.
|
||||
* 0…((2^8)-1) * 2^18 tCLK
|
||||
* Attention: A minimum setting of 2 is required to allow automatic tuning of StealthChop PWM_OFFS_AUTO.
|
||||
*/
|
||||
unsigned int tpow: 8;
|
||||
|
||||
unsigned int :24;
|
||||
};
|
||||
|
||||
/// @brief Time between two 1/256 microsteps
|
||||
struct REG_TSTEP {
|
||||
/**
|
||||
* Actual measured time between two 1/256 microsteps derived from the step input frequency in units of 1/fCLK. Measured value is (2^20)-1 in case of overflow or stand still. TSTEP always relates to 1/256 step, independent of the actual MRES. The TSTEP related threshold uses a hysteresis of 1/16 of the compare value to compensate for jitter in the clock or the step frequency: (Txxx*15/16)-1 is the lower compare value for each TSTEP based comparison.
|
||||
* This means, that the lower switching velocity equals the calculated setting, but the upper switching velocity is higher as defined by the hysteresis setting.
|
||||
*
|
||||
*/
|
||||
unsigned int tstep: 20;
|
||||
|
||||
unsigned int :12;
|
||||
};
|
||||
|
||||
/// @brief Upper velocity for StealthChop voltage PWM mode
|
||||
struct REG_TPWMTHRS {
|
||||
/**
|
||||
* Sets the upper velocity for StealthChop voltage PWM mode.
|
||||
* TSTEP ≥ TPWMTHRS
|
||||
* - StealthChop PWM mode is enabled, if configured
|
||||
* When the velocity exceeds the limit set by TPWMTHRS, the driver switches to SpreadCycle.
|
||||
* 0: Disabled
|
||||
*/
|
||||
unsigned int tpwmthrs: 20;
|
||||
|
||||
unsigned int :12;
|
||||
};
|
||||
|
||||
struct REG_VACTUAL {
|
||||
/**
|
||||
* ACTUAL allows moving the motor by UART control.
|
||||
* It gives the motor velocity in +-(2^23)-1 [μsteps / t]
|
||||
* 0: Normal operation. Driver reacts to STEP input.
|
||||
* !=0: Motor moves with the velocity given by VACTUAL. Step pulses can be monitored via INDEX output. The motor direction is controlled by the sign of VACTUAL.
|
||||
*/
|
||||
int vactual: 24;
|
||||
|
||||
unsigned int :8;
|
||||
};
|
||||
|
||||
// =================================================================================================
|
||||
// StallGuard (p.29)
|
||||
// =================================================================================================
|
||||
|
||||
#define REG_ADDR_STALLGUARD_TCOOLTHRS 0x14
|
||||
#define REG_ADDR_STALLGUARD_SGTHRS 0x40
|
||||
#define REG_ADDR_STALLGUARD_SG_RESULT 0x41
|
||||
#define REG_ADDR_STALLGUARD_COOLCONF 0x42
|
||||
|
||||
struct REG_TCOOLTHRS {
|
||||
/**
|
||||
* This is the lower threshold velocity for switching on smart energy CoolStep and StallGuard to DIAG output. (unsigned) Set this parameter to disable CoolStep at low speeds, where it cannot work reliably. The stall output signal become enabled when exceeding this velocity. It becomes disabled again once the velocity falls below this threshold.
|
||||
* TCOOLTHRS ≥ TSTEP > TPWMTHRS
|
||||
* - CoolStep is enabled, if configured (only with StealthChop)
|
||||
* - Stall output signal on pin DIAG is enabled
|
||||
*/
|
||||
unsigned int tcoolthrs: 20;
|
||||
|
||||
unsigned int :12;
|
||||
};
|
||||
|
||||
struct REG_SGTHRS {
|
||||
/**
|
||||
* Detection threshold for stall. The StallGuard value SG_RESULT becomes compared to the double of this threshold. A stall is signaled with
|
||||
* SG_RESULT ≤ SGTHRS*2
|
||||
*/
|
||||
unsigned int sgthrs: 8;
|
||||
|
||||
unsigned int :24;
|
||||
};
|
||||
|
||||
struct REG_SG_RESULT {
|
||||
/**
|
||||
* StallGuard result. SG_RESULT becomes updated with each fullstep, independent of TCOOLTHRS and SGTHRS. A higher value signals a lower motor load and more torque headroom. Intended for StealthChop mode, only. Bits 9 and 0 will always show 0. Scaling to 10 bit is for compatibility to StallGuard2
|
||||
*/
|
||||
unsigned int sg_result: 10;
|
||||
|
||||
unsigned int :22;
|
||||
};
|
||||
|
||||
struct REG_COOLCONF {
|
||||
/**
|
||||
* @brief CoolStep configuration
|
||||
*/
|
||||
unsigned int coolconf: 16;
|
||||
|
||||
unsigned int :16;
|
||||
};
|
||||
|
||||
// =================================================================================================
|
||||
// Sequencer Registers (p.30)
|
||||
// =================================================================================================q
|
||||
|
||||
#define REG_ADDR_SEQUENCER_MSCNT 0x6A
|
||||
#define REG_ADDR_SEQUENCER_MSCURACT 0x6B
|
||||
|
||||
/// @brief Microstep counter
|
||||
struct REG_MSCNT {
|
||||
/**
|
||||
* Microstep counter. Indicates actual position in the microstep table for CUR_A. CUR_B uses an offset of 256 into the table. Reading out MSCNT allows determination of the motor position within the electrical wave.
|
||||
*/
|
||||
unsigned int mscnt: 10;
|
||||
|
||||
unsigned int :22;
|
||||
};
|
||||
|
||||
/// @brief Microstep current (actual)
|
||||
struct REG_MSCURACT {
|
||||
/**
|
||||
* Actual microstep current for motor phase B (sine wave) as read from the internal sine wave table (not scaled by current setting)
|
||||
*/
|
||||
int cur_a: 9;
|
||||
|
||||
/**
|
||||
* Actual microstep current for motor phase A (co-sine wave) as read from the internal sine wave table (not scaled by current setting)
|
||||
*/
|
||||
int cur_b: 9;
|
||||
|
||||
unsigned int :14;
|
||||
};
|
||||
|
||||
// =================================================================================================
|
||||
// Chopper Registers (p.32)
|
||||
// =================================================================================================
|
||||
|
||||
#define REG_ADDR_CHOPPER_CHOPCONF 0x6C
|
||||
#define REG_ADDR_CHOPPER_DRV_STATUS 0x6F
|
||||
#define REG_ADDR_CHOPPER_PWMCONF 0x70
|
||||
#define REG_ADDR_CHOPPER_PWM_SCALE 0x71
|
||||
#define REG_ADDR_CHOPPER_PWM_AUTO 0x72
|
||||
|
||||
struct REG_CHOPCONF {
|
||||
/**
|
||||
* @brief off time and driver enable
|
||||
* Off time setting controls duration of slow decay phase
|
||||
* NCLK= 24 + 32*TOFF
|
||||
* %0000: Driver disable, all bridges off
|
||||
* %0001: 1 – use only with TBL ≥ 2
|
||||
* %0010 ... %1111: 2 ... 15
|
||||
* (Default: OTP, resp. 3 in StealthChop mode)
|
||||
*/
|
||||
unsigned int toff: 4;
|
||||
|
||||
/**
|
||||
* @brief hysteresis start value added to HEND
|
||||
* %000 ... %111:
|
||||
* Add 1, 2, ..., 8 to hysteresis low value HEND
|
||||
* (1/512 of this setting adds to current setting)
|
||||
* Attention: Effective HEND+HSTRT ≤ 16.
|
||||
* Hint: Hysteresis decrement is done each 16 clocks
|
||||
*/
|
||||
unsigned int hstrt: 3;
|
||||
|
||||
/**
|
||||
* @brief HEND hysteresis low value OFFSET sine wave offset
|
||||
* %0000 ... %1111:
|
||||
* Hysteresis is -3, -2, -1, 0, 1, ..., 12
|
||||
* (1/512 of this setting adds to current setting)
|
||||
* This is the hysteresis value which becomes used for the hysteresis chopper.
|
||||
* (Default: OTP, resp. 0 in StealthChop mode)
|
||||
*/
|
||||
unsigned int hend: 4;
|
||||
|
||||
unsigned int :1;
|
||||
|
||||
/**
|
||||
* @brief TBL blank time select
|
||||
* %00 ... %11:
|
||||
* Set comparator blank time to 16, 24, 32 or 40 clocks
|
||||
* Hint: %00 or %01 is recommended for most applications
|
||||
* (Default: OTP)
|
||||
*/
|
||||
unsigned int tbl: 2;
|
||||
|
||||
/**
|
||||
* @brief sense resistor voltage based current scaling
|
||||
* 0: Low sensitivity, high sense resistor voltage
|
||||
* 1: High sensitivity, low sense resistor voltage
|
||||
*/
|
||||
unsigned int vsense: 1;
|
||||
|
||||
unsigned int :6;
|
||||
|
||||
/**
|
||||
* @brief micro step resolution
|
||||
* %0000: Native 256 microstep setting.
|
||||
* %0001 ... %1000:
|
||||
* 128, 64, 32, 16, 8, 4, 2, FULLSTEP
|
||||
* Reduced microstep resolution.
|
||||
* The resolution gives the number of microstep entries per sine quarter wave.
|
||||
* When choosing a lower microstep resolution, the driver automatically uses microstep positions which result in a symmetrical wave.
|
||||
* Number of microsteps per step pulse = 2^MRES (Selection by pins unless disabled by GCONF. mstep_reg_select)
|
||||
*/
|
||||
unsigned int mres: 4;
|
||||
|
||||
/**
|
||||
* @brief interpolation to 256 microsteps
|
||||
* 1: The actual microstep resolution (MRES) becomes extrapolated to 256 microsteps for smoothest motor operation. (Default: 1)
|
||||
*/
|
||||
unsigned int intpol: 1;
|
||||
|
||||
/**
|
||||
* @brief enable double edge step pulses
|
||||
* 1: Enable step impulse at each step edge to reduce step frequency requirement. This mode is not compatible with the step filtering function (multistep_filt)
|
||||
*/
|
||||
unsigned int dedge: 1;
|
||||
|
||||
/**
|
||||
* @brief short to GND protection disable
|
||||
* 0: Short to GND protection is on
|
||||
* 1: Short to GND protection is disabled
|
||||
*/
|
||||
unsigned int diss2g: 1;
|
||||
|
||||
/**
|
||||
* @brief Low side short protection disable
|
||||
* 0: Short protection low side is on
|
||||
* 1: Short protection low side is disabled
|
||||
*/
|
||||
unsigned int diss2vs: 1;
|
||||
};
|
||||
|
||||
struct DRV_STATUS {
|
||||
unsigned int drv_status: 32;
|
||||
};
|
||||
|
||||
struct PWMCONF {
|
||||
unsigned int pwmconf: 22;
|
||||
unsigned int :10;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Results of StealthChop amplitude regulator. These values can be used to monitor automatic PWM amplitude scaling (255=max. voltage).
|
||||
*/
|
||||
struct PWM_SCALE {
|
||||
/**
|
||||
* Actual PWM duty cycle. This value is used for scaling the values CUR_A and CUR_B read from the sine wave table.
|
||||
*/
|
||||
unsigned int pwm_scale_sum: 8;
|
||||
|
||||
/**
|
||||
* 9 Bit signed offset added to the calculated PWM duty cycle. This is the result of the automatic amplitude regulation based on current measurement.
|
||||
*/
|
||||
unsigned int pwm_scale_auto: 9;
|
||||
|
||||
unsigned int :15;
|
||||
};
|
||||
|
||||
/**
|
||||
* These automatically generated values can be read out in order to determine a default / power up setting for PWM_GRAD and PWM_OFS.
|
||||
*/
|
||||
struct PWM_AUTO {
|
||||
|
||||
/**
|
||||
* Automatically determined offset value
|
||||
*/
|
||||
unsigned int pwm_ofs_auto: 8;
|
||||
|
||||
/**
|
||||
* Automatically determined gradient value
|
||||
*/
|
||||
unsigned int pwm_grad_auto: 8;
|
||||
|
||||
unsigned int :16;
|
||||
};
|
||||
83
motor-control/core-xy-firmware/include/tmc2209/step.hpp
Normal file
83
motor-control/core-xy-firmware/include/tmc2209/step.hpp
Normal file
@@ -0,0 +1,83 @@
|
||||
#pragma once
|
||||
#include "hardware/pio.h"
|
||||
#include "pulser.pio.h"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "semphr.h"
|
||||
|
||||
class TMC2209_step_dual {
|
||||
private:
|
||||
uint step0_pin;
|
||||
uint step1_pin;
|
||||
uint dir0_pin;
|
||||
uint dir1_pin;
|
||||
uint enable0_pin;
|
||||
uint enable1_pin;
|
||||
|
||||
const int sm_num_divider0 = 0;
|
||||
const int sm_num_divider1 = 1;
|
||||
const int sm_num_counter0 = 2;
|
||||
const int sm_num_counter1 = 3;
|
||||
|
||||
PIO pio_core;
|
||||
|
||||
pio_sm_config sm_config_divider0;
|
||||
pio_sm_config sm_config_counter0;
|
||||
pio_sm_config sm_config_divider1;
|
||||
pio_sm_config sm_config_counter1;
|
||||
|
||||
uint pulser_program_offset;
|
||||
const uint subprogram_offset_divider = 0;
|
||||
const uint subprogram_offset_counter = 6;
|
||||
|
||||
const float base_clock_freq_khz = 500.0;
|
||||
|
||||
const uint32_t sleep_time_us = 500;
|
||||
|
||||
SemaphoreHandle_t xDoneSemaphore0;
|
||||
SemaphoreHandle_t xDoneSemaphore1;
|
||||
|
||||
uint remaining_step_count0;
|
||||
uint remaining_step_count1;
|
||||
|
||||
protected:
|
||||
void init_pio();
|
||||
void init_gpio();
|
||||
|
||||
|
||||
public:
|
||||
void irq_handler0();
|
||||
void irq_handler1();
|
||||
|
||||
TMC2209_step_dual(
|
||||
uint step0_pin,
|
||||
uint step1_pin,
|
||||
uint dir0_pin,
|
||||
uint dir1_pin,
|
||||
uint enable0_pin,
|
||||
uint enable1_pin,
|
||||
PIO pio_core
|
||||
);
|
||||
|
||||
void set_conf0(uint frequency, bool dir);
|
||||
void set_conf1(uint frequency, bool dir);
|
||||
|
||||
void pulse0(uint n);
|
||||
void pulse1(uint n);
|
||||
|
||||
void pulse0_int(int n);
|
||||
void pulse1_int(int n);
|
||||
|
||||
void wait0(int timeout_ms);
|
||||
void wait1(int timeout_ms);
|
||||
|
||||
uint get_remaining_steps0();
|
||||
uint get_remaining_steps1();
|
||||
|
||||
void set_enable0(bool enable);
|
||||
void set_enable1(bool enable);
|
||||
};
|
||||
|
||||
extern TMC2209_step_dual * g_step_driver_instance;
|
||||
void step_irq0_handler();
|
||||
void step_irq1_handler();
|
||||
125
motor-control/core-xy-firmware/include/tmc2209/tmc2209.hpp
Normal file
125
motor-control/core-xy-firmware/include/tmc2209/tmc2209.hpp
Normal file
@@ -0,0 +1,125 @@
|
||||
#pragma once
|
||||
#include "pico/stdlib.h"
|
||||
#include "hardware/uart.h"
|
||||
|
||||
#include "registers_map.hpp"
|
||||
|
||||
/**
|
||||
* @brief Interface to communicate with TMC2209 driver via UART
|
||||
* This implements basic read and write operations to the TMC2209 driver
|
||||
* It does not implement any register specific operations
|
||||
*/
|
||||
class TMC2209_UART {
|
||||
private:
|
||||
uint8_t node_address;
|
||||
uart_inst_t *uart_inst;
|
||||
uint baudrate;
|
||||
uint tx_pin;
|
||||
uint rx_pin;
|
||||
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new tmc2209 uart object
|
||||
* This does not initialize the UART peripheral, it just sets the parameters
|
||||
*
|
||||
* @param uart_id which UART to use (uart0 or uart1)
|
||||
* @param node_address this is the address of the TMC2209 driver set by ms1, ms2 pins (0-3)
|
||||
* @param baudrate UART baudrate to use (250k > baudrate > 2000, good value 115200, the tmc2209 has automatic baudrate detection)
|
||||
* @param tx_pin TX pin of RP2040. Depending on the UART peripheral, diffrent pins are valid
|
||||
* @param rx_pin RX pin of RP2040. Depending on the UART peripheral, diffrent pins are valid
|
||||
*/
|
||||
TMC2209_UART(uart_inst_t *uart_inst, uint8_t node_address, uint baudrate, uint tx_pin, uint rx_pin);
|
||||
|
||||
/**
|
||||
* @brief Initialize UART peripheral and pins
|
||||
*
|
||||
*/
|
||||
void init();
|
||||
|
||||
/**
|
||||
* @brief Calculate CRC8-ATM checksum for the given data
|
||||
* the specific implementation is taken from TMC2209 datasheet
|
||||
*
|
||||
* @param data Data to calculate CRC for
|
||||
* @param size Size of the data (without CRC byte)
|
||||
* @return uint8_t Calculated CRC8 checksum
|
||||
*/
|
||||
uint8_t calc_crc8_atm(uint8_t *data, uint8_t size);
|
||||
|
||||
/**
|
||||
* @brief Perform a read operation to the TMC2209 driver
|
||||
* This does not check if register is write only.
|
||||
* It will wait for the response from the driver
|
||||
*
|
||||
* @param address
|
||||
* @return uint32_t Data read from the register
|
||||
*/
|
||||
uint32_t read(uint8_t address);
|
||||
|
||||
/**
|
||||
* @brief Perform a write operation to the TMC2209 driver
|
||||
* This does not check if register is read only.
|
||||
* It will wait for the response from the driver
|
||||
*
|
||||
* @param address Where to write the data (register Address)
|
||||
* @param value Data to write to the register
|
||||
*/
|
||||
void write(uint8_t address, uint32_t value);
|
||||
|
||||
/**
|
||||
* @brief This if any CRC error occured during the last read/write operation. Should be checked after each operation
|
||||
*/
|
||||
bool crc_error_flag = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Higher level interface to TMC2209 driver
|
||||
* This class simplifies dealing with the registers of the TMC2209 driver
|
||||
* so you can just set the values
|
||||
*/
|
||||
class TMC2209_Registers {
|
||||
|
||||
private:
|
||||
TMC2209_UART uart_driver;
|
||||
|
||||
REG_CHOPCONF chopconfBuffer;
|
||||
|
||||
public:
|
||||
TMC2209_Registers(TMC2209_UART uart_driver);
|
||||
|
||||
void set_reg_gconf(
|
||||
bool i_scale_analog,
|
||||
bool internal_rsense,
|
||||
bool en_SpreadCycle,
|
||||
bool shaft,
|
||||
bool index_otpw,
|
||||
bool index_step,
|
||||
bool pdn_disable,
|
||||
bool mstep_reg_select,
|
||||
bool multistep_filt
|
||||
);
|
||||
|
||||
void set_holdCurrent(
|
||||
uint8_t currentHold,
|
||||
uint8_t currentRun,
|
||||
uint8_t holdDelay
|
||||
);
|
||||
|
||||
void set_thresholdPowerdown(uint8_t threshold);
|
||||
void set_thresholdStealthChop(uint32_t threshold);
|
||||
void set_thresholdCoolStep(uint32_t threshold);
|
||||
void set_thresholdStall(uint8_t threshold);
|
||||
|
||||
void set_chopConfig(
|
||||
bool lowsideShortProtection,
|
||||
bool GNDShortProtection,
|
||||
bool doubleEdge,
|
||||
bool interpolation,
|
||||
uint8_t microstepResolution,
|
||||
bool voltageSensatifity,
|
||||
uint8_t hysteresisOffset,
|
||||
uint8_t hysteresisStart
|
||||
);
|
||||
|
||||
};
|
||||
Submodule motor-control/core-xy-firmware/lib/FreeRTOS-Kernel added at e55bde2133
1
motor-control/core-xy-firmware/lib/gobotrpc
Symbolic link
1
motor-control/core-xy-firmware/lib/gobotrpc
Symbolic link
@@ -0,0 +1 @@
|
||||
/home/alexander/Projects/gobot/i2c-hub/firmware/i2c-hub-firmware/src/gobotrpc
|
||||
84
motor-control/core-xy-firmware/pico_sdk_import.cmake
Normal file
84
motor-control/core-xy-firmware/pico_sdk_import.cmake
Normal file
@@ -0,0 +1,84 @@
|
||||
# This is a copy of <PICO_SDK_PATH>/external/pico_sdk_import.cmake
|
||||
|
||||
# This can be dropped into an external project to help locate this SDK
|
||||
# It should be include()ed prior to project()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH))
|
||||
set(PICO_SDK_PATH $ENV{PICO_SDK_PATH})
|
||||
message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')")
|
||||
endif ()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT))
|
||||
set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT})
|
||||
message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')")
|
||||
endif ()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH))
|
||||
set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH})
|
||||
message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')")
|
||||
endif ()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_TAG} AND (NOT PICO_SDK_FETCH_FROM_GIT_TAG))
|
||||
set(PICO_SDK_FETCH_FROM_GIT_TAG $ENV{PICO_SDK_FETCH_FROM_GIT_TAG})
|
||||
message("Using PICO_SDK_FETCH_FROM_GIT_TAG from environment ('${PICO_SDK_FETCH_FROM_GIT_TAG}')")
|
||||
endif ()
|
||||
|
||||
if (PICO_SDK_FETCH_FROM_GIT AND NOT PICO_SDK_FETCH_FROM_GIT_TAG)
|
||||
set(PICO_SDK_FETCH_FROM_GIT_TAG "master")
|
||||
message("Using master as default value for PICO_SDK_FETCH_FROM_GIT_TAG")
|
||||
endif()
|
||||
|
||||
set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK")
|
||||
set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable")
|
||||
set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK")
|
||||
set(PICO_SDK_FETCH_FROM_GIT_TAG "${PICO_SDK_FETCH_FROM_GIT_TAG}" CACHE FILEPATH "release tag for SDK")
|
||||
|
||||
if (NOT PICO_SDK_PATH)
|
||||
if (PICO_SDK_FETCH_FROM_GIT)
|
||||
include(FetchContent)
|
||||
set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR})
|
||||
if (PICO_SDK_FETCH_FROM_GIT_PATH)
|
||||
get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")
|
||||
endif ()
|
||||
# GIT_SUBMODULES_RECURSE was added in 3.17
|
||||
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0")
|
||||
FetchContent_Declare(
|
||||
pico_sdk
|
||||
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
|
||||
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
|
||||
GIT_SUBMODULES_RECURSE FALSE
|
||||
)
|
||||
else ()
|
||||
FetchContent_Declare(
|
||||
pico_sdk
|
||||
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
|
||||
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (NOT pico_sdk)
|
||||
message("Downloading Raspberry Pi Pico SDK")
|
||||
FetchContent_Populate(pico_sdk)
|
||||
set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR})
|
||||
endif ()
|
||||
set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE})
|
||||
else ()
|
||||
message(FATAL_ERROR
|
||||
"SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git."
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
|
||||
if (NOT EXISTS ${PICO_SDK_PATH})
|
||||
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found")
|
||||
endif ()
|
||||
|
||||
set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake)
|
||||
if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE})
|
||||
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK")
|
||||
endif ()
|
||||
|
||||
set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE)
|
||||
|
||||
include(${PICO_SDK_INIT_CMAKE_FILE})
|
||||
18
motor-control/core-xy-firmware/src/corexy/init.cpp
Normal file
18
motor-control/core-xy-firmware/src/corexy/init.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#include "CoreXY.hpp"
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
CoreXYMaschine::CoreXYMaschine(TMC2209_UART * uart_driver0, TMC2209_UART * uart_driver1, TMC2209_step_dual * step_driver, uint core) {
|
||||
this->uart_driver0 = uart_driver0;
|
||||
this->uart_driver1 = uart_driver1;
|
||||
this->step_driver = step_driver;
|
||||
|
||||
this->uart_driver0->init();
|
||||
this->uart_driver1->init();
|
||||
|
||||
this->xMoveMutex = xSemaphoreCreateMutex();
|
||||
|
||||
initLimitSW();
|
||||
setMotorEnabled(true);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user