|
libxr
1.0
Want to be the best embedded framework
|
STM32CAN 类,用于处理 STM32 系统的 CAN 通道。 Provides handling for STM32 CAN channels. More...
#include <stm32_can.hpp>
Public Member Functions | |
| STM32CAN (CAN_HandleTypeDef *hcan, uint32_t pool_size) | |
| STM32CAN 类,用于处理 STM32 系统的 CAN 通道。 Provides handling for STM32 CAN. | |
| ErrorCode | Init (void) |
| 初始化 | |
| ErrorCode | AddMessage (const ClassicPack &pack) override |
| 添加 CAN 消息到系统 (Adds a CAN message to the system). | |
| void | ProcessRxInterrupt () |
| 处理接收中断 | |
| void | ProcessTxInterrupt () |
| 处理发送中断 | |
Public Member Functions inherited from LibXR::CAN | |
| CAN () | |
| 构造 CAN 对象,可指定主题名称和通信域 (Constructs a CAN object with an optional topic name and domain). | |
| struct | __attribute__ ((packed)) |
| 经典 CAN 消息结构 (Structure representing a classic CAN message). | |
| void | Register (Callback cb, Type type, FilterMode mode=FilterMode::ID_RANGE, uint32_t start_id_mask=0, uint32_t end_id_match=UINT32_MAX) |
| 注册回调函数 Registers a callback function | |
Data Fields | ||
| CAN_HandleTypeDef * | hcan_ | |
| stm32_can_id_t | id_ | |
| uint32_t | fifo_ | |
| struct { | ||
| CAN_RxHeaderTypeDef header | ||
| ClassicPack pack | ||
| } | rx_buff_ | |
| struct { | ||
| CAN_TxHeaderTypeDef header | ||
| ClassicPack pack | ||
| } | tx_buff_ | |
| uint32_t | txMailbox | |
| LockFreePool< ClassicPack > | tx_pool_ | |
| std::atomic< uint32_t > | bus_busy_ = 0 | |
Data Fields inherited from LibXR::CAN | ||
| ClassicPack | ||
Static Public Attributes | |
| static STM32CAN * | map [STM32_CAN_NUMBER] = {nullptr} |
Additional Inherited Members | |
Public Types inherited from LibXR::CAN | |
| enum class | Type : uint8_t { STANDARD = 0 , EXTENDED = 1 , REMOTE_STANDARD = 2 , REMOTE_EXTENDED = 3 , TYPE_NUM } |
| CAN 消息类型 (Enumeration of CAN message types). More... | |
| enum class | FilterMode : uint8_t { ID_MASK = 0 , ID_RANGE = 1 } |
| using | Callback = LibXR::Callback<const ClassicPack &> |
Protected Member Functions inherited from LibXR::CAN | |
| void | OnMessage (const ClassicPack &pack, bool in_isr) |
STM32CAN 类,用于处理 STM32 系统的 CAN 通道。 Provides handling for STM32 CAN channels.
Definition at line 38 of file stm32_can.hpp.
| STM32CAN::STM32CAN | ( | CAN_HandleTypeDef * | hcan, |
| uint32_t | pool_size ) |
STM32CAN 类,用于处理 STM32 系统的 CAN 通道。 Provides handling for STM32 CAN.
| hcan | STM32CAN对象 CAN object |
| pool_size | 发送池大小 Send pool size |
Definition at line 47 of file stm32_can.cpp.
|
overridevirtual |
添加 CAN 消息到系统 (Adds a CAN message to the system).
Implements LibXR::CAN.
Definition at line 139 of file stm32_can.cpp.
| ErrorCode STM32CAN::Init | ( | void | ) |
初始化
Definition at line 54 of file stm32_can.cpp.
| void STM32CAN::ProcessRxInterrupt | ( | ) |
处理接收中断
Definition at line 199 of file stm32_can.cpp.
| void STM32CAN::ProcessTxInterrupt | ( | ) |
处理发送中断
Definition at line 234 of file stm32_can.cpp.
| std::atomic<uint32_t> LibXR::STM32CAN::bus_busy_ = 0 |
Definition at line 92 of file stm32_can.hpp.
| uint32_t LibXR::STM32CAN::fifo_ |
Definition at line 73 of file stm32_can.hpp.
| CAN_HandleTypeDef* LibXR::STM32CAN::hcan_ |
Definition at line 70 of file stm32_can.hpp.
| CAN_RxHeaderTypeDef LibXR::STM32CAN::header |
Definition at line 78 of file stm32_can.hpp.
| CAN_TxHeaderTypeDef LibXR::STM32CAN::header |
Definition at line 84 of file stm32_can.hpp.
| stm32_can_id_t LibXR::STM32CAN::id_ |
Definition at line 72 of file stm32_can.hpp.
|
static |
Definition at line 74 of file stm32_can.hpp.
| ClassicPack LibXR::STM32CAN::pack |
Definition at line 79 of file stm32_can.hpp.
| LockFreePool<ClassicPack> LibXR::STM32CAN::tx_pool_ |
Definition at line 90 of file stm32_can.hpp.
| uint32_t LibXR::STM32CAN::txMailbox |
Definition at line 88 of file stm32_can.hpp.