mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/rtos2-utils.git
synced 2025-08-06 11:07:34 +00:00
CAN w/o isotp
This commit is contained in:
@@ -29,8 +29,6 @@
|
||||
#include <sta/bus/can/controller.hpp>
|
||||
#include <sta/devices/stm32/can.hpp>
|
||||
#include <sta/rtos/c_api/can_msg.h>
|
||||
#include <sta/proto/isotp/transmitter.hpp>
|
||||
#include <sta/proto/isotp/receiver.hpp>
|
||||
#include <sta/time.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
@@ -78,10 +76,6 @@
|
||||
* @brief CAN system message in queue.
|
||||
*/
|
||||
#define STA_RTOS_CAN_FLAG_SYS_QUEUED 0x1U << 3
|
||||
/**
|
||||
* @brief Show ISOTP statistics.
|
||||
*/
|
||||
#define STA_RTOS_CAN_FLAG_SHOW_STATS 0x1U << 4
|
||||
|
||||
/**
|
||||
* @brief CAN SID bits used for system messages.
|
||||
@@ -126,14 +120,11 @@ namespace sta
|
||||
class AlpakaCanBus
|
||||
{
|
||||
public:
|
||||
using SysMsgHandler = void (*)(const CanRxHeader &, const uint8_t *);
|
||||
using DataMsgHandler = void (*)(const IsotpMessage &);
|
||||
|
||||
static const uint8_t FIFO_SYS = 0;
|
||||
static const uint8_t FIFO_DATA = 1;
|
||||
|
||||
public:
|
||||
AlpakaCanBus(CanController * controller, TimeMsFn timeMs, SysMsgHandler sysMsgHandler, DataMsgHandler dataMsgHandler);
|
||||
AlpakaCanBus(CanController * controller, TimeMsFn timeMs);
|
||||
|
||||
|
||||
/**
|
||||
@@ -143,51 +134,14 @@ namespace sta
|
||||
*/
|
||||
void send(const CanSysMsg & msg);
|
||||
|
||||
/**
|
||||
* @brief Send data message.
|
||||
*
|
||||
* @param msg Message
|
||||
*/
|
||||
void send(const CanDataMsg & msg);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Process transmissions.
|
||||
*
|
||||
* Call regularly to advance transmission.
|
||||
*/
|
||||
void processTx();
|
||||
|
||||
/**
|
||||
* @brief Process received CAN messages.
|
||||
*/
|
||||
void processRx();
|
||||
|
||||
/**
|
||||
* @brief Display ISOTP TX/RX statistics.
|
||||
*/
|
||||
void showStatistics();
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Configure CAN filters.
|
||||
*/
|
||||
void setupSubscriptions();
|
||||
|
||||
/**
|
||||
* @brief Handle received data message CAN frames.
|
||||
*
|
||||
* @param header CAN frame header
|
||||
* @param payload Payload buffer
|
||||
*/
|
||||
void receiveDataFrame(const CanRxHeader & header, const uint8_t * payload);
|
||||
|
||||
private:
|
||||
CanController * controller_;
|
||||
IsotpTransmitter tx_;
|
||||
IsotpReceiver rx_;
|
||||
SysMsgHandler handleSysMsg_;
|
||||
DataMsgHandler handleDataMsg_;
|
||||
};
|
||||
|
||||
} // namespace sta
|
||||
|
Reference in New Issue
Block a user