/* * can_task.cpp * * Created on: 10 Dec 2023 * Author: Carl */ #include #include #include #include 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 = 0x040; // 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() { //STA_DEBUG_HEAP_STATS(); canController.sendFrame(txHeader, payload); //STA_DEBUG_HEAP_STATS(); STA_DEBUG_PRINTLN("SENT FRAME"); HAL_Delay(1000); } } // namespace demo