mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/CAN-Demo.git
synced 2025-06-10 02:55:59 +00:00
42 lines
644 B
C++
42 lines
644 B
C++
/*
|
|
* can_task.cpp
|
|
*
|
|
* Created on: 10 Dec 2023
|
|
* Author: Carl
|
|
*/
|
|
|
|
#include <sta/tacos.hpp>
|
|
#include <tasks/can_spam.hpp>
|
|
|
|
namespace demo
|
|
{
|
|
CanSpam::CanSpam(uint32_t canID)
|
|
: TacosThread("CAN Spam", osPriorityNormal)
|
|
{
|
|
setCanID(canID);
|
|
}
|
|
|
|
void CanSpam::init()
|
|
{
|
|
}
|
|
|
|
void CanSpam::func()
|
|
{
|
|
|
|
CanSysMsg msg;
|
|
|
|
// Send some random stuff
|
|
msg.payload[0] = 1;
|
|
msg.payload[1] = 2;
|
|
msg.payload[2] = 3;
|
|
msg.header.sid = getCanID();
|
|
msg.header.format = 0;
|
|
|
|
sta::tacos::queueCanBusMsg(msg, 0);
|
|
STA_DEBUG_PRINTLN("Can Task sent message");
|
|
|
|
this->periodicDelay(1); // Delay to ensure 1 Hz rate.
|
|
}
|
|
} // namespace demo
|
|
|