Complete the code to send a task notification in FreeRTOS.
xTaskNotifyGive([1]);The function xTaskNotifyGive() sends a notification to the specified task handle, which is xTaskToNotify here.
Complete the code to wait for a task notification with a timeout.
ulTaskNotifyTake([1], pdMS_TO_TICKS(1000));
pdFALSE which does not clear the notification value.The first parameter pdTRUE clears the notification value on exit, which is common when waiting for a notification.
Fix the error in the code to send a notification with a value.
xTaskNotify([1], 0x01, eSetBits);
The first argument must be the task handle to notify, which is xTaskToNotify.
Fill both blanks to create a task notification value and check if a bit is set.
uint32_t notifValue = [1]; if (notifValue [2] 0x01) { // Bit 0 is set }
The function ulTaskNotifyValueClear() reads and clears bits, and the bitwise AND operator & checks if bit 0 is set.
Fill all three blanks to send a notification, wait for it, and clear the value.
xTaskNotify([1], 0x02, eSetBits); uint32_t value = ulTaskNotifyTake([2], portMAX_DELAY); value = ulTaskNotifyValueClear([3], 0x02);
pdFALSE which does not clear notification value.Use the task handle xTaskToNotify to send and clear notifications, and pdTRUE to clear the notification value when waiting.