Dispatch

A motion sensor on PA0 fires an interrupt each time it detects activity. A colleague prototyped this using a counting semaphore (like ch27), but since there is only one consumer task, the team wants to switch to FreeRTOS task notifications. They are lighter weight: no kernel object allocation, faster than semaphores, and signal directly to a specific task.

Your job: wire up EXTI0 for rising edge interrupts on PA0 and use xTaskNotifyFromISR / ulTaskNotifyTake to pass events from the ISR to a processing task. The task prints "NOTIFY:<n>" for each event (starting from 1), then prints "DONE" after no event arrives within 200ms.

Example with 2 events: NOTIFY:1 NOTIFY:2 DONE

Available FreeRTOS APIs: xTaskNotifyFromISR(task_handle, value, action, pxHigherPriorityTaskWoken) ulTaskNotifyTake(clear_on_exit, timeout) eIncrement (notification action that increments the value) xTaskCreate(function, name, stack_size, param, priority, handle) vTaskStartScheduler() vTaskDelay(ticks) pdMS_TO_TICKS(ms) pdTRUE / pdFALSE configMINIMAL_STACK_SIZE

EXTI and NVIC must be configured for PA0 rising edge interrupts. The ISR entry point is EXTI0_IRQHandler (IRQ number 6). Remember to clear the EXTI pending bit in the handler. You will need a global task handle so the ISR knows which task to notify.

Loading the interactive arena.