FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [October 2016 Threads]
Is there possibly any way that I can use a FreeRTOS queue in which I can load up several items and then cherry pick and remove certain items other than doing a queuePeek which only lets me know what is coming up next in the queue? In other words, if I have 3 items on a queue (0, 1, 2) and I want to delete item in position 1 and then have item 2 become the new item 1, is there an easy way to do this? I've looked through the API queue library and have only been able to come up with an algorithm which receives the whole queue on a temporary buffer, deletes an item, then dumps the new contents of the buffer back onto the queue :(
The API is designed to work as a queue, although there are mechanisms to break the first in first out paradigm in some places (for example, posting urgent data to the front of the queue, or peak data) there is no mechanism that can allow a queue to be used as a generic buffer from which data can be inserted or removed from any position.
The actual data in a queue is in a circular buffer, so you could hack your own way of doing this. You would need to see the internal structure of the queue itself, which due to data hiding, would mean you would have to add your code into the queue.c source file.
However, consider using other mechanisms too as it doesn't sound like a queue is actually what you want. You could for example use a linked list. Although not part of the public API and therefore not documented the linked list implementation used internally be FreeRTOS can be used by application code. See list.c and list.h. You could of course always implement your own buffering mechanism.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.