mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-12-17 00:58:02 +00:00
Move CAN subdir
This commit is contained in:
95
include/sta/can/controller.hpp
Normal file
95
include/sta/can/controller.hpp
Normal file
@@ -0,0 +1,95 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief CAN controller driver interface.
|
||||
*/
|
||||
#ifndef STA_CAN_CONTROLLER_HPP
|
||||
#define STA_CAN_CONTROLLER_HPP
|
||||
|
||||
/**
|
||||
* @defgroup can CAN
|
||||
* @brief CAN controller driver interface.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup canAPI API
|
||||
* @ingroup can
|
||||
* @brief Public interface.
|
||||
*/
|
||||
|
||||
|
||||
#include <sta/can/filter.hpp>
|
||||
#include <sta/can/headers.hpp>
|
||||
|
||||
|
||||
namespace sta
|
||||
{
|
||||
/**
|
||||
* @brief CAN controller driver interface.
|
||||
*
|
||||
* @ingroup canAPI
|
||||
*/
|
||||
class CanController
|
||||
{
|
||||
public:
|
||||
// RX/TX
|
||||
//
|
||||
|
||||
/**
|
||||
* @brief Send frame to CAN controller for transmission.
|
||||
*
|
||||
* @param header CAN frame TX header
|
||||
* @param payload CAN frame payload
|
||||
* @return True on success
|
||||
*/
|
||||
virtual bool sendFrame(const CanTxHeader & header, const uint8_t * payload) = 0;
|
||||
|
||||
/**
|
||||
* @brief Get received frame from the CAN controller.
|
||||
*
|
||||
* @param[in] fifo FIFO storing frame
|
||||
* @param[out] header CAN frame RX header destination
|
||||
* @param[out] payload CAN frame payload destination
|
||||
* @return True on success
|
||||
*/
|
||||
virtual bool receiveFrame(uint8_t fifo, CanRxHeader * header, uint8_t * payload) = 0;
|
||||
|
||||
/**
|
||||
* @brief Get RX FIFO flags.
|
||||
*
|
||||
* @return FIFO flags
|
||||
*/
|
||||
virtual uint32_t getRxFifoFlags() = 0;
|
||||
|
||||
|
||||
// RX filter
|
||||
//
|
||||
|
||||
/**
|
||||
* @brief Change filter settings.
|
||||
*
|
||||
* @param idx Filter index
|
||||
* @param filter Filter configuration
|
||||
* @param active Enable filter after applying settings
|
||||
*/
|
||||
virtual void configureFilter(uint8_t idx, const CanFilter & filter, bool active = false) = 0;
|
||||
/**
|
||||
* @brief Enable filter.
|
||||
*
|
||||
* @param idx Filter index
|
||||
*/
|
||||
virtual void enableFilter(uint8_t idx) = 0;
|
||||
/**
|
||||
* @brief Disable filter.
|
||||
*
|
||||
* @param idx Filter index
|
||||
*/
|
||||
virtual void disableFilter(uint8_t idx) = 0;
|
||||
/**
|
||||
* @brief Disable and clear all filters.
|
||||
*/
|
||||
virtual void clearFilters() = 0;
|
||||
};
|
||||
} // namespace sta
|
||||
|
||||
|
||||
#endif // STA_CAN_CONTROLLER_HPP
|
||||
Reference in New Issue
Block a user