I trying to some up with a good solution to over come an issue with my design. I’ve designed a very basic event pool allocator (using C++ templates) to be used by my tasks and each pool has its own lock (therefore I cannot use my allocator within an ISR). Each task has its own queue of base type Event * which allows each tasks to create an event (using my event pool) and submit this to the relevant queues.
However, I also want my ISR routines to also post events on these queues (such as button events). Now, because I cannot use my pool allocator I’ve described (due to using locks), what would be the best solution for this? The naïve solution I can some up with is:
- Within my ISR class, have an array of events I would like to post (such as UserButtonEvents) and check to see if space is available to post on the queue. If space is available, pass the address of the element within my array onto the queue and increment accordingly and wrap around.
- I could use a queueset but I’m trying to keep my RAM consumption to a minimum (ideally if FreeRTOS has a static queueset, that might help me keep tracking of usage).
Also note, all of my tasks wait on their own queue for events and are only woken up when and event is published. Therefore, I cannot wait on a semaphore for a button event, as I also need to wait on queue for my respective tasks (each tasks needs to reply back to a watchdog tasks).
Any hints please?