Espressif ESP32-S2 Programming Manual page 979

Table of Contents

Advertisement

Chapter 2. API Reference
• [in] xTicksToWait: Ticks to wait for items in the ring buffer.
• [in] xMaxSize: Maximum number of bytes to return.
void
*xRingbufferReceiveUpToFromISR(RingbufHandle_t
Retrieve bytes from a byte buffer, specifying the maximum amount of bytes to retrieve. Call this from an ISR.
Attempt to retrieve bytes from a byte buffer whilst specifying a maximum number of bytes to retrieve. This
function will return immediately if there is no data available for retrieval.
Note A call to vRingbufferReturnItemFromISR() is required after this to free up the data received.
Note This function should only be called on byte buffers
Note Byte buffers do not allow multiple retrievals before returning an item
Return
• Pointer to the retrieved item on success; *pxItemSize filled with the length of the item.
• NULL when the ring buffer is empty, *pxItemSize is untouched in that case.
Parameters
• [in] xRingbuffer: Ring buffer to retrieve the item from
• [out] pxItemSize: Pointer to a variable to which the size of the retrieved item will be written.
• [in] xMaxSize: Maximum number of bytes to return.
void
vRingbufferReturnItem(RingbufHandle_t
Return a previously-retrieved item to the ring buffer.
Note If a split item is retrieved, both parts should be returned by calling this function twice
Parameters
• [in] xRingbuffer: Ring buffer the item was retrieved from
• [in] pvItem: Item that was received earlier
void
vRingbufferReturnItemFromISR(RingbufHandle_t
Return a previously-retrieved item to the ring buffer from an ISR.
Note If a split item is retrieved, both parts should be returned by calling this function twice
Parameters
• [in] xRingbuffer: Ring buffer the item was retrieved from
• [in] pvItem: Item that was received earlier
• [out] pxHigherPriorityTaskWoken: Value pointed to will be set to pdTRUE if the
function woke up a higher priority task.
void
vRingbufferDelete(RingbufHandle_t
Delete a ring buffer.
Note This function will not deallocate any memory if the ring buffer was created using xRingbufferCreat-
eStatic(). Deallocation must be done manually be the user.
Parameters
• [in] xRingbuffer: Ring buffer to delete
size_t
xRingbufferGetMaxItemSize(RingbufHandle_t
Get maximum size of an item that can be placed in the ring buffer.
This function returns the maximum size an item can have if it was placed in an empty ring buffer.
Note The max item size for a no-split buffer is limited to ((buffer_size/2)-header_size). This limit is imposed
so that an item of max item size can always be sent to the an empty no-split buffer regardless of the
internal positions of the buffer's read/write/free pointers.
Return Maximum size, in bytes, of an item that can be placed in a ring buffer.
Parameters
• [in] xRingbuffer: Ring buffer to query
size_t
xRingbufferGetCurFreeSize(RingbufHandle_t
Get current free size available for an item/data in the buffer.
This gives the real time free space available for an item/data in the ring buffer. This represents the maximum
size an item/data can have if it was currently sent to the ring buffer.
Espressif Systems
xMaxSize)
xRingbuffer, void *pvItem)
*pxHigherPriorityTaskWoken)
xRingbuffer)
xRingbuffer)
xRingbuffer)
968
Submit Document Feedback
xRingbuffer, size_t *pxItemSize, size_t
xRingbuffer, void *pvItem, BaseType_t
Release v4.4

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32-S2 and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents

Save PDF