I recently found out about FreeRTOS and been doing some experiments with it. I’m looking to make a “button” driver utilizing user buttons on the board I have.
Here’s the behavior I’m looking to implement:
- allow multiple tasks to block and wait for a button “event” to occur.
- once the button is pressed all tasks that were awaiting for the button press would be unblocked
- If a button event happens and afterwards a task queries the button driver for an event, the task would block and await a future button event. Button events only apply for tasks already waiting for the event.
I’ve been looking into how to do it and I think using an event group is the way to go, but I just wanted to ask since I’m new to FreeRTOS.
Is an event group the best way to go in order to implement the behavior I’m looking for?
I’m looking to make this driver as simple and as lightweight as possible (it’s a silly little driver), so I’m looking to spend as little time as possible in kernel-space & avoid creating driver tasks/daemons.
My understanding is I don’t need to specify how many tasks are waiting for the same event group, is that correct?
Ideally that’s what I want. I’m making a driver so I’d like my code to work with N tasks, although it’s not the end of the world if not.