17template <fl::size DescriptorCount = 128, fl::size ArenaSize = 4096>
21 "DescriptorCount must be power of 2");
23 "ArenaSize must be power of 2");
65 return DescriptorCount - 1;
fl::size size() const FL_NO_EXCEPT
Get current number of messages in queue.
bool push(const fl::string &msg) FL_NO_EXCEPT
Push a message from fl::string (ISR-safe)
static fl::u16 boundedStrlen(const char *str, fl::u16 maxLen) FL_NO_EXCEPT
AsyncLogQueue() FL_NO_EXCEPT
bool arenaHasSpace(fl::u32 aHead, fl::u32 aTail, fl::u16 len) const FL_NO_EXCEPT
FL_STATIC_ASSERT(ArenaSize >=32, "ArenaSize must be >= 32")
volatile fl::u32 mArenaHead
Producer write position (arena)
bool tryPop(const char **outPtr, fl::u16 *outLen) FL_NO_EXCEPT
Consumer: Try to pop one message (main thread only)
volatile fl::u32 mTail
Consumer read position (descriptor ring)
fl::u32 droppedCount() const FL_NO_EXCEPT
Get number of messages dropped due to overflow.
fl::u32 loadArenaTail() const FL_NO_EXCEPT
volatile fl::u32 mDropped
Count of dropped messages (overflow)
FL_STATIC_ASSERT((DescriptorCount &(DescriptorCount - 1))==0, "DescriptorCount must be power of 2")
FL_STATIC_ASSERT(DescriptorCount >=4, "DescriptorCount must be >= 4")
void atomicIncDropped() FL_NO_EXCEPT
fl::u32 loadHead() const FL_NO_EXCEPT
bool empty() const FL_NO_EXCEPT
Check if queue is empty.
fl::u32 loadTail() const FL_NO_EXCEPT
constexpr fl::size capacity() const FL_NO_EXCEPT
Get maximum descriptor capacity.
FL_STATIC_ASSERT((ArenaSize &(ArenaSize - 1))==0, "ArenaSize must be power of 2")
void commit() FL_NO_EXCEPT
Consumer: Commit the popped message to free space (main thread only)
Descriptor mDescriptors[DescriptorCount]
Ring of message descriptors.
volatile fl::u32 mHead
Producer write position (descriptor ring)
volatile fl::u32 mArenaTail
Consumer read position (arena)
char mArena[ArenaSize]
String storage arena.
#define constexpr
Declares that it is possible to evaluate a value at compile time, introduced in C++11.
u8 u8 fract8 blur_amount FL_NO_EXCEPT
Base definition for an LED controller.
Portable compile-time assertion wrapper.
fl::u32 mStartIdx
Offset into arena where message starts.
fl::u16 mLength
Length of message in bytes.
fl::u16 mPadding
Reserved for alignment (unused)
Descriptor() FL_NO_EXCEPT
Descriptor for one log message.