Working CAN communication with forwarding to tasks

This commit is contained in:
@CarlWachter
2024-03-08 19:04:28 +01:00
parent 7732fa2823
commit fd7c123a5e
10 changed files with 58 additions and 36 deletions

View File

@@ -27,7 +27,7 @@ namespace demo
void CanTask::func()
{
STA_DEBUG_PRINTLN("Can Task awaiting message");
//STA_DEBUG_PRINTLN("Can Task awaiting message");
if (CAN_queue_.available() > 0)
{
// Receiving message
@@ -35,9 +35,16 @@ namespace demo
CAN_queue_.get(&msg);
STA_DEBUG_PRINTLN("Can Task received message");
// Sending it back
// Sending it back with one changed bit
msg.payload[1] = 3;
msg.header.sid = getCanID();
msg.header.eid = 0;
msg.header.format = 0;
sta::tacos::queueCanBusMsg(msg, 0);
STA_DEBUG_PRINTLN("Can Task sent message");
HAL_Delay(500);
}
}
} // namespace demo