nRF5 SDK v17.1.0
Queue library

The queue library provides interrupt secure implementation of the circular buffer to store predefined objects.

Key features include:

Creating a queue

To create a queue instance, use the NRF_QUEUE_DEF macro and provide the stored type, the identifier, the queue size, and the working mode. The macro allocates memory for the queue and the internals of the instance.

The following example code allocates memory for a queue instance and a queue that can store up to 10 bytes:

NRF_QUEUE_DEF(uint8_t, m_byte_queue, 10, NRF_QUEUE_MODE_NO_OVERFLOW);

After the queue is defined, you can define its interface (this step is optional):

NRF_QUEUE_INTERFACE_DEC(uint8_t, byte_queue);
NRF_QUEUE_INTERFACE_DEF(uint8_t, byte_queue, &m_byte_queue)

Using the queue

This section contains sample code that lets you perform actions on the queue instance:


Documentation feedback | Developer Zone | Subscribe | Updated