Working CAN sending on TACOS via user space

This commit is contained in:
CarlWachter
2023-12-10 14:59:05 +01:00
parent 98ecffac48
commit af703eaea3
168 changed files with 45744 additions and 485 deletions

View File

@@ -0,0 +1,42 @@
/*
* can_task.cpp
*
* Created on: 10 Dec 2023
* Author: Carl
*/
#include <tasks/can_task.hpp>
#include <sta/debug/debug.hpp>
#include <cmsis_os2.h>
namespace demo
{
CanTask::CanTask(const char* name, CAN_HandleTypeDef * handle)
: TacosThread(name, osPriorityNormal), canController(handle)
{
}
void CanTask::init()
{
canController.start();
txHeader.id.format = sta::CanIdFormat::STD; // Set to EXT for extended ID
txHeader.id.sid = 0x30; // Set the standard ID or extended ID
txHeader.payloadLength = 8; // Set the payload length (max 8 bytes)
// Create your message payload
for (int i = 0; i < 8; ++i) {
payload[i] = i + 1;
}
}
void CanTask::func()
{
canController.sendFrame(txHeader, payload);
HAL_Delay(1000);
}
} // namespace demo