Fixed further issues
This commit is contained in:
@@ -73,7 +73,7 @@
|
||||
#define configSUPPORT_STATIC_ALLOCATION 0
|
||||
#define configSUPPORT_DYNAMIC_ALLOCATION 1
|
||||
#define configTOTAL_HEAP_SIZE (1024 * 128)
|
||||
#define configAPPLICATION_ALLOCATED_HEAP (1024 * 64)
|
||||
#define configAPPLICATION_ALLOCATED_HEAP (1024 * 84)
|
||||
|
||||
/* Hook function related definitions. */
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 0
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<mxfile host="Electron" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/26.0.4 Chrome/128.0.6613.186 Electron/32.2.5 Safari/537.36" version="26.0.4">
|
||||
<diagram name="Page-1" id="VLDBnTalcAr4j7jpmEzg">
|
||||
<mxGraphModel dx="869" dy="527" 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="819" dy="497" 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" />
|
||||
@@ -131,19 +131,13 @@
|
||||
<mxGeometry x="321.95" y="580" width="160" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="weFQkCekfF49Ojb9-c9R-5" value="Node Type" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="481.95" y="580" width="118.05" height="20" as="geometry" />
|
||||
<mxGeometry x="481.95" y="580" width="78.05" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="weFQkCekfF49Ojb9-c9R-6" value="4" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="321.95" y="560" width="160" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="weFQkCekfF49Ojb9-c9R-8" value="3" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="481.95" y="560" width="118.05" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="weFQkCekfF49Ojb9-c9R-9" value="Status" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="600" y="580" width="81.95" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="weFQkCekfF49Ojb9-c9R-10" value="2" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="600" y="560" width="81.95" height="20" as="geometry" />
|
||||
<mxCell id="weFQkCekfF49Ojb9-c9R-8" value="1" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="481.95" y="560" width="78.05" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="weFQkCekfF49Ojb9-c9R-12" value="Get Info" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="241.95" y="560" width="81" height="40" as="geometry" />
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<mxfile host="Electron" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/26.0.4 Chrome/128.0.6613.186 Electron/32.2.5 Safari/537.36" version="26.0.4">
|
||||
<diagram name="Page-1" id="VLDBnTalcAr4j7jpmEzg">
|
||||
<mxGraphModel dx="1304" dy="791" 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="869" dy="527" 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" />
|
||||
@@ -1083,7 +1083,7 @@
|
||||
<mxPoint x="1800" y="2410" />
|
||||
<mxPoint x="1800" y="2630" />
|
||||
<mxPoint x="1830" y="2630" />
|
||||
<mxPoint x="1830" y="2935" />
|
||||
<mxPoint x="1830" y="2825" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
@@ -1371,16 +1371,17 @@
|
||||
<mxCell id="weFQkCekfF49Ojb9-c9R-515" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.51;exitDx=0;exitDy=0;exitPerimeter=0;entryX=1;entryY=0;entryDx=0;entryDy=0;" parent="1" source="weFQkCekfF49Ojb9-c9R-501" target="weFQkCekfF49Ojb9-c9R-514" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<Array as="points">
|
||||
<mxPoint x="1279" y="2908" />
|
||||
<mxPoint x="1279" y="2848" />
|
||||
<mxPoint x="1279" y="2850" />
|
||||
<mxPoint x="1260" y="2850" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="weFQkCekfF49Ojb9-c9R-501" value="CI_Instructions Queue" style="sketch=0;aspect=fixed;pointerEvents=1;shadow=0;dashed=0;html=1;strokeColor=none;labelPosition=center;verticalLabelPosition=bottom;verticalAlign=top;align=center;fillColor=#000000;shape=mxgraph.azure.queue_generic;labelBackgroundColor=default;flipH=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="1335" y="2880" width="183.33" height="55" as="geometry" />
|
||||
<mxGeometry x="1335.01" y="2820" width="183.33" height="55" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="weFQkCekfF49Ojb9-c9R-505" value="CI_Instruction_Transport" style="swimlane;fontStyle=1;align=center;verticalAlign=middle;childLayout=stackLayout;horizontal=1;startSize=29;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;html=1;whiteSpace=wrap;labelBackgroundColor=default;" parent="1" vertex="1">
|
||||
<mxGeometry x="1347.8400000000001" y="2760" width="180" height="104" as="geometry" />
|
||||
<mxGeometry x="1342.6200000000001" y="2680" width="180" height="104" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="weFQkCekfF49Ojb9-c9R-506" value="data[16]" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;" parent="weFQkCekfF49Ojb9-c9R-505" vertex="1">
|
||||
<mxGeometry y="29" width="180" height="25" as="geometry" />
|
||||
@@ -1392,7 +1393,7 @@
|
||||
<mxGeometry y="79" width="180" height="25" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="weFQkCekfF49Ojb9-c9R-509" value="<div style="color: rgb(204, 204, 204); background-color: rgb(31, 31, 31); font-family: &quot;Droid Sans Mono&quot;, &quot;monospace&quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;"><span style="color: #9cdcfe;">pushCIInstruction</span></div>" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="1580" y="2890" width="210" height="60" as="geometry" />
|
||||
<mxGeometry x="1575.63" y="2780" width="184.37" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="weFQkCekfF49Ojb9-c9R-512" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="weFQkCekfF49Ojb9-c9R-509" target="weFQkCekfF49Ojb9-c9R-501" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
@@ -1404,13 +1405,13 @@
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="weFQkCekfF49Ojb9-c9R-514" value="\/" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="1245.0000000000002" y="2847.5" width="15" height="160" as="geometry" />
|
||||
<mxGeometry x="1245" y="2847.5" width="15" height="42.5" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="weFQkCekfF49Ojb9-c9R-518" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="weFQkCekfF49Ojb9-c9R-522" target="weFQkCekfF49Ojb9-c9R-517" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="weFQkCekfF49Ojb9-c9R-516" value="<div style="color: rgb(204, 204, 204); background-color: rgb(31, 31, 31); font-family: &quot;Droid Sans Mono&quot;, &quot;monospace&quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;"><div style="line-height: 19px;"><div style="line-height: 19px;"><div style="line-height: 19px;"><span style="color: #dcdcaa;">send_ErrorTransmission</span></div></div></div></div>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="1000" y="2907.5" width="220.61" height="40" as="geometry" />
|
||||
<mxGeometry x="1002.19" y="2847.5" width="220.61" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="weFQkCekfF49Ojb9-c9R-519" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="weFQkCekfF49Ojb9-c9R-517" target="weFQkCekfF49Ojb9-c9R-468" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
@@ -1611,6 +1612,9 @@
|
||||
<mxCell id="xHqxyqidxHPQPkM2u2fy-11" value="size" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="1282.21" y="1419.5" width="80.95" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="ZwaYYf2tyudIqjw2MeNF-4" value="i2C Package Rx Task" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;dashed=1;strokeWidth=2;movable=1;resizable=1;rotatable=1;deletable=1;editable=1;locked=0;connectable=1;labelPosition=center;verticalLabelPosition=top;align=center;verticalAlign=bottom;" vertex="1" parent="1">
|
||||
<mxGeometry x="1000" y="2810" width="270" height="100" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xHqxyqidxHPQPkM2u2fy-12" value="1" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="1282.6200000000003" y="1398.5" width="79.66" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
@@ -1629,6 +1633,12 @@
|
||||
<mxCell id="ZwaYYf2tyudIqjw2MeNF-2" value="Port" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="1523.16" y="1241" width="76.84" height="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="ZwaYYf2tyudIqjw2MeNF-5" value="i2C Package Rx Task" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;dashed=1;strokeWidth=2;movable=1;resizable=1;rotatable=1;deletable=1;editable=1;locked=0;connectable=1;labelPosition=center;verticalLabelPosition=top;align=center;verticalAlign=bottom;" vertex="1" parent="1">
|
||||
<mxGeometry x="1570.28" y="2917.5" width="270" height="100" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="ZwaYYf2tyudIqjw2MeNF-6" value="CI_Rev_Instructions Queue" style="sketch=0;aspect=fixed;pointerEvents=1;shadow=0;dashed=0;html=1;strokeColor=none;labelPosition=center;verticalLabelPosition=bottom;verticalAlign=top;align=center;fillColor=#000000;shape=mxgraph.azure.queue_generic;labelBackgroundColor=default;flipH=0;" vertex="1" parent="1">
|
||||
<mxGeometry x="1328.33" y="2940" width="183.33" height="55" as="geometry" />
|
||||
</mxCell>
|
||||
</root>
|
||||
</mxGraphModel>
|
||||
</diagram>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<mxfile host="Electron" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/26.0.4 Chrome/128.0.6613.186 Electron/32.2.5 Safari/537.36" version="26.0.4">
|
||||
<diagram name="Page-1" id="VLDBnTalcAr4j7jpmEzg">
|
||||
<mxGraphModel dx="819" dy="497" 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="4097" dy="2486" 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" />
|
||||
@@ -670,7 +670,7 @@
|
||||
<mxCell id="weFQkCekfF49Ojb9-c9R-209" value="Node<div>(Slave)</div>" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="1920" y="400" width="120" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="weFQkCekfF49Ojb9-c9R-210" value="00 I2C Hub<div>01 CoreXy</div><div>02 HeadSystem</div><div>03 Vacum</div>" style="text;html=1;align=left;verticalAlign=top;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
|
||||
<mxCell id="weFQkCekfF49Ojb9-c9R-210" value="00 I2C Hub<div>a3 CoreXy</div><div>a2 HeadSystem</div><div>a1 Vacum</div>" style="text;html=1;align=left;verticalAlign=top;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="880" y="580" width="120" height="70" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="weFQkCekfF49Ojb9-c9R-211" value="<b>Node Type Enum</b>" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
|
||||
@@ -894,13 +894,13 @@
|
||||
<mxCell id="weFQkCekfF49Ojb9-c9R-345" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="weFQkCekfF49Ojb9-c9R-338" target="weFQkCekfF49Ojb9-c9R-344" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="weFQkCekfF49Ojb9-c9R-338" value="Full Buffer Queue" style="sketch=0;aspect=fixed;pointerEvents=1;shadow=0;dashed=0;html=1;strokeColor=none;labelPosition=center;verticalLabelPosition=bottom;verticalAlign=top;align=center;fillColor=#00188D;shape=mxgraph.azure.queue_generic;flipH=1;" parent="1" vertex="1">
|
||||
<mxCell id="weFQkCekfF49Ojb9-c9R-338" value="Empty Buffer Queue" style="sketch=0;aspect=fixed;pointerEvents=1;shadow=0;dashed=0;html=1;strokeColor=none;labelPosition=center;verticalLabelPosition=bottom;verticalAlign=top;align=center;fillColor=#00188D;shape=mxgraph.azure.queue_generic;flipH=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="602.8399999999999" y="2230" width="183.33" height="55" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="weFQkCekfF49Ojb9-c9R-366" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.51;exitDx=0;exitDy=0;exitPerimeter=0;" parent="1" source="weFQkCekfF49Ojb9-c9R-339" target="weFQkCekfF49Ojb9-c9R-365" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="weFQkCekfF49Ojb9-c9R-339" value="Empty Buffer Queue" style="sketch=0;aspect=fixed;pointerEvents=1;shadow=0;dashed=0;html=1;strokeColor=none;labelPosition=center;verticalLabelPosition=bottom;verticalAlign=top;align=center;fillColor=#00188D;shape=mxgraph.azure.queue_generic" parent="1" vertex="1">
|
||||
<mxCell id="weFQkCekfF49Ojb9-c9R-339" value="Full Buffer Queue" style="sketch=0;aspect=fixed;pointerEvents=1;shadow=0;dashed=0;html=1;strokeColor=none;labelPosition=center;verticalLabelPosition=bottom;verticalAlign=top;align=center;fillColor=#00188D;shape=mxgraph.azure.queue_generic" parent="1" vertex="1">
|
||||
<mxGeometry x="610" y="2380" width="183.33" height="55" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="weFQkCekfF49Ojb9-c9R-341" value="" style="endArrow=none;dashed=1;html=1;rounded=0;" parent="1" edge="1">
|
||||
|
||||
@@ -11,8 +11,9 @@
|
||||
#include "task.h"
|
||||
|
||||
|
||||
GobotRPC_CI::GobotRPC_CI(I_GobotRPC_CI_Hardware *hardware, UBaseType_t core, QueueHandle_t ciInstructionQueue) {
|
||||
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);
|
||||
@@ -49,8 +50,8 @@ void GobotRPC_CI::onRxData(char *data, size_t len) {
|
||||
|
||||
case SET_ADDR_PORT_MAP: {
|
||||
if(this->cb_SetAddressMap != NULL) {
|
||||
uint32_t addr = (data[1] << 24) | (data[2] << 16) | (data[3] << 8) | data[4];
|
||||
uint8_t port = data[5];
|
||||
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;
|
||||
|
||||
@@ -74,4 +74,17 @@ void GobotRPC_CI::send_InfoReset() {
|
||||
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);
|
||||
}
|
||||
@@ -42,8 +42,9 @@ private:
|
||||
TaskHandle_t txCIInstructionTaskHandle;
|
||||
|
||||
QueueHandle_t ciInstructionQueue;
|
||||
QueueHandle_t ciInstructionReverseQueue;
|
||||
public:
|
||||
GobotRPC_CI(I_GobotRPC_CI_Hardware *hardware, UBaseType_t core, QueueHandle_t ciInstructionQueue);
|
||||
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);
|
||||
@@ -55,6 +56,7 @@ public:
|
||||
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);
|
||||
|
||||
@@ -45,7 +45,7 @@ private:
|
||||
inputBuffers_t inputBufferPool[NUM_INPUT_BUFFERS];
|
||||
|
||||
TaskHandle_t rxProcessingTaskHandle;
|
||||
|
||||
|
||||
SemaphoreHandle_t rxSignalSemaphore;
|
||||
QueueHandle_t emptyInputBuffersQueue;
|
||||
QueueHandle_t filledInputBuffersQueue;
|
||||
@@ -67,7 +67,6 @@ public:
|
||||
void onRx_ISR();
|
||||
void rxBufferingTaskFn();
|
||||
void rxProcessingTaskFn();
|
||||
|
||||
};
|
||||
|
||||
extern GobotRPC_CI_Hardware_RP2040_UART * g_GobotRPC_CI_Hardware_RP2040_UART;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
enum CI_Instruction_Type {
|
||||
CI_INSTRUCTION_SEND_TRANMISSION_ERROR,
|
||||
CI_INSTRUCTION_SEND_TRANMISSION_SUCCESS,
|
||||
CI_INSTRUCTION_SEND_INFO_RESET
|
||||
CI_INSTRUCTION_SEND_INFO_RESET,
|
||||
CI_INSTRUCTION_REV_SEND_SET_ADDR_MAP,
|
||||
};
|
||||
|
||||
struct CI_Instruction_Transport {
|
||||
|
||||
@@ -9,6 +9,7 @@ struct AppData {
|
||||
QueueHandle_t txQueue;
|
||||
QueueHandle_t rxQueue;
|
||||
QueueHandle_t ciInstructionQueue;
|
||||
QueueHandle_t ciInstructionReverseQueue;
|
||||
};
|
||||
|
||||
void main_core2(void * pvParameters);
|
||||
|
||||
@@ -55,8 +55,14 @@ private:
|
||||
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;
|
||||
@@ -67,7 +73,7 @@ private:
|
||||
bool readI2C(GoRPCPackage_Transport * pkg, uint32_t addr);
|
||||
|
||||
public:
|
||||
GobotRPC_TI_Hardware_RP2040_I2C(UBaseType_t core, i2c_inst_t *i2c);
|
||||
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);
|
||||
@@ -77,12 +83,15 @@ public:
|
||||
|
||||
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();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -31,4 +31,23 @@ void GobotRPC_TI_Hardware_RP2040_I2C::raiseInfoReset() {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,9 +7,10 @@
|
||||
|
||||
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) {
|
||||
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;
|
||||
|
||||
@@ -38,6 +39,16 @@ GobotRPC_TI_Hardware_RP2040_I2C::GobotRPC_TI_Hardware_RP2040_I2C(UBaseType_t cor
|
||||
|
||||
}
|
||||
|
||||
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();
|
||||
@@ -51,6 +62,8 @@ void GobotRPC_TI_Hardware_RP2040_I2C::initTasks() {
|
||||
|
||||
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) {
|
||||
|
||||
@@ -31,4 +31,19 @@ void GobotRPC_TI_Hardware_RP2040_I2C::intPinISR(BaseType_t * xHigherPriorityTask
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ void GobotRPC_TI_Hardware_RP2040_I2C::i2cRxTask() {
|
||||
xSemaphoreTake(i2cRXSemaphore, portMAX_DELAY);
|
||||
|
||||
uint32_t done_mask = 0xffffffff;
|
||||
|
||||
uint32_t pinStates = readIntPins();
|
||||
|
||||
do {
|
||||
@@ -18,6 +19,7 @@ void GobotRPC_TI_Hardware_RP2040_I2C::i2cRxTask() {
|
||||
if((pinStates & done_mask) & (1 << i)) {
|
||||
done_mask &= ~(1 << i);
|
||||
|
||||
|
||||
uint32_t addr = intAddressMap[i];
|
||||
|
||||
if(addr > 0xff)
|
||||
|
||||
@@ -53,25 +53,31 @@ void onRXFromI2CTask(void * pvParameters) {
|
||||
}
|
||||
}
|
||||
|
||||
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(5, sizeof(CI_Instruction_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);
|
||||
|
||||
|
||||
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, &gobotRPC_ci, 1, UART_CORE_MASK, &taskHandleCore1);
|
||||
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();
|
||||
|
||||
@@ -26,8 +26,9 @@ void pushCIInstruction(CI_Instruction_Transport * src, void *args) {
|
||||
}
|
||||
|
||||
void main_core2(void * pvParameters) {
|
||||
AppData appData = *((AppData *)pvParameters);
|
||||
GobotRPC_TI_Hardware_RP2040_I2C gobotrpc_ti_hardware(UART_CORE_MASK, i2c0);
|
||||
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);
|
||||
|
||||
Binary file not shown.
Binary file not shown.
BIN
i2c-hub/uart-adapter/src/main.py
LFS
BIN
i2c-hub/uart-adapter/src/main.py
LFS
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user