mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/rtos2-utils.git
synced 2025-06-10 18:15:59 +00:00
Moved AlpakaCanBus to TACOS
This commit is contained in:
parent
3b21a9aa8f
commit
d4aa3c4081
@ -8,7 +8,6 @@
|
||||
|
||||
#include <sta/debug/assert.hpp>
|
||||
#include <sta/bus/can/subscribable.hpp>
|
||||
#include <sta/debug_serial.hpp>
|
||||
#include <sta/lang.hpp>
|
||||
#include <sta/proto/isotp/transmitter.hpp>
|
||||
#include <sta/proto/isotp/receiver.hpp>
|
||||
@ -138,74 +137,6 @@ namespace dummy
|
||||
|
||||
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);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Send system message.
|
||||
*
|
||||
* @param msg Message
|
||||
*/
|
||||
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_;
|
||||
};
|
||||
|
||||
|
||||
AlpakaCanBus::AlpakaCanBus(CanController * controller, TimeMsFn timeMs, SysMsgHandler sysMsgHandler, DataMsgHandler dataMsgHandler)
|
||||
: controller_{controller}, tx_{controller, timeMs}, rx_{controller, timeMs}, handleSysMsg_{sysMsgHandler}, handleDataMsg_{dataMsgHandler}
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user