Bird
0
0

You want to pass multiple values to a FreeRTOS task. Which is the best way to do this given the task function signature?

hard📝 Application Q8 of 15
FreeRTOS - Task Creation and Management
You want to pass multiple values to a FreeRTOS task. Which is the best way to do this given the task function signature?
ACreate a struct with all values and pass its pointer as void* parameter
BPass multiple parameters directly to the task function
CUse global variables only
DPass an array of integers as the parameter
Step-by-Step Solution
Solution:
  1. Step 1: Understand task parameter limitation

    Task functions accept only one void pointer parameter, so multiple values must be grouped.
  2. Step 2: Use struct to group values

    Creating a struct with all needed values and passing its pointer fits the signature and keeps data organized.
  3. Final Answer:

    Create a struct with all values and pass its pointer as void* parameter -> Option A
  4. Quick Check:

    Group multiple values in struct pointer [OK]
Quick Trick: Use struct pointer to pass multiple values via void* [OK]
Common Mistakes:
  • Trying to pass multiple parameters directly
  • Relying only on globals
  • Passing arrays without proper casting

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes