Cut out isotp and added CAN ID for state transition

This commit is contained in:
CarlWachter
2024-04-30 15:24:28 +02:00
parent 5ecc5f9211
commit 104d2931be
3 changed files with 26 additions and 127 deletions

View File

@@ -5,11 +5,12 @@
#ifdef STA_CAN_BUS_ENABLE
#include <sta/tacos/thread.hpp>
#include <sta/rtos/queue.hpp>
#include <sta/rtos/system/can_bus.hpp>
#include <sta/debug/debug.hpp>
#include <sta/lang.hpp>
#include <sta/tacos/thread.hpp>
#include <sta/tacos/statemachine.hpp>
@@ -50,14 +51,6 @@ namespace sta
return _instance;
}
/**
* @brief Place data message in CAN driver TX queue.
*
* @param msg Message to transmit
* @param timeout Timeout for placing message (0 = no wait, osWaitForever = blocking)
* @return True if message was queued successfully
*/
bool queueCanBusMsg(const CanDataMsg & msg, uint32_t timeout);
/**
* @brief Place system message in CAN driver TX queue.
*
@@ -67,15 +60,6 @@ namespace sta
*/
bool queueCanBusMsg(const CanSysMsg & msg, uint32_t timeout);
/**
* @brief Retrieve data message from CAN driver TX queue.
*
* @param[out] msg Output address for retrieved message
* @param timeout Timeout for retrieving message (0 = no wait, osWaitForever = blocking)
* @return True if message was retrieved successfully
*/
bool getCanBusMsg(CanDataMsg * msg, uint32_t timeout);
/**
* @brief Retrieve system message from CAN driver TX queue.
*
@@ -113,12 +97,10 @@ namespace sta
sta::STM32CanController * canBusController_;
//CanDataMsg canBusDataQueueBuffer_[STA_RTOS_CAN_BUS_QUEUE_LENGTH];
CanSysMsg* canBusSysQueueBuffer_[STA_RTOS_CAN_BUS_QUEUE_LENGTH];
uint8_t bufferIndex;
RtosQueue<CanSysMsg> canBusSysQueue_;
RtosQueue<CanDataMsg> canBusDataQueue_;
uint32_t canBusStack[256];
@@ -127,10 +109,11 @@ namespace sta
static RtosEvent messageEvent;
};
void handleSysMessage(const sta::CanRxHeader & header, const uint8_t * payload);
void handleDataMessage(const sta::IsotpMessage & msg);
/**
* @brief Callback function for handling received messages. Intended for state transitions.
*/
STA_WEAK
void handleSysMessage(CanMsgHeader & header, uint8_t * payload);
} /* namespace tacos */