|
ELEC-C7222
Libraries for ELEC C7222 Course Work
|
FreeRTOS + Pico W board validation example. More...
#include <stdio.h>#include "pico/stdlib.h"#include "FreeRTOS.h"#include "event_groups.h"#include "semphr.h"#include "task.h"#include "c7222_pico_w_board.h"
Functions | |
| static void | button_irq_handler (uint32_t gpio, uint32_t events) |
| Shared GPIO IRQ handler for B1 and B2. | |
| static void | task_button_b1 (void *ctx) |
| Task for button B1 (interrupt-driven). | |
| static void | task_button_b2 (void *ctx) |
| Task for button B2 (interrupt-driven). | |
| static void | task_button_b3 (void *ctx) |
| Task for button B3 (polled). | |
| static void | task_button_b4 (void *ctx) |
| Task for button B4 (polled). | |
| static void | task_manager (void *ctx) |
| Management/heartbeat task. | |
| int | main (void) |
| Entry point for the FreeRTOS board validation example. | |
Variables | |
| static SemaphoreHandle_t | b1_semaphore |
| Binary semaphore used to signal B1 press events from ISR to task. | |
| static EventGroupHandle_t | b2_event_group |
| Event group used to signal B2 press events from ISR to task. | |
| static const EventBits_t | kB2PressedBit = (1u << 0) |
FreeRTOS + Pico W board validation example.
This example is intended for students who are testing the Pico W board for the first time. It validates the c7222_pico_w_board API and demonstrates foundational FreeRTOS patterns commonly used on microcontrollers.
c7222_pico_w_board_init_gpio().xSemaphoreGiveFromISR and xEventGroupSetBitsFromISR.
|
static |
Shared GPIO IRQ handler for B1 and B2.
Uses ISR-safe FreeRTOS APIs to notify the corresponding task. Also updates indicator LEDs so students can see edge detection immediately.


| int main | ( | void | ) |
Entry point for the FreeRTOS board validation example.
Board GPIO initialization (LEDs + buttons).
IPC primitives (created before enabling IRQs).
Attach IRQs for falling edges on B1 and B2.
Create tasks: one per button + manager.

|
static |
Task for button B1 (interrupt-driven).
Waits on a binary semaphore signaled by the GPIO ISR and toggles LED1_GREEN.


|
static |
Task for button B2 (interrupt-driven).
Waits on an event-group bit signaled by the GPIO ISR and toggles LED2_GREEN.


|
static |
Task for button B3 (polled).
Periodically reads the input and toggles LED3_GREEN on press.


|
static |
Task for button B4 (polled).
Periodically reads the input and toggles LED3_RED on press.


|
static |
Management/heartbeat task.
Prints a periodic heartbeat so students can verify the scheduler is running.

|
static |
Binary semaphore used to signal B1 press events from ISR to task.
|
static |
Event group used to signal B2 press events from ISR to task.
|
static |