0
0
FreeRTOSprogramming~10 mins

Event-driven architecture in FreeRTOS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create an event group in FreeRTOS.

FreeRTOS
EventGroupHandle_t [1] = xEventGroupCreate();
Drag options to blanks, or click blank then click option'
AeventGroup
BxQueue
CtaskHandle
DtimerID
Attempts:
3 left
💡 Hint
Common Mistakes
Using a queue or task handle variable name instead of an event group handle.
Not assigning the return value of xEventGroupCreate() to a variable.
2fill in blank
medium

Complete the code to wait for an event bit to be set in the event group.

FreeRTOS
EventBits_t bits = xEventGroupWaitBits(eventGroup, [1], pdTRUE, pdFALSE, portMAX_DELAY);
Drag options to blanks, or click blank then click option'
A0xFF
B0x00
C0x10
D0x01
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0x00 which waits for no bits.
Using 0xFF which waits for all bits set.
3fill in blank
hard

Fix the error in the code to set an event bit in the event group.

FreeRTOS
xEventGroup[1]Bits(eventGroup, 0x01);
Drag options to blanks, or click blank then click option'
ACreate
BClear
CSet
DWait
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'ClearBits' which clears bits instead of setting.
Using 'WaitBits' which waits for bits instead of setting.
4fill in blank
hard

Fill both blanks to create an event group and check if a specific bit is set.

FreeRTOS
EventGroupHandle_t [1] = xEventGroupCreate();
if (xEventGroupGetBits([2]) & 0x02) {
    // Event bit 2 is set
}
Drag options to blanks, or click blank then click option'
AmyEventGroup
BeventQueue
DtaskHandle
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names for creation and checking.
Using a queue or task handle instead of an event group handle.
5fill in blank
hard

Fill all three blanks to set multiple event bits and then clear one bit.

FreeRTOS
xEventGroupSetBits([1], 0x03);
xEventGroupClearBits([2], [3]);
Drag options to blanks, or click blank then click option'
AeventGroupHandle
C0x01
D0x02
Attempts:
3 left
💡 Hint
Common Mistakes
Using different handles for set and clear functions.
Clearing the wrong bit mask.