Implemented PACKET_RX,PACKET_TX and Heartbeat of GobotRPC_CtrlInterface

This commit is contained in:
AlexanderHD27
2025-01-03 02:24:34 +01:00
parent 894d5f4380
commit cbf702c6d5
45 changed files with 653 additions and 843 deletions

View File

@@ -1,6 +1,6 @@
<mxfile host="Electron" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/25.0.1 Chrome/128.0.6613.186 Electron/32.2.6 Safari/537.36" version="25.0.1"> <mxfile host="Electron" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/25.0.1 Chrome/128.0.6613.186 Electron/32.2.6 Safari/537.36" version="25.0.1">
<diagram name="Page-1" id="VLDBnTalcAr4j7jpmEzg"> <diagram name="Page-1" id="VLDBnTalcAr4j7jpmEzg">
<mxGraphModel dx="1195" dy="698" 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"> <mxGraphModel dx="1434" dy="870" 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> <root>
<mxCell id="0" /> <mxCell id="0" />
<mxCell id="1" parent="0" /> <mxCell id="1" parent="0" />
@@ -627,7 +627,7 @@
<mxCell id="weFQkCekfF49Ojb9-c9R-198" value="UART Adapter&lt;div&gt;(Python)&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"> <mxCell id="weFQkCekfF49Ojb9-c9R-198" value="UART Adapter&lt;div&gt;(Python)&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="1519.26" y="400" width="120" height="40" as="geometry" /> <mxGeometry x="1519.26" y="400" width="120" height="40" as="geometry" />
</mxCell> </mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-200" value="" style="endArrow=none;dashed=1;html=1;rounded=0;strokeWidth=3;" edge="1" parent="1"> <mxCell id="weFQkCekfF49Ojb9-c9R-200" value="" style="endArrow=none;dashed=1;html=1;rounded=0;strokeWidth=3;" edge="1" parent="1" source="weFQkCekfF49Ojb9-c9R-315">
<mxGeometry width="50" height="50" relative="1" as="geometry"> <mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="1680" y="900" as="sourcePoint" /> <mxPoint x="1680" y="900" as="sourcePoint" />
<mxPoint x="1680" y="400" as="targetPoint" /> <mxPoint x="1680" y="400" as="targetPoint" />
@@ -735,8 +735,8 @@
<mxCell id="weFQkCekfF49Ojb9-c9R-230" value="Buffering" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"> <mxCell id="weFQkCekfF49Ojb9-c9R-230" value="Buffering" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="1540" y="760" width="80" height="40" as="geometry" /> <mxGeometry x="1540" y="760" width="80" height="40" as="geometry" />
</mxCell> </mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-232" value="&lt;b&gt;GoRPC Ctrl Protocol&lt;/b&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"> <mxCell id="weFQkCekfF49Ojb9-c9R-232" value="&lt;b&gt;&lt;font style=&quot;font-size: 20px;&quot;&gt;GoRPC Ctrl Protocol&lt;/font&gt;&lt;/b&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="1240" y="1040" width="240" height="40" as="geometry" /> <mxGeometry x="1199.49" y="1080" width="240" height="40" as="geometry" />
</mxCell> </mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-233" value="Msg Type" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"> <mxCell id="weFQkCekfF49Ojb9-c9R-233" value="Msg Type" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="1280.34" y="1140" width="79.66" height="20" as="geometry" /> <mxGeometry x="1280.34" y="1140" width="79.66" height="20" as="geometry" />
@@ -751,25 +751,204 @@
<mxGeometry x="1360" y="1120" width="440" height="20" as="geometry" /> <mxGeometry x="1360" y="1120" width="440" height="20" as="geometry" />
</mxCell> </mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-237" value="TX Package" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"> <mxCell id="weFQkCekfF49Ojb9-c9R-237" value="TX Package" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="1200.34" y="1219" width="80" height="21" as="geometry" /> <mxGeometry x="1200" y="1200" width="80" height="21" as="geometry" />
</mxCell> </mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-239" value="0x01" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"> <mxCell id="weFQkCekfF49Ojb9-c9R-239" value="0x01" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="1281.62" y="1220" width="79.66" height="20" as="geometry" /> <mxGeometry x="1281.28" y="1201" width="79.66" height="20" as="geometry" />
</mxCell> </mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-240" value="1" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"> <mxCell id="weFQkCekfF49Ojb9-c9R-240" value="1" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="1281.62" y="1200" width="79.66" height="20" as="geometry" /> <mxGeometry x="1281.28" y="1181" width="79.66" height="20" as="geometry" />
</mxCell> </mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-241" value="GoRPC Package" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"> <mxCell id="weFQkCekfF49Ojb9-c9R-241" value="GoRPC Package" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="1360.98" y="1220" width="239.02" height="19" as="geometry" /> <mxGeometry x="1360.64" y="1201" width="239.02" height="19" as="geometry" />
</mxCell> </mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-242" value="RX Package" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"> <mxCell id="weFQkCekfF49Ojb9-c9R-242" value="RX Package" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="1200.34" y="1239" width="80" height="21" as="geometry" /> <mxGeometry x="1199.66" y="1239" width="80" height="21" as="geometry" />
</mxCell> </mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-243" value="0x02" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"> <mxCell id="weFQkCekfF49Ojb9-c9R-243" value="0x02" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="1281.6899999999998" y="1239" width="79.66" height="20" as="geometry" /> <mxGeometry x="1281.01" y="1239" width="79.66" height="20" as="geometry" />
</mxCell> </mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-244" value="GoRPC Package" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"> <mxCell id="weFQkCekfF49Ojb9-c9R-244" value="GoRPC Package" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="1361.96" y="1239" width="238.04" height="20" as="geometry" /> <mxGeometry x="1361.2800000000002" y="1239" width="238.04" height="20" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-245" value="0-255" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="1359.3200000000002" y="1219" width="240" height="20" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-247" value="0-255" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="1360.9800000000002" y="1180" width="240" height="20" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-248" value="1" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="1281.28" y="1219" width="79.66" height="20" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-249" value="Perform Scan" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="1199.66" y="1280" width="80" height="21" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-250" value="0x03" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="1281.62" y="1281" width="79.66" height="20" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-251" value="1" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="1279.66" y="1260" width="79.66" height="20" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-252" value="Scan Result" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="1199.66" y="1320" width="80" height="21" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-253" value="0x04" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="1281.4699999999998" y="1320" width="79.66" height="20" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-254" value="Address" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="1359.32" y="1320" width="160" height="20" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-255" value="Node Type" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="1519.32" y="1320" width="118.05" height="20" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-256" value="Status" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="1637.37" y="1320" width="81.95" height="20" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-257" value="4" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="332.45" y="770" width="160" height="20" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-258" value="4" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="491.72999999999996" y="770" width="160.72" height="20" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-259" value="4" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="1361.28" y="1300" width="160" height="20" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-260" value="3" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="1521.28" y="1300" width="118.05" height="20" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-261" value="2" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="1639.33" y="1300" width="81.95" height="20" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-262" value="1" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="1279.66" y="1300" width="79.66" height="20" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-267" value="&lt;span style=&quot;font-weight: 400;&quot;&gt;GobotRPC_CI&lt;/span&gt;" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="1910" y="1022" width="270" height="190" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-268" value="+&amp;nbsp;&lt;span style=&quot;text-align: center;&quot;&gt;GobotRPC_CI&lt;/span&gt;_Hardware: type" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-267">
<mxGeometry y="26" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-271" value="+ field: type" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-267">
<mxGeometry y="52" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-269" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-267">
<mxGeometry y="78" width="270" height="8" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-270" value="registerCB_TxPackage(cb,args)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-267">
<mxGeometry y="86" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-303" value="send_RXPackage(package)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-267">
<mxGeometry y="112" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-310" value="heartBeartTaskFn" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-267">
<mxGeometry y="138" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-286" value="onRxData" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-267">
<mxGeometry y="164" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-272" value="&lt;div&gt;&lt;span style=&quot;font-weight: 400;&quot;&gt;«interface»&lt;/span&gt;&lt;span style=&quot;font-weight: 400;&quot;&gt;&lt;br&gt;&lt;/span&gt;&lt;/div&gt;GobotRPC_CI_Hardware" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=40;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="2230" y="1239" width="270" height="92" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-285" value="registerRXCallback(cb, args)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-272">
<mxGeometry y="40" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-276" value="&lt;i&gt;abstract&amp;nbsp;send(data, length)&lt;/i&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-272">
<mxGeometry y="66" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-277" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;endArrow=diamondThin;endFill=1;" edge="1" parent="1" source="weFQkCekfF49Ojb9-c9R-268" target="weFQkCekfF49Ojb9-c9R-272">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-284" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=blockThin;endFill=1;" edge="1" parent="1" source="weFQkCekfF49Ojb9-c9R-279" target="weFQkCekfF49Ojb9-c9R-272">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-279" value="&lt;span style=&quot;font-weight: 400;&quot;&gt;GobotRPC_CI_Hardware_RP2040_UART&lt;/span&gt;" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="2220" y="1355" width="290" height="164" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-294" value="vTaskHandle rxTaskHandle" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-279">
<mxGeometry y="26" width="290" height="26" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-297" value="vSemphoreHandle rxDataSemphore" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-279">
<mxGeometry y="52" width="290" height="26" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-293" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-279">
<mxGeometry y="78" width="290" height="8" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-291" value="rxISR();" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-279">
<mxGeometry y="86" width="290" height="26" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-292" value="rxTask();" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-279">
<mxGeometry y="112" width="290" height="26" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-300" value="rxHandler();" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-279">
<mxGeometry y="138" width="290" height="26" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-290" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;endArrow=diamondThin;endFill=1;" edge="1" parent="1" source="weFQkCekfF49Ojb9-c9R-289" target="weFQkCekfF49Ojb9-c9R-279">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-289" value="GobotRPC_CI_Hardware_RP2040_UART_ISR(args)" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="2560" y="1361" width="360" height="40" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-295" value="GobotRPC_CI_Hardware_RP2040_UART_RXTaskFn(args)" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="2563" y="1416.41" width="360" height="40" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-296" value="extern g_GobotRPC_CI_Hardware_RP2040_UART" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="2563" y="1467" width="360" height="40" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-298" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.999;entryY=1.095;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="weFQkCekfF49Ojb9-c9R-295" target="weFQkCekfF49Ojb9-c9R-297">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-299" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.988;entryY=0.418;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="weFQkCekfF49Ojb9-c9R-296" target="weFQkCekfF49Ojb9-c9R-293">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="2540" y="1487" />
<mxPoint x="2540" y="1436" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-301" value="&lt;div style=&quot;background-color: rgb(31, 31, 31); line-height: 19px;&quot;&gt;&lt;font face=&quot;Droid Sans Mono, monospace, monospace&quot; color=&quot;#dcdcaa&quot;&gt;&lt;span style=&quot;font-size: 14px; white-space: pre;&quot;&gt;GobotRPC_CI_rxData_cb&lt;/span&gt;&lt;/font&gt;&lt;br&gt;&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="2330" y="1000" width="190" height="40" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-302" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="weFQkCekfF49Ojb9-c9R-271" target="weFQkCekfF49Ojb9-c9R-301">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-304" value="Heart Beat" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="1201.69" y="1361" width="80" height="21" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-306" value="0xff" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="1279.6599999999999" y="1361" width="79.66" height="20" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-307" value="1" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="1279.66" y="1340" width="79.66" height="20" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-308" value="&lt;div style=&quot;background-color: rgb(31, 31, 31); line-height: 19px;&quot;&gt;&lt;font face=&quot;Droid Sans Mono, monospace, monospace&quot; color=&quot;#dcdcaa&quot;&gt;&lt;span style=&quot;font-size: 14px; white-space: pre;&quot;&gt;GobotRPC_CI_heartBeatTaskFn&lt;/span&gt;&lt;/font&gt;&lt;br&gt;&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="2330" y="950" width="280" height="40" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-309" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="weFQkCekfF49Ojb9-c9R-271" target="weFQkCekfF49Ojb9-c9R-308">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-311" value="Print Text" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="1199.49" y="1401" width="80" height="21" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-312" value="0xfe" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="1279.9999999999998" y="1401" width="79.66" height="20" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-313" value="Text" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="1359.3200000000002" y="1401" width="238.04" height="20" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-314" value="0-255" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="1358.3400000000001" y="1381" width="240" height="20" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-316" value="" style="endArrow=none;dashed=1;html=1;rounded=0;strokeWidth=3;" edge="1" parent="1" target="weFQkCekfF49Ojb9-c9R-315">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="1680" y="900" as="sourcePoint" />
<mxPoint x="1680" y="400" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-315" value="" style="sketch=0;html=1;aspect=fixed;strokeColor=none;shadow=0;align=center;fillColor=#2D9C5E;verticalAlign=top;labelPosition=center;verticalLabelPosition=bottom;shape=mxgraph.gcp2.check" vertex="1" parent="1">
<mxGeometry x="1660.28" y="514.28" width="40" height="32" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-317" value="" style="sketch=0;html=1;aspect=fixed;strokeColor=none;shadow=0;align=center;fillColor=#2D9C5E;verticalAlign=top;labelPosition=center;verticalLabelPosition=bottom;shape=mxgraph.gcp2.check" vertex="1" parent="1">
<mxGeometry x="1700.28" y="760" width="40" height="32" as="geometry" />
</mxCell> </mxCell>
</root> </root>
</mxGraphModel> </mxGraphModel>

View File

@@ -1,6 +1,6 @@
<mxfile host="Electron" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/25.0.1 Chrome/128.0.6613.186 Electron/32.2.6 Safari/537.36" version="25.0.1"> <mxfile host="Electron" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/25.0.1 Chrome/128.0.6613.186 Electron/32.2.6 Safari/537.36" version="25.0.1">
<diagram name="Page-1" id="VLDBnTalcAr4j7jpmEzg"> <diagram name="Page-1" id="VLDBnTalcAr4j7jpmEzg">
<mxGraphModel dx="775" dy="470" 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"> <mxGraphModel dx="1674" dy="870" 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> <root>
<mxCell id="0" /> <mxCell id="0" />
<mxCell id="1" parent="0" /> <mxCell id="1" parent="0" />
@@ -535,10 +535,10 @@
<mxCell id="weFQkCekfF49Ojb9-c9R-165" value="GoRPC Package" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"> <mxCell id="weFQkCekfF49Ojb9-c9R-165" value="GoRPC Package" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="1401.69" y="230" width="718.31" height="20" as="geometry" /> <mxGeometry x="1401.69" y="230" width="718.31" height="20" as="geometry" />
</mxCell> </mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-167" value="CRC" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"> <mxCell id="weFQkCekfF49Ojb9-c9R-167" value="16" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="1960.98" y="170" width="160" height="40" as="geometry" /> <mxGeometry x="1960.98" y="170" width="160" height="40" as="geometry" />
</mxCell> </mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-168" value="32" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"> <mxCell id="weFQkCekfF49Ojb9-c9R-168" value="16" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="1960.98" y="150" width="160" height="20" as="geometry" /> <mxGeometry x="1960.98" y="150" width="160" height="20" as="geometry" />
</mxCell> </mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-170" value="&lt;b&gt;&lt;font style=&quot;font-size: 16px;&quot;&gt;I2C Cable&lt;/font&gt;&lt;/b&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"> <mxCell id="weFQkCekfF49Ojb9-c9R-170" value="&lt;b&gt;&lt;font style=&quot;font-size: 16px;&quot;&gt;I2C Cable&lt;/font&gt;&lt;/b&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
@@ -627,7 +627,7 @@
<mxCell id="weFQkCekfF49Ojb9-c9R-198" value="UART Adapter&lt;div&gt;(Python)&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"> <mxCell id="weFQkCekfF49Ojb9-c9R-198" value="UART Adapter&lt;div&gt;(Python)&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="1519.26" y="400" width="120" height="40" as="geometry" /> <mxGeometry x="1519.26" y="400" width="120" height="40" as="geometry" />
</mxCell> </mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-200" value="" style="endArrow=none;dashed=1;html=1;rounded=0;strokeWidth=3;" edge="1" parent="1"> <mxCell id="weFQkCekfF49Ojb9-c9R-200" value="" style="endArrow=none;dashed=1;html=1;rounded=0;strokeWidth=3;" edge="1" parent="1" source="weFQkCekfF49Ojb9-c9R-315">
<mxGeometry width="50" height="50" relative="1" as="geometry"> <mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="1680" y="900" as="sourcePoint" /> <mxPoint x="1680" y="900" as="sourcePoint" />
<mxPoint x="1680" y="400" as="targetPoint" /> <mxPoint x="1680" y="400" as="targetPoint" />
@@ -822,6 +822,134 @@
<mxCell id="weFQkCekfF49Ojb9-c9R-262" value="1" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"> <mxCell id="weFQkCekfF49Ojb9-c9R-262" value="1" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="1279.66" y="1300" width="79.66" height="20" as="geometry" /> <mxGeometry x="1279.66" y="1300" width="79.66" height="20" as="geometry" />
</mxCell> </mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-267" value="&lt;span style=&quot;font-weight: 400;&quot;&gt;GobotRPC_CI&lt;/span&gt;" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="1910" y="1022" width="270" height="190" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-268" value="+&amp;nbsp;&lt;span style=&quot;text-align: center;&quot;&gt;GobotRPC_CI&lt;/span&gt;_Hardware: type" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-267">
<mxGeometry y="26" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-271" value="+ field: type" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-267">
<mxGeometry y="52" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-269" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-267">
<mxGeometry y="78" width="270" height="8" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-270" value="registerCB_TxPackage(cb,args)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-267">
<mxGeometry y="86" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-303" value="send_RXPackage(package)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-267">
<mxGeometry y="112" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-310" value="heartBeartTaskFn" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-267">
<mxGeometry y="138" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-286" value="onRxData" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-267">
<mxGeometry y="164" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-272" value="&lt;div&gt;&lt;span style=&quot;font-weight: 400;&quot;&gt;«interface»&lt;/span&gt;&lt;span style=&quot;font-weight: 400;&quot;&gt;&lt;br&gt;&lt;/span&gt;&lt;/div&gt;GobotRPC_CI_Hardware" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=40;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="2230" y="1239" width="270" height="92" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-285" value="registerRXCallback(cb, args)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-272">
<mxGeometry y="40" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-276" value="&lt;i&gt;abstract&amp;nbsp;send(data, length)&lt;/i&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-272">
<mxGeometry y="66" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-277" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;endArrow=diamondThin;endFill=1;" edge="1" parent="1" source="weFQkCekfF49Ojb9-c9R-268" target="weFQkCekfF49Ojb9-c9R-272">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-284" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=blockThin;endFill=1;" edge="1" parent="1" source="weFQkCekfF49Ojb9-c9R-279" target="weFQkCekfF49Ojb9-c9R-272">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-279" value="&lt;span style=&quot;font-weight: 400;&quot;&gt;GobotRPC_CI_Hardware_RP2040_UART&lt;/span&gt;" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="2220" y="1355" width="290" height="164" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-294" value="vTaskHandle rxTaskHandle" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-279">
<mxGeometry y="26" width="290" height="26" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-297" value="vSemphoreHandle rxDataSemphore" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-279">
<mxGeometry y="52" width="290" height="26" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-293" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-279">
<mxGeometry y="78" width="290" height="8" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-291" value="rxISR();" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-279">
<mxGeometry y="86" width="290" height="26" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-292" value="rxTask();" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-279">
<mxGeometry y="112" width="290" height="26" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-300" value="rxHandler();" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="weFQkCekfF49Ojb9-c9R-279">
<mxGeometry y="138" width="290" height="26" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-290" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;endArrow=diamondThin;endFill=1;" edge="1" parent="1" source="weFQkCekfF49Ojb9-c9R-289" target="weFQkCekfF49Ojb9-c9R-279">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-289" value="GobotRPC_CI_Hardware_RP2040_UART_ISR(args)" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="2560" y="1361" width="360" height="40" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-295" value="GobotRPC_CI_Hardware_RP2040_UART_RXTaskFn(args)" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="2563" y="1416.41" width="360" height="40" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-296" value="extern g_GobotRPC_CI_Hardware_RP2040_UART" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="2563" y="1467" width="360" height="40" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-298" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.999;entryY=1.095;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="weFQkCekfF49Ojb9-c9R-295" target="weFQkCekfF49Ojb9-c9R-297">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-299" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.988;entryY=0.418;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="weFQkCekfF49Ojb9-c9R-296" target="weFQkCekfF49Ojb9-c9R-293">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="2540" y="1487" />
<mxPoint x="2540" y="1436" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-301" value="&lt;div style=&quot;background-color: rgb(31, 31, 31); line-height: 19px;&quot;&gt;&lt;font face=&quot;Droid Sans Mono, monospace, monospace&quot; color=&quot;#dcdcaa&quot;&gt;&lt;span style=&quot;font-size: 14px; white-space: pre;&quot;&gt;GobotRPC_CI_rxData_cb&lt;/span&gt;&lt;/font&gt;&lt;br&gt;&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="2330" y="1000" width="190" height="40" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-302" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="weFQkCekfF49Ojb9-c9R-271" target="weFQkCekfF49Ojb9-c9R-301">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-304" value="Heart Beat" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="1201.69" y="1361" width="80" height="21" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-306" value="0xff" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="1279.6599999999999" y="1361" width="79.66" height="20" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-307" value="1" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="1279.66" y="1340" width="79.66" height="20" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-308" value="&lt;div style=&quot;background-color: rgb(31, 31, 31); line-height: 19px;&quot;&gt;&lt;font face=&quot;Droid Sans Mono, monospace, monospace&quot; color=&quot;#dcdcaa&quot;&gt;&lt;span style=&quot;font-size: 14px; white-space: pre;&quot;&gt;GobotRPC_CI_heartBeatTaskFn&lt;/span&gt;&lt;/font&gt;&lt;br&gt;&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="2330" y="950" width="280" height="40" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-309" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="weFQkCekfF49Ojb9-c9R-271" target="weFQkCekfF49Ojb9-c9R-308">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-311" value="Print Text" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="1199.49" y="1401" width="80" height="21" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-312" value="0xfe" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="1279.9999999999998" y="1401" width="79.66" height="20" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-313" value="Text" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="1359.3200000000002" y="1401" width="238.04" height="20" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-314" value="0-255" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="1358.3400000000001" y="1381" width="240" height="20" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-316" value="" style="endArrow=none;dashed=1;html=1;rounded=0;strokeWidth=3;" edge="1" parent="1" target="weFQkCekfF49Ojb9-c9R-315">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="1680" y="900" as="sourcePoint" />
<mxPoint x="1680" y="400" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-315" value="" style="sketch=0;html=1;aspect=fixed;strokeColor=none;shadow=0;align=center;fillColor=#2D9C5E;verticalAlign=top;labelPosition=center;verticalLabelPosition=bottom;shape=mxgraph.gcp2.check" vertex="1" parent="1">
<mxGeometry x="1660.28" y="514.28" width="40" height="32" as="geometry" />
</mxCell>
<mxCell id="weFQkCekfF49Ojb9-c9R-317" value="" style="sketch=0;html=1;aspect=fixed;strokeColor=none;shadow=0;align=center;fillColor=#2D9C5E;verticalAlign=top;labelPosition=center;verticalLabelPosition=bottom;shape=mxgraph.gcp2.check" vertex="1" parent="1">
<mxGeometry x="1700.28" y="760" width="40" height="32" as="geometry" />
</mxCell>
</root> </root>
</mxGraphModel> </mxGraphModel>
</diagram> </diagram>

View File

@@ -1,14 +1,8 @@
add_library(GobotRPC STATIC add_library(GobotRPC STATIC
${CMAKE_CURRENT_LIST_DIR}/../rx.cpp ${CMAKE_CURRENT_LIST_DIR}/../ctrl_interface/base.cpp
${CMAKE_CURRENT_LIST_DIR}/../init.cpp ${CMAKE_CURRENT_LIST_DIR}/../ctrl_interface/hardware_rp2040_uart.cpp
${CMAKE_CURRENT_LIST_DIR}/../protocol.cpp ${CMAKE_CURRENT_LIST_DIR}/../ctrl_interface/hardware_base.cpp
${CMAKE_CURRENT_LIST_DIR}/../error_msg.cpp ${CMAKE_CURRENT_LIST_DIR}/../crc16.cpp
${CMAKE_CURRENT_LIST_DIR}/../ctrl_interface/ctrl_interface_base.cpp
${CMAKE_CURRENT_LIST_DIR}/../ctrl_interface/ctrl_interface_registers.cpp
${CMAKE_CURRENT_LIST_DIR}/../ctrl_interface/ctrl_interface_rx.cpp
${CMAKE_CURRENT_LIST_DIR}/../ctrl_interface/ctrl_interface_tx.cpp
${CMAKE_CURRENT_LIST_DIR}/../ctrl_interface/ctrl_interface_hardware_rp2040.cpp
) )
target_include_directories(GobotRPC PUBLIC target_include_directories(GobotRPC PUBLIC

View File

@@ -0,0 +1,37 @@
#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);
}

View File

@@ -0,0 +1,59 @@
#include "ctrl_interface.hpp"
#include "pinConfig.hpp"
#include "FreeRTOSConfig.h"
#include "FreeRTOS.h"
#include "task.h"
GobotRPC_CI::GobotRPC_CI(I_GobotRPC_CI_Hardware *hardware) {
this->hardware = hardware;
this->hardware->registerCB_RxData(GobotRPC_CI_rxData_cb, this);
xTaskCreate(GobotRPC_CI_heartBeatTaskFn, "Heartbeat Task", 2048, this, 2, &this->heartBeatTaskHandle);
}
// 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) {
this->cb_TxPacket(this->cb_TxPacket_args, data+1, len-1);
}
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::send_RxPacket(char *data, size_t len) {
data[0] = RX_CI_PACKET;
this->hardware->send(data, len+1);
}
// Heartbeat Task
void GobotRPC_CI_heartBeatTaskFn(void *args) {
GobotRPC_CI *gobotRPC = (GobotRPC_CI *)args;
gobotRPC->heartBeartTaskFn();
}
void GobotRPC_CI::heartBeartTaskFn() {
char heartBeatPacket[] = {0xff};
while(1) {
this->hardware->send(heartBeatPacket, 1);
vTaskDelay(GOBOTRPC_HEARTBEAT_INTERVAL / portTICK_PERIOD_MS);
}
}

View File

@@ -1,40 +0,0 @@
#include "ctrl_interface.hpp"
#include <stdint.h>
#include <stdio.h>
#include <stdarg.h>
GobotRPC_CtrlInterface::GobotRPC_CtrlInterface(I_GobotRPC_CtrlInterface_HardwareHandler *ctrlInterface) {
this->handler = ctrlInterface;
handler->registerCallback(externalCallback_RX, this);
handler->registerHeartBeatCallback(externalCallback_HeartBeat, this);
packetCallback = nullptr;
performScanCallback = nullptr;
getInfoCallback = nullptr;
reqSlotUpdateCallback = nullptr;
packetCallbackArgs = nullptr;
performScanCallbackArgs = nullptr;
getInfoCallbackArgs = nullptr;
reqSlotUpdateCallbackArgs = nullptr;
}
void GobotRPC_CtrlInterface::printf(const char *fmt, ...) {
char buffer[256];
va_list args;
va_start(args, fmt);
vsnprintf(buffer, 256, fmt, args);
handler->send(buffer, strlen(buffer));
}
// Sending HeartBeat
void GobotRPC_CtrlInterface::onHeartBeat() {
char buffer = GOBOTRPC_CTRL_CMD_HEART_BEAT;
handler->send(&buffer, 1);
}
void externalCallback_HeartBeat(void * args) {
GobotRPC_CtrlInterface *ctrlInterface = (GobotRPC_CtrlInterface *)args;
ctrlInterface->onHeartBeat();
}

View File

@@ -1,113 +0,0 @@
#include "ctrl_interface.hpp"
#ifdef GOBOTRPC_PLATFORM_RP2040
#include "pico/stdlib.h"
#include "hardware/uart.h"
#include "hardware/irq.h"
#include "FreeRTOS.h"
#include "semphr.h"
#include "task.h"
#define STOP_BITS 1
#define PARITY UART_PARITY_ODD
GobotRPC_CtrlInterface_HardwareHandler_RP2040 * g_uart_hardware_handler;
GobotRPC_CtrlInterface_HardwareHandler_RP2040::GobotRPC_CtrlInterface_HardwareHandler_RP2040(
uart_inst_t * uart_instance, uint baudrate, uint heartBeatDelay,
uint tx_pin, uint rx_pin) {
callback_rx = nullptr;
callback_args = nullptr;
callback_heart_beat = nullptr;
callback_heart_beat_args = nullptr;
this->heartBeatDelay = heartBeatDelay;
this->rxSemphrHandle = xSemaphoreCreateCounting(16, 0);
g_uart_hardware_handler = this;
xTaskCreate(vTaskRxHandler, "gobotrpc_ctrl_interface_uart_rx", 1024, this, 3, &this->rxTaskHandle);
xTaskCreate(vTaskHeartBeat, "gobotrpc_ctrl_interface_heart_beat", 1024, this, 2, &this->heartBeatTaskHandle);
gpio_set_function(tx_pin, UART_FUNCSEL_NUM(uart_instance, tx_pin));
gpio_set_function(rx_pin, UART_FUNCSEL_NUM(uart_instance, rx_pin));
uart_init(uart_instance, baudrate);
this->uart_instance = uart_instance;
uart_set_format(uart_instance, 8, STOP_BITS, PARITY);
this->UART_IRQ = uart_instance == uart0 ? UART0_IRQ : UART1_IRQ;
irq_set_exclusive_handler(UART_IRQ, isrUartRX);
irq_set_enabled(UART_IRQ, true);
uart_set_irq_enables(uart_instance, true, false);
uart_set_fifo_enabled(uart_instance, true);
}
void GobotRPC_CtrlInterface_HardwareHandler_RP2040::send(char * data, size_t length) {
uart_write_blocking(uart_instance, (const uint8_t *)data, length);
uart_tx_wait_blocking(uart_instance);
}
void GobotRPC_CtrlInterface_HardwareHandler_RP2040::registerCallback(GobotRPC_CtrlInterface_Callback_RX callback, void * args) {
this->callback_rx = callback;
this->callback_args = args;
}
void GobotRPC_CtrlInterface_HardwareHandler_RP2040::rxTaskHandler() {
char inputBuffer[128];
size_t length = 0;
while (true) {
xSemaphoreTake(rxSemphrHandle, portMAX_DELAY);
for(length = 0; length<128 && uart_is_readable(uart_instance); length++) {
inputBuffer[length] = uart_getc(uart_instance);
}
if (length > 0 && this->callback_rx != nullptr) {
this->callback_rx(this->callback_args, inputBuffer, length);
}
}
}
void GobotRPC_CtrlInterface_HardwareHandler_RP2040::heartBeatTaskHandler() {
while (true) {
if (this->callback_heart_beat != nullptr) {
this->callback_heart_beat(this->callback_heart_beat_args);
}
vTaskDelay(this->heartBeatDelay / portTICK_PERIOD_MS);
}
}
void GobotRPC_CtrlInterface_HardwareHandler_RP2040::registerHeartBeatCallback(GobotRPC_CtrlInterface_Callback_HeartBeat callback, void * args) {
this->callback_heart_beat = callback;
this->callback_heart_beat_args = args;
}
void GobotRPC_CtrlInterface_HardwareHandler_RP2040::scheduleRXHandler(BaseType_t * higher_priority_task_woken) {
irq_clear(this->UART_IRQ);
if (this->callback_rx != nullptr) {
xSemaphoreGiveFromISR(rxSemphrHandle, higher_priority_task_woken);
}
}
void vTaskRxHandler(void * pvParameters) {
g_uart_hardware_handler->rxTaskHandler();
}
void vTaskHeartBeat(void * pvParameters) {
g_uart_hardware_handler->heartBeatTaskHandler();
}
void isrUartRX() {
static BaseType_t higher_priority_task_woken = pdFALSE;
g_uart_hardware_handler->scheduleRXHandler(&higher_priority_task_woken);
portYIELD_FROM_ISR(higher_priority_task_woken);
}
#endif

View File

@@ -1,22 +0,0 @@
#include "ctrl_interface.hpp"
#include <string.h>
void GobotRPC_CtrlInterface::registerCallback_Packet(GobotRPC_CtrlInterface_Callback_Packet callback, void *args) {
packetCallback = callback;
packetCallbackArgs = args;
}
void GobotRPC_CtrlInterface::registerCallback_PerformScan(GobotRPC_CtrlInterface_Callback_PerformScan callback, void *args) {
performScanCallback = callback;
performScanCallbackArgs = args;
}
void GobotRPC_CtrlInterface::registerCallback_ReqSlotUpdate(GobotRPC_CtrlInterface_Callback_ReqSlotUpdate callback, void *args) {
reqSlotUpdateCallback = callback;
reqSlotUpdateCallbackArgs = args;
}
void GobotRPC_CtrlInterface::registerCallback_GetInfo(GobotRPC_CtrlInterface_Callback_GetInfo callback, void *args) {
getInfoCallback = callback;
getInfoCallbackArgs = args;
}

View File

@@ -1,73 +0,0 @@
#include "ctrl_interface.hpp"
#include "gobotrpc.hpp"
#include <string.h>
void externalCallback_RX(void * args, char * data, size_t length) {
GobotRPC_CtrlInterface *interface = (GobotRPC_CtrlInterface *)args;
interface->onRX(data, length);
}
void GobotRPC_CtrlInterface::onRX(char * data, size_t length) {
uint8_t cmd = data[0];
switch (cmd) {
case GOBOTRPC_CTRL_CMD_PACKET:
onRX_Packet(data, length);
break;
case GOBOTRPC_CTRL_CMD_PERFORM_SCAN:
onRX_PerformScan(data, length);
break;
case GOBOTRPC_CTRL_CMD_REQ_SLOT_UPDATE:
onRX_ReqSlotUpdate(data, length);
break;
case GOBOTRPC_CTRL_CMD_INFO:
onRX_GetInfo(data, length);
break;
default:
break;
}
}
void GobotRPC_CtrlInterface::onRX_Packet(char *data, size_t length) {
if(length < 7)
return;
if (packetCallback != nullptr) {
RPCPackage package;
package.length = data[1];
package.type = RPCType(data[2] & 0b11);
package.rpcNum = RPCNumber(data[2] >> 4);
memcpy(&package.addr, &data[3], 4);
memcpy(package.buffer, &data[7], package.length);
packetCallback(packetCallbackArgs, package);
}
}
void GobotRPC_CtrlInterface::onRX_PerformScan(char *data, size_t length) {
if(length < 2)
return;
if (performScanCallback != nullptr)
performScanCallback(performScanCallbackArgs, data[1] == 1);
}
void GobotRPC_CtrlInterface::onRX_ReqSlotUpdate(char *data, size_t length) {
if (length < 2)
return;
if (reqSlotUpdateCallback != nullptr)
reqSlotUpdateCallback(reqSlotUpdateCallbackArgs, data[1] == 1);
}
void GobotRPC_CtrlInterface::onRX_GetInfo(char *data, size_t length) {
if (length < 1)
return;
if (getInfoCallback != nullptr)
getInfoCallback(getInfoCallbackArgs);
}

View File

@@ -1,49 +0,0 @@
#include "ctrl_interface.hpp"
#include <string.h>
// This function should be called when a package is sent
void GobotRPC_CtrlInterface::pushPacket(RPCPackage package) {
char buffer[MAX_PAGE_SIZES + 7];
buffer[0] = GOBOTRPC_CTRL_CMD_PACKET;
buffer[1] = package.length - 7;
buffer[2] = package.type | (package.rpcNum << 4);
memcpy(&buffer[3], &package.addr, 4);
memcpy(&buffer[7], package.buffer, package.length);
handler->send(buffer, package.length + 2);
}
void GobotRPC_CtrlInterface::pushScanResulst(uint32_t addr, bool running) {
char buffer[7];
buffer[0] = GOBOTRPC_CTRL_CMD_SCAN_RESULT;
buffer[1] = running ? 1 : 0;
memcpy(&buffer[2], &addr, 4);
buffer[6] = 0; // This is where the type would go
handler->send(buffer, 7);
}
void GobotRPC_CtrlInterface::pushPackageSlotUpdate(bool complete, bool inUse, uint32_t slot, uint32_t addr, uint32_t timestamp, uint32_t bits) {
char buffer[16];
buffer[0] = GOBOTRPC_CTRL_CMD_SLOT_UPDATE;
buffer[1] = complete ? 1 : 0;
buffer[2] = inUse ? 1 : 0;
buffer[3] = slot;
memcpy(&buffer[4], &addr, 4);
memcpy(&buffer[8], &timestamp, 4);
memcpy(&buffer[12], &bits, 4);
handler->send(buffer, 14);
}
void GobotRPC_CtrlInterface::pushInfo(uint8_t slotNumbers) {
char buffer[2];
buffer[0] = GOBOTRPC_CTRL_CMD_INFO;
buffer[1] = slotNumbers;
handler->send(buffer, 2);
}

View File

@@ -0,0 +1,2 @@
#include "ctrl_interface_hardware.hpp"

View File

@@ -0,0 +1,107 @@
#include "ctrl_interface_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) {
g_GobotRPC_CI_Hardware_RP2040_UART = this;
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;
xQueueSend(emptyInputBuffersQueue, &p, portMAX_DELAY);
}
txMutex = 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);
xTaskCreate(GobotRPC_CI_Hardware_RP2040_UART_RXTaskFn, "UART RX Task", 2048, this, 4, &this->rxTaskHandle);
}
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(txMutex, portMAX_DELAY);
uart_write_blocking(this->uart, (uint8_t *)(data), len);
xSemaphoreGive(txMutex);
}
// Rx ISR
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->rxISR();
};
void GobotRPC_CI_Hardware_RP2040_UART::rxISR() {
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
inputBuffers_t * inputBuffer;
xQueueReceiveFromISR(emptyInputBuffersQueue, &inputBuffer, &xHigherPriorityTaskWoken);
int i;
for(i = 0; uart_is_readable(this->uart) && i < 256; i++) {
volatile uint8_t c = uart_getc(this->uart);
inputBuffer->data[i] = c;
}
inputBuffer->len = i;
xQueueSendFromISR(filledInputBuffersQueue, &inputBuffer, &xHigherPriorityTaskWoken);
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
}
// Rx Task
void GobotRPC_CI_Hardware_RP2040_UART_RXTaskFn(void *args) {
GobotRPC_CI_Hardware_RP2040_UART *uart = (GobotRPC_CI_Hardware_RP2040_UART *)args;
uart->rxTask();
};
void GobotRPC_CI_Hardware_RP2040_UART::rxTask() {
inputBuffers_t * inputBuffer;
while (1) {
xQueueReceive(filledInputBuffersQueue, &inputBuffer, portMAX_DELAY);
if(inputBuffer->len > 0) {
cb_rxData(cb_rxData_args, inputBuffer->data, inputBuffer->len);
}
xQueueSend(emptyInputBuffersQueue, &inputBuffer, portMAX_DELAY);
}
}

View File

@@ -1,43 +0,0 @@
#include "gobotrpc.hpp"
#include <stdio.h>
const char * TEST_MSG_RPC_RESULT_GOOD = "Good";
const char * TEST_MSG_RPC_RESULT_PACKAGE_READY = "Package Ready";
const char * TEST_MSG_RPC_RESULT_ERROR_INVALID_FRAMESUBMITIONRESULT = "Invalid FrameSubmitionResult";
const char * TEST_MSG_RPC_RESULT_ERROR_INVALID_RPC_TYPE = "Invalid RPC Type (0b10)";
const char * TEST_MSG_RPC_RESULT_ERROR_INVALID_RPC_NUMBER = "Invalid RPC Number";
const char * TEST_MSG_RPC_RESULT_ERROR_NO_EMPTY_OR_FITTING_SLOT = "No empty or fitting slot for submitted frame";
char * mapFrameSubmitionResult2String(FrameSubmitionResult res) {
switch (res) {
case PENDING: return (char *)(TEST_MSG_RPC_RESULT_GOOD);
case COMPLEATE: return (char *) TEST_MSG_RPC_RESULT_PACKAGE_READY;
case ERROR_INVALID_RPC_TYPE: return (char *) TEST_MSG_RPC_RESULT_ERROR_INVALID_RPC_TYPE;
case ERROR_INVALID_RPC_NUMBER: return (char *) TEST_MSG_RPC_RESULT_ERROR_INVALID_RPC_NUMBER;
case ERROR_NO_EMPTY_OR_FITTING_SLOT: return (char *) TEST_MSG_RPC_RESULT_ERROR_INVALID_FRAMESUBMITIONRESULT;
}
return (char *) TEST_MSG_RPC_RESULT_ERROR_INVALID_FRAMESUBMITIONRESULT;
}
void GobotRPCParser::print_out_slots() {
for(int i = 0; i < NUM_SLOTS; i++) {
printf("[%d] %d%d (%x-%d) %d T%08x S=%02d ", i,
buffer[i].is_complete, buffer[i].is_in_use, buffer[i].sender_address,
buffer[i].rpcNum, buffer[i].type, buffer[i].timestamp, buffer[i].length
);
for(int j = 0; j < MAX_PAGE_SIZES; j++) {
printf("%02x", buffer[i].buffer[j]);
}
printf(" ");
for(int j = 0; j < 32; j++) {
printf("%d", (buffer[i].used_bit_masked >> (31-j)) & 1);
}
printf("\n");
}
}

View File

@@ -0,0 +1,2 @@
#pragma once
unsigned short crc16(char *data_p, unsigned short length);

View File

@@ -1,63 +1,34 @@
#pragma once #pragma once
#include <stdint.h>
#include "gobotrpc_datatypes.hpp"
#include "ctrl_interface_hardware.hpp" #include "ctrl_interface_hardware.hpp"
#include <strings.h>
struct HubInfo { enum GobotRPC_CI_CMD {
uint8_t slotNumbers; TX_CI_PACKET = 0x01,
RX_CI_PACKET = 0x02,
PERFORM_SCAN_CI_PACKET = 0x03,
SCAN_RESULT_CI_PACKET = 0x04,
}; };
typedef void (*GobotRPC_CtrlInterface_Callback_Packet)(void * args, RPCPackage package); typedef void (*callback_TxPacket)(void * args, char *data, size_t len);
typedef void (*GobotRPC_CtrlInterface_Callback_PerformScan)(void * args, bool enable); void GobotRPC_CI_rxData_cb(void * args, char *data, size_t len);
typedef void (*GobotRPC_CtrlInterface_Callback_ReqSlotUpdate)(void * args, bool enable); void GobotRPC_CI_heartBeatTaskFn(void *args);
typedef HubInfo (*GobotRPC_CtrlInterface_Callback_GetInfo)(void * args);
void externalCallback_RX(void * args, char * data, size_t length); class GobotRPC_CI {
void externalCallback_HeartBeat(void * args);
class GobotRPC_CtrlInterface {
private: private:
GobotRPC_CtrlInterface_Callback_Packet packetCallback; I_GobotRPC_CI_Hardware *hardware;
GobotRPC_CtrlInterface_Callback_PerformScan performScanCallback;
GobotRPC_CtrlInterface_Callback_ReqSlotUpdate reqSlotUpdateCallback;
GobotRPC_CtrlInterface_Callback_GetInfo getInfoCallback;
void * packetCallbackArgs;
void * performScanCallbackArgs;
void * reqSlotUpdateCallbackArgs;
void * getInfoCallbackArgs;
I_GobotRPC_CtrlInterface_HardwareHandler * handler; callback_TxPacket cb_TxPacket;
protected: void * cb_TxPacket_args;
void onRX_Packet(char * data, size_t length);
void onRX_PerformScan(char * data, size_t length); TaskHandle_t heartBeatTaskHandle;
void onRX_ReqSlotUpdate(char * data, size_t length);
void onRX_GetInfo(char * data, size_t length);
public: public:
GobotRPC_CtrlInterface(I_GobotRPC_CtrlInterface_HardwareHandler * handler); GobotRPC_CI(I_GobotRPC_CI_Hardware *hardware);
void printf(const char *fmt, ...);
void onRX(char * data, size_t length); void registerCB_TxPacket(callback_TxPacket cb, void *args);
void onHeartBeat(); void send_RxPacket(char *data, size_t len);
void pushPacket(RPCPackage package); void onRxData(char *data, size_t len);
void pushScanResulst(uint32_t addr, bool running);
void pushPackageSlotUpdate(bool complete, bool inUse, uint32_t slot, uint32_t addr, uint32_t timestamp, uint32_t bits);
void pushInfo(uint8_t slotNumbers);
void registerCallback_Packet(GobotRPC_CtrlInterface_Callback_Packet callback, void * args); void heartBeartTaskFn();
void registerCallback_PerformScan(GobotRPC_CtrlInterface_Callback_PerformScan callback, void * args);
void registerCallback_ReqSlotUpdate(GobotRPC_CtrlInterface_Callback_ReqSlotUpdate callback, void * args);
void registerCallback_GetInfo(GobotRPC_CtrlInterface_Callback_GetInfo callback, void * args);
};
enum UART_CTRL_Command_ID {
GOBOTRPC_CTRL_CMD_PACKET = 0x81, // Host <-> Hub
GOBOTRPC_CTRL_CMD_PERFORM_SCAN = 0x82, // Host -> Hub
GOBOTRPC_CTRL_CMD_SCAN_RESULT = 0x83, // Hub -> Host
GOBOTRPC_CTRL_CMD_SLOT_UPDATE = 0x84, // Hub -> Host
GOBOTRPC_CTRL_CMD_REQ_SLOT_UPDATE = 0x85, // Host -> Hub
GOBOTRPC_CTRL_CMD_HEART_BEAT = 0xfe, // Host <- Hub
GOBOTRPC_CTRL_CMD_INFO = 0xff, // Host -> Hub, Hub -> Host
}; };

View File

@@ -1,58 +1,56 @@
#pragma once #pragma once
#include <string.h> #include <strings.h>
typedef void (*GobotRPC_CtrlInterface_Callback_RX)(void * args, char * data, size_t length); #include "FreeRTOSConfig.h"
typedef void (*GobotRPC_CtrlInterface_Callback_HeartBeat)(void * args);
class I_GobotRPC_CtrlInterface_HardwareHandler {
public:
virtual void send(char * data, size_t length) = 0;
virtual void registerCallback(GobotRPC_CtrlInterface_Callback_RX, void * args) = 0;
virtual void registerHeartBeatCallback(GobotRPC_CtrlInterface_Callback_HeartBeat, void * args) = 0;
};
#define GOBOTRPC_PLATFORM_RP2040
#ifdef GOBOTRPC_PLATFORM_RP2040
#include "FreeRTOS.h" #include "FreeRTOS.h"
#include "task.h" #include "task.h"
#include "semphr.h" #include "semphr.h"
#include "hardware/uart.h" #include "queue.h"
class GobotRPC_CtrlInterface_HardwareHandler_RP2040 : public I_GobotRPC_CtrlInterface_HardwareHandler { typedef void (*callback_rxData)(void * args, char *data, size_t len);
private:
uart_inst_t * uart_instance;
int UART_IRQ;
GobotRPC_CtrlInterface_Callback_RX callback_rx;
void * callback_args;
GobotRPC_CtrlInterface_Callback_HeartBeat callback_heart_beat;
void * callback_heart_beat_args;
xSemaphoreHandle rxSemphrHandle;
TaskHandle_t rxTaskHandle;
TaskHandle_t heartBeatTaskHandle;
uint heartBeatDelay;
class I_GobotRPC_CI_Hardware {
public: public:
GobotRPC_CtrlInterface_HardwareHandler_RP2040(uart_inst_t * uart_instance, uint baudrate, uint heartBeatDelay, uint tx_pin, uint rx_pin); virtual void send(char *data, size_t len) = 0;
void send(char * data, size_t length) override; virtual void registerCB_RxData(callback_rxData cb, void *args) = 0;
void registerCallback(GobotRPC_CtrlInterface_Callback_RX, void * args) override;
void registerHeartBeatCallback(GobotRPC_CtrlInterface_Callback_HeartBeat, void * args);
void rxTaskHandler();
void heartBeatTaskHandler();
void scheduleRXHandler(BaseType_t * higher_priority_task_woken);
}; };
extern GobotRPC_CtrlInterface_HardwareHandler_RP2040 * g_uart_hardware_handler;
void isrUartRX(); #include "hardware/uart.h"
void vTaskRxHandler(void * pvParameters); void GobotRPC_CI_Hardware_RP2040_UART_isr();
void vTaskHeartBeat(void * pvParameters); void GobotRPC_CI_Hardware_RP2040_UART_RXTaskFn(void *args);
#define NUM_INPUT_BUFFERS 16
struct inputBuffers_t {
char data[256];
size_t len;
};
class GobotRPC_CI_Hardware_RP2040_UART : public I_GobotRPC_CI_Hardware {
private:
uart_inst_t *uart;
inputBuffers_t inputBufferPool[NUM_INPUT_BUFFERS];
TaskHandle_t rxTaskHandle;
SemaphoreHandle_t txMutex;
QueueHandle_t emptyInputBuffersQueue;
QueueHandle_t filledInputBuffersQueue;
callback_rxData cb_rxData;
void * cb_rxData_args;
public:
GobotRPC_CI_Hardware_RP2040_UART(uart_inst_t *uart, uint baudrate);
void send(char *data, size_t len) override;
void registerCB_RxData(callback_rxData cb, void *args);
void rxISR();
void rxTask();
};
extern GobotRPC_CI_Hardware_RP2040_UART * g_GobotRPC_CI_Hardware_RP2040_UART;
#endif

View File

@@ -1,36 +0,0 @@
#pragma once
#include <stdint.h>
#include <strings.h>
#include "gobotrpc_datatypes.hpp"
#include "ctrl_interface.hpp"
#include "ctrl_interface_hardware.hpp"
class GobotRPC_CtrlInterface;
class GobotRPCParser {
private:
RPC_RX_PackageSlot buffer[NUM_SLOTS];
uint32_t masked [NUM_SLOTS];
uint32_t address_mask;
size_t finishedScanIndex;
GobotRPC_CtrlInterface * ctrlInterface;
void find_fitting_slot(RPCHeader header, uint32_t addr, int * fitting_slot, int * empty_slot);
static void insertFrameInPackageSlot(RPC_RX_PackageSlot * package, char * data, size_t segment, size_t length);
void freePackageSlot(size_t index);
public:
GobotRPCParser(GobotRPC_CtrlInterface * ctrlInterface);
void print_out_slots();
enum FrameSubmitionResult submit_frame(char * data, size_t length, uint32_t addr, uint32_t timestamp);
int getFinishedIndexPackages();
void retrivePackage(RPCPackage * dest, int index);
};
char * mapFrameSubmitionResult2String(FrameSubmitionResult res);
FrameSubmitionResult getPackageStatus(RPC_RX_PackageSlot * package);

View File

@@ -1,35 +0,0 @@
#pragma once
#include "protocol.hpp"
#define MAX_PAGE_SIZES 4*7
#define NUM_SLOTS 8
enum FrameSubmitionResult {
PENDING,
COMPLEATE,
ERROR_INVALID_RPC_TYPE,
ERROR_INVALID_RPC_NUMBER,
ERROR_NO_EMPTY_OR_FITTING_SLOT,
};
struct RPC_RX_PackageSlot {
char buffer[MAX_PAGE_SIZES];
bool is_complete;
bool is_in_use;
uint32_t sender_address;
enum RPCNumber rpcNum;
enum RPCType type;
uint32_t used_bit_masked;
uint32_t timestamp;
size_t length;
};
struct RPCPackage {
char buffer[MAX_PAGE_SIZES];
size_t length;
uint32_t addr;
RPCNumber rpcNum;
RPCType type;
};

View File

@@ -0,0 +1,6 @@
#pragma once
#define GOBOTRPC_CI_UART_RX 0
#define GOBOTRPC_CI_UART_TX 1
#define GOBOTRPC_HEARTBEAT_INTERVAL 3000

View File

@@ -1,32 +0,0 @@
#pragma once
#include <map>
#include <stdint.h>
enum RPCNumber {
Get_Info = 0x0,
Home = 0x01,
Move_Step = 0x2,
Move_XY = 0x3,
Set_Padding = 0x4,
Release_Motors = 0x5,
Drop_Stone = 0x6,
Get_Stone_Status = 0x7,
Move_Z_Axis = 0x8,
Set_Vacum = 0x9,
Invalid = 0xf
};
const uint32_t RPC_NUMBER_MAX = 0x9;
enum RPCType {
REQUEST = 0b00,
RESPONSE_RPC = 0b01,
INVALID = 0b10,
ERROR = 0b11
};
struct RPCHeader {
RPCNumber rpcNum : 4;
RPCType type : 2;
unsigned char segment: 2;
};

View File

@@ -1,22 +0,0 @@
#include "gobotrpc.hpp"
#include <string.h>
GobotRPCParser::GobotRPCParser(GobotRPC_CtrlInterface * ctrlInterface) {
this->ctrlInterface = ctrlInterface;
for(int i = 0; i < NUM_SLOTS; i++) {
buffer[i].timestamp = 0;
buffer[i].is_complete = false;
buffer[i].is_in_use = false;
buffer[i].used_bit_masked = 0;
buffer[i].sender_address = 0;
buffer[i].rpcNum = Invalid;
buffer[i].type = INVALID;
buffer[i].length = 0;
memset(buffer[i].buffer, 0, MAX_PAGE_SIZES);
}
finishedScanIndex = 0;
address_mask = 0xFFFFFFFF;
}

View File

@@ -1,64 +0,0 @@
#include "protocol.hpp"
#include "gobotrpc.hpp"
#include <stdint.h>
uint32_t getRpcRequestCompleteMask(RPCNumber rpcNum) {
switch (rpcNum) {
case Get_Info: return 0b00000000000000000000000000000000;
case Home: return 0b00000000000000000000000000000011;
case Move_Step: return 0b00000000000000000000000000111111;
case Move_XY: return 0b00000000000000000000000000111111;
case Set_Padding: return 0b00000000000000001101111110111111;
case Release_Motors: return 0b00000000000000000000000001111111;
case Drop_Stone: return 0b00000000000000000000000000000000;
case Get_Stone_Status: return 0b00000000000000000000000000000000;
case Move_Z_Axis: return 0b00000000000000000000000000000001;
case Set_Vacum: return 0b00000000000000000000000000000001;
default: return 0b00000000000000000000000000000000;
}
}
uint32_t getRpcResponseCompleteMask(RPCNumber rpcNum) {
switch (rpcNum) {
case Get_Info: return 0b00001111111111111111111111111111;
case Home: return 0b00000000000000000000000000111111;
case Move_Step: return 0b00000000000000000000000000000000;
case Move_XY: return 0b00000000000000000000000000000000;
case Set_Padding: return 0b00000000000000000000000000000000;
case Release_Motors: return 0b00000000000000000000000000000000;
case Drop_Stone: return 0b00000000000000000000000000000000;
case Get_Stone_Status: return 0b00000000000000000000000000000000;
case Move_Z_Axis: return 0b00000000000000000000000000000000;
case Set_Vacum: return 0b00000000000000000000000000000000;
default: return 0b00000000000000000000000000000000;
}
}
uint32_t ERROR_MASK = 0b00000000000000000000000000000000;
FrameSubmitionResult getPackageStatus(RPC_RX_PackageSlot * package) {
uint32_t mask;
switch (package->type) {
case REQUEST:
mask = getRpcRequestCompleteMask(package->rpcNum);
break;
case RESPONSE_RPC:
mask = getRpcResponseCompleteMask(package->rpcNum);
break;
case ERROR:
mask = ERROR_MASK;
break;
default:
return ERROR_INVALID_RPC_TYPE;
};
uint32_t masked_bits = package->used_bit_masked & mask;
if(masked_bits == mask) {
return COMPLEATE;
}
return PENDING;
}

View File

@@ -1,134 +0,0 @@
#include "gobotrpc.hpp"
#include "protocol.hpp"
#include <string.h>
RPCHeader parseRPCHeader(char data)
{
RPCHeader header;
header.rpcNum = (RPCNumber)(data & 0b00001111);
header.type = (RPCType)((data & 0b00110000) >> 4);
header.segment = (data & 0b11000000) >> 6;
return header;
}
FrameSubmitionResult GobotRPCParser::submit_frame(char *data, size_t length, uint32_t addr, uint32_t timestamp)
{
RPCHeader header = parseRPCHeader(data[0]);
if (header.type == INVALID) {
return ERROR_INVALID_RPC_TYPE;
}
if (header.rpcNum > RPC_NUMBER_MAX) {
return ERROR_INVALID_RPC_NUMBER;
}
int fitting_slot;
int empty_slot;
find_fitting_slot(header, addr, &fitting_slot, &empty_slot);
int slotNum;
// Check if packageSlot is complete
if (fitting_slot != -1) {
slotNum = fitting_slot;
}
else if (empty_slot != -1) {
slotNum = empty_slot;
this->buffer[slotNum].is_in_use = true;
this->buffer[slotNum].is_complete = false;
this->buffer[slotNum].sender_address = addr;
this->buffer[slotNum].rpcNum = header.rpcNum;
this->buffer[slotNum].type = header.type;
}
else {
return ERROR_NO_EMPTY_OR_FITTING_SLOT;
}
insertFrameInPackageSlot(&this->buffer[slotNum], data, header.segment, length);
this->buffer[slotNum].timestamp = timestamp;
this->buffer[slotNum].length = MAX(this->buffer[slotNum].length, header.segment*7 + (length - 1));
volatile FrameSubmitionResult res = getPackageStatus(&(this->buffer[slotNum]));
// Push the update to the control interface
ctrlInterface->pushPackageSlotUpdate(res == COMPLEATE, this->buffer[slotNum].is_in_use, slotNum, addr, timestamp, this->buffer[slotNum].used_bit_masked);
y if (res == COMPLEATE) {
this->buffer[slotNum].is_complete = true;
}
return res;
}
void GobotRPCParser::insertFrameInPackageSlot(RPC_RX_PackageSlot *packageSlot, char *data, size_t segment, size_t length)
{
size_t offset = segment * 7;
for (int i = 0; i < length - 1; i++) {
packageSlot->buffer[offset + i] = data[i + 1];
packageSlot->used_bit_masked |= 1 << (offset + i);
}
}
void GobotRPCParser::find_fitting_slot(RPCHeader header, uint32_t addr, int *fitting_slot, int *empty_slot)
{
uint32_t masked_addr = addr & this->address_mask;
*fitting_slot = -1;
*empty_slot = -1;
for (int i = 0; i < NUM_SLOTS; i++) {
if (this->buffer[i].is_complete) {
continue;
}
uint32_t masked_slot_addr = this->buffer[i].sender_address & this->address_mask;
if (masked_slot_addr == masked_addr && header.rpcNum == this->buffer[i].rpcNum) {
*fitting_slot = i;
return;
}
if (*empty_slot == -1 && !buffer[i].is_in_use) {
*empty_slot = i;
}
}
}
int GobotRPCParser::getFinishedIndexPackages() {
for (int i = 0; i < NUM_SLOTS; i++) {
size_t index = (i + this->finishedScanIndex) % NUM_SLOTS;
if (this->buffer[i].is_complete) {
this->finishedScanIndex = (index + 1) % NUM_SLOTS;
return index;
}
}
return -1;
}
void GobotRPCParser::retrivePackage(RPCPackage *dest, int index) {
memcpy(dest->buffer, buffer[index].buffer, MAX_PAGE_SIZES);
dest->addr = buffer[index].sender_address;
dest->rpcNum = buffer[index].rpcNum;
dest->type = buffer[index].type;
dest->length = buffer[index].length;
this->ctrlInterface->pushPacket(*dest);
freePackageSlot(index);
}
void GobotRPCParser::freePackageSlot(size_t index) {
this->buffer[index].timestamp = 0;
this->buffer[index].is_complete = false;
this->buffer[index].is_in_use = false;
this->buffer[index].used_bit_masked = 0;
this->buffer[index].sender_address = 0;
this->buffer[index].rpcNum = Invalid;
this->buffer[index].type = INVALID;
this->buffer[index].length = 0;
}

View File

@@ -1,65 +1,49 @@
#include <stdio.h> #include <stdio.h>
#include "pico/stdlib.h" #include "pico/stdlib.h"
#include "ctrl_interface.hpp"
#include "ctrl_interface_hardware.hpp"
#include "FreeRTOSConfig.h" #include "FreeRTOSConfig.h"
#include "FreeRTOS.h" #include "FreeRTOS.h"
#include "task.h" #include "task.h"
#include "crc16.hpp"
#define LED_PIN 25 #define LED_PIN 25
void vTaskMain(void * pvParameters) {
#include "gobotrpc/include/gobotrpc.hpp" while(1) {
#include "ctrl_interface_hardware.hpp" gpio_put(LED_PIN, 1);
vTaskDelay(pdMS_TO_TICKS(500));
void vTaskMain(void * args) { gpio_put(LED_PIN, 0);
GobotRPC_CtrlInterface_HardwareHandler_RP2040 uartHandler(uart0, 9600, 1500, 0, 1); vTaskDelay(pdMS_TO_TICKS(500));
GobotRPC_CtrlInterface ctrlInterface(&uartHandler);
GobotRPCParser rpcRXParser(&ctrlInterface);
ctrlInterface.printf("Hello World!\n");
char data0[] = "\x04\x01\x02\x03\x04\x05\x06";
char data1[] = "\x44\x11\x12\x13\x14\x15\x16";
char data3[] = "\x11\xaa\xbb\xcc\xdd\xee\xff";
char data2[] = "\x84\xaa\xbb";
rpcRXParser.submit_frame(data2, 3, 0x42, xTaskGetTickCount());
rpcRXParser.submit_frame(data3, 7, 0x43, xTaskGetTickCount());
rpcRXParser.submit_frame(data1, 7, 0x42, xTaskGetTickCount());
ctrlInterface.printf("This is Random Text\n");
vTaskDelay(10 / portTICK_PERIOD_MS);
rpcRXParser.submit_frame(data3, 7, 0x43, xTaskGetTickCount());
rpcRXParser.submit_frame(data0, 7, 0x42, xTaskGetTickCount());
size_t index = rpcRXParser.getFinishedIndexPackages();
RPCPackage package;
rpcRXParser.retrivePackage(&package, index);
while (true) {
gpio_put(LED_PIN, false);
vTaskDelay(500 / portTICK_PERIOD_MS);
gpio_put(LED_PIN, true);
vTaskDelay(500 / portTICK_PERIOD_MS);
} }
}
void onTxPacket(void * args, char *data, size_t len) {
GobotRPC_CI * gobotRPC_ci = (GobotRPC_CI *)args;
char buffer[] = {0x00, 0x74, 0x04, 0x00, 0x00};
unsigned short crc = crc16(buffer + 1, 2);
buffer[4] = crc & 0xff;
buffer[3] = (crc >> 8) & 0xff;
gobotRPC_ci->send_RxPacket(buffer, 4);
} }
int main() { int main() {
stdio_init_all();
printf("============================================\n");
printf(" Gobot RPC Hub \n");
printf("============================================\n");
gpio_init(LED_PIN); gpio_init(LED_PIN);
gpio_set_dir(LED_PIN, true); gpio_set_dir(LED_PIN, true);
GobotRPC_CI_Hardware_RP2040_UART gobotrpc_ci_hardware(uart0, 115200);
GobotRPC_CI gobotRPC_ci(&gobotrpc_ci_hardware);
gobotRPC_ci.registerCB_TxPacket(onTxPacket, &gobotRPC_ci);
TaskHandle_t taskHandle; TaskHandle_t taskHandle;
xTaskCreate(vTaskMain, "Main Task", 2048, NULL, 1, &taskHandle); xTaskCreate(vTaskMain, "Main Task", 2048, &gobotRPC_ci, 1, &taskHandle);
vTaskStartScheduler(); vTaskStartScheduler();
while(1) {} while(1) {}

Binary file not shown.

Binary file not shown.

Binary file not shown.

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/util.py (Stored with Git LFS)

Binary file not shown.

BIN
i2c-hub/uart-adapter/src/main.py (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

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

Binary file not shown.

Binary file not shown.