mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-08-05 18:21:54 +00:00
Added I2C support for raspi & first rework of debugging
This commit is contained in:
115
include/sta/bus/can/controller.hpp
Normal file
115
include/sta/bus/can/controller.hpp
Normal file
@@ -0,0 +1,115 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief CAN controller driver interface.
|
||||
*/
|
||||
#ifndef STA_CORE_CAN_CONTROLLER_HPP
|
||||
#define STA_CORE_CAN_CONTROLLER_HPP
|
||||
|
||||
/**
|
||||
* @defgroup sta_core_can CAN
|
||||
* @ingroup sta_core
|
||||
* @brief CAN controller driver interface.
|
||||
*/
|
||||
|
||||
|
||||
#include <sta/bus/can/filter.hpp>
|
||||
#include <sta/bus/can/headers.hpp>
|
||||
#include <sta/bus/can/iter.hpp>
|
||||
|
||||
|
||||
namespace sta
|
||||
{
|
||||
/**
|
||||
* @brief CAN controller driver interface.
|
||||
*
|
||||
* @ingroup sta_core_can
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
* @brief Get list of RX FIFO indices with pending messages.
|
||||
*/
|
||||
virtual CanPendingRxFifos getPendingRxFifos() = 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;
|
||||
|
||||
|
||||
// Info
|
||||
//
|
||||
|
||||
/**
|
||||
* @brief Get number of available filters.
|
||||
*/
|
||||
virtual uint8_t maxFilterCount() const = 0;
|
||||
|
||||
/**
|
||||
* @brief Get number of available FIFOs.
|
||||
*/
|
||||
virtual uint8_t maxFifoCount() const = 0;
|
||||
|
||||
/**
|
||||
* @brief Get maximum supported payload size.
|
||||
*/
|
||||
virtual uint8_t maxPayloadSize() const = 0;
|
||||
};
|
||||
} // namespace sta
|
||||
|
||||
|
||||
#endif // STA_CORE_CAN_CONTROLLER_HPP
|
Reference in New Issue
Block a user