0
0
FreeRTOSprogramming~15 mins

Task function signature in FreeRTOS - Mini Project: Build & Apply

Choose your learning style9 modes available
Understanding Task Function Signature in FreeRTOS
📖 Scenario: You are working on a small embedded system project using FreeRTOS. To run tasks properly, you need to write task functions with the correct signature so the operating system can manage them.
🎯 Goal: Learn how to write a FreeRTOS task function with the correct signature and create a simple task that prints a message.
📋 What You'll Learn
Create a task function with the correct FreeRTOS signature
Use the void *pvParameters parameter
Call vTaskDelete(NULL) at the end of the task
Print a message inside the task function
💡 Why This Matters
🌍 Real World
Embedded systems often use FreeRTOS to manage multiple tasks like sensor reading, communication, and control. Writing task functions correctly is essential for system stability.
💼 Career
Understanding FreeRTOS task function signatures is important for embedded software engineers working on real-time applications in industries like automotive, robotics, and IoT.
Progress0 / 4 steps
1
Create a FreeRTOS task function skeleton
Write a function called vTaskFunction that takes a single parameter void *pvParameters and returns void. Inside the function, add an empty infinite loop for(;;).
FreeRTOS
Need a hint?

Remember, FreeRTOS task functions always have the signature void functionName(void *pvParameters) and usually run an infinite loop.

2
Add a print statement inside the task loop
Inside the infinite loop of vTaskFunction, add a call to printf that prints the exact message "Task is running\n".
FreeRTOS
Need a hint?

Use printf inside the loop to show the task is running.

3
Add task deletion to end the task properly
After the infinite loop in vTaskFunction, add a call to vTaskDelete(NULL) to delete the current task when it finishes.
FreeRTOS
Need a hint?

Use vTaskDelete(NULL) to delete the current task safely.

4
Print a message to confirm task function is defined
Write a main function that calls printf with the exact message "Task function signature ready" to confirm your task function is defined correctly.
FreeRTOS
Need a hint?

Use printf in main to print the confirmation message.