How do I implement an interrupt service routine (ISR) in FreeRTOS?

@Middleware & OS Hello guys, how do I Implement an interrupt service routine (ISR) in FreeRTOS that triggers a task when a button is pressed and also Ensure the ISR communicates with the task using a binary semaphore
Solution:
You can achieve this with the following steps 1. Configure the button press as an interrupt source. 2. Write the ISR to give a binary semaphore when the button is pressed. 3. Create a task that takes the semaphore and runs when the semaphore is given....
Jump to solution
6 Replies
Marvee Amasi
Marvee Amasi5mo ago
@Enthernet Code start your setup by configuring the button pin to trigger an interrupt on press . Then create your binary semaphore using
xSemaphoreCreateBinary
xSemaphoreCreateBinary
.
Marvee Amasi
Marvee Amasi5mo ago
So now when the button is pressed, your ISR will now briefly signals the semaphore with
xSemaphoreGiveFromISR
xSemaphoreGiveFromISR
Marvee Amasi
Marvee Amasi5mo ago
The task waits on the semaphore with
xSemaphoreTake
xSemaphoreTake
Now we press the button semaphore is signaled, the task wakes up and does something
Marvee Amasi
Marvee Amasi5mo ago
The priority you must put on ISR should be higher than the task tho
Solution
Joseph Ogbonna
Joseph Ogbonna5mo ago
You can achieve this with the following steps 1. Configure the button press as an interrupt source. 2. Write the ISR to give a binary semaphore when the button is pressed. 3. Create a task that takes the semaphore and runs when the semaphore is given.
Enthernet Code
Enthernet Code5mo ago
Thanks would do this
Want results from more Discord servers?
Add your server