I'm working on a project with 5 different sensors. I have 4 tasks (I'm using freeRTOS, and I'm relatively new to using embedded OS'es):
sensor_managerwhich will read the sensors and put the data in a queue (which will be a data structure) (priority: 3)LED_managerwhich will take (peek) data from the queue and turn on the appropriate LEDs (priority: 2)display_managerwhich will also peek from the queue and update a TFT display (priority: 1)xively_managerwhich will also peek from the queue and upload the data to a web service called Xively. (priority: 0)
Questions:
- I want the system to work in the exact order as I've described. The problem I have is deciding on whether to use a binary semaphore or a counting semaphore to synchronize between these tasks; they all have to take turns accessing the queue containing the sensor data .
- Will each task have to "take" the semaphore in the beginning and "give back" the semaphore at the end of the task? Suggestions are greatly appreciated! Please direct me to any web sources that adequately explain the use of semaphores.