mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/CAN-Demo.git
synced 2025-12-17 04:08:03 +00:00
chore: Cleanup for Demo
This commit is contained in:
41
App/Src/tasks/can_spam.cpp
Normal file
41
App/Src/tasks/can_spam.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
Reference in New Issue
Block a user