mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/CAN-Demo.git
synced 2025-08-06 14:07:35 +00:00
Initial WIP build
This commit is contained in:
35
App/Src/test.cpp
Normal file
35
App/Src/test.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* test.cpp
|
||||
*
|
||||
* Created on: Oct 24, 2023
|
||||
* Author: carlw
|
||||
*/
|
||||
|
||||
//#include <sta/bus/can/controller.hpp>
|
||||
#include <sta/devices/stm32/can.hpp>
|
||||
|
||||
//extern STM32CanController(CAN_HandleTypeDef * handle);
|
||||
|
||||
|
||||
extern "C" void testCan(CAN_HandleTypeDef * handle){
|
||||
|
||||
sta::STM32CanController canController(handle);
|
||||
|
||||
canController.start();
|
||||
|
||||
// Create a CanTxHeader for your message
|
||||
sta::CanTxHeader txHeader;
|
||||
txHeader.id.format = sta::CanIdFormat::EXT; // Set to EXT for extended ID
|
||||
txHeader.id.eid = 0xCAFE; // Set the standard ID or extended ID
|
||||
txHeader.payloadLength = 8; // Set the payload length (max 8 bytes)
|
||||
|
||||
// Create your message payload
|
||||
uint8_t payload[8] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
|
||||
|
||||
// Send the CAN message
|
||||
while (true){
|
||||
canController.sendFrame(txHeader, payload);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user