libxr 1.0
Want to be the best embedded framework
|
事件管理系统,允许基于事件 ID 注册和触发回调函数。 Event management system that allows registration and triggering of callbacks based on event IDs. More...
#include <event.hpp>
Data Structures | |
struct | Block |
用于存储事件回调的数据结构。 Data structure for storing event callbacks. More... | |
Public Member Functions | |
Event () | |
构造函数,初始化用于存储事件的红黑树。 Constructs an Event object with an empty red-black tree for event storage. | |
void | Register (uint32_t event, const Callback< uint32_t > &cb) |
为特定事件注册回调函数。 Registers a callback function for a specific event. | |
void | Active (uint32_t event) |
触发与特定事件关联的所有回调函数。 Triggers all callbacks associated with a specific event. | |
void | ActiveFromCallback (uint32_t event, bool in_isr) |
在中断服务程序(ISR)上下文中触发事件回调。 Triggers event callbacks from an interrupt service routine (ISR) context. | |
void | Bind (Event &sources, uint32_t source_event, uint32_t target_event) |
将源事件绑定到当前事件实例中的目标事件。 Binds an event from a source Event instance to a target event in the current Event instance. | |
Private Attributes | |
RBTree< uint32_t > | rbt_ |
事件管理系统,允许基于事件 ID 注册和触发回调函数。 Event management system that allows registration and triggering of callbacks based on event IDs.
|
inline |
构造函数,初始化用于存储事件的红黑树。 Constructs an Event object with an empty red-black tree for event storage.
Definition at line 24 of file event.hpp.
触发与特定事件关联的所有回调函数。 Triggers all callbacks associated with a specific event.
event | 要激活的事件 ID。 The event ID to activate. |
Definition at line 58 of file event.hpp.
在中断服务程序(ISR)上下文中触发事件回调。 Triggers event callbacks from an interrupt service routine (ISR) context.
event | 要激活的事件 ID。 The event ID to activate. |
in_isr | 是否从 ISR 调用该函数。 Whether the function is being called from an ISR. |
Definition at line 82 of file event.hpp.
将源事件绑定到当前事件实例中的目标事件。 Binds an event from a source Event instance to a target event in the current Event instance.
sources | 包含原始事件的源 Event 实例。 The source Event instance containing the original event. |
source_event | 源事件实例中的事件 ID。 The event ID in the source Event instance. |
target_event | 当前事件实例中的目标事件 ID。 The corresponding event ID in the current Event instance. |
Definition at line 109 of file event.hpp.
为特定事件注册回调函数。 Registers a callback function for a specific event.
event | 要注册回调的事件 ID。 The event ID to register the callback for. |
cb | 事件触发时执行的回调函数。 The callback function to be executed when the event occurs. |
Definition at line 36 of file event.hpp.