5#include "libxr_def.hpp"
6#include "libxr_system.hpp"
24template <
typename Data>
59 return ErrorCode::FULL;
79 return ErrorCode::EMPTY;
99 return ErrorCode::EMPTY;
126 return Push(data) ==
pdTRUE ? ErrorCode::OK : ErrorCode::FULL;
138 return ErrorCode::OK;
142 return ErrorCode::FULL;
170 return ErrorCode::OK;
174 return ErrorCode::EMPTY;
212 return ErrorCode::OK;
216 return ErrorCode::EMPTY;
251 return ErrorCode::OK;
255 return ErrorCode::EMPTY;
线程安全的队列实现,基于 FreeRTOS 消息队列 Thread-safe queue implementation based on FreeRTOS message queue
ErrorCode Pop(Data &data, uint32_t timeout=UINT32_MAX)
从队列弹出数据(阻塞) Pops data from the queue (blocking)
~LockQueue()
析构函数,删除队列 Destructor that deletes the queue
ErrorCode PeekFromCallback(Data &data, bool in_isr)
从 ISR 查看队列中的数据 Peeks at the data in the queue from an ISR
size_t Size()
获取队列中的数据项数量 Gets the number of items in the queue
ErrorCode Pop()
无参数弹出数据 Pops data from the queue without storing it
const uint32_t LENGTH
队列最大长度 Maximum queue length
ErrorCode Push(const Data &data)
将数据推入队列(非阻塞) Pushes data into the queue (non-blocking)
void Reset()
重置队列,清空所有数据 Resets the queue, clearing all data
ErrorCode Peek(Data &data)
查看队列中的数据(非阻塞) Peeks at the data in the queue (non-blocking)
ErrorCode PopFromCallback(Data &data, bool in_isr)
从 ISR(中断服务例程)弹出数据 Pops data from the queue in an ISR (Interrupt Service Routine)
size_t SizeFromCallback(bool in_isr)
从 ISR 获取队列大小 Gets the queue size from an ISR
size_t EmptySize()
获取队列剩余的可用空间 Gets the remaining available space in the queue
ErrorCode OverwriteFromCallback(const Data &data, bool in_isr)
从 ISR 覆盖队列中的数据 Overwrites the data in the queue from an ISR
ErrorCode PopFromCallback(bool in_isr)
从 ISR(中断服务例程)弹出数据 Pops data from the queue in an ISR (Interrupt Service Routine)
QueueHandle_t queue_handle_
FreeRTOS 队列句柄 FreeRTOS queue handle.
size_t EmptySizeFromCallback(bool in_isr)
从 ISR 获取队列剩余的可用空间 Gets the remaining available space in the queue from an ISR
ErrorCode PushFromCallback(const Data &data, bool in_isr)
从 ISR(中断服务例程)推入数据 Pushes data into the queue from an ISR (Interrupt Service Routine)
ErrorCode Pop(uint32_t timeout)
从队列弹出数据(不关心数据值) Pops data from the queue without retrieving its value
LockQueue(size_t length)
构造函数,创建指定长度的队列 Constructor that creates a queue of specified length
ErrorCode Overwrite(const Data &data)
覆盖队列中的数据 Overwrites the data in the queue
LibXR Color Control Library / LibXR终端颜色控制库
constexpr auto min(T1 a, T2 b) -> typename std::common_type< T1, T2 >::type
计算两个数的最小值