|
ELEC-C7222
Libraries for ELEC C7222 Course Work
|
FreeRTOS-based LED test application for the Pico 2 W board. More...
#include "pico/stdlib.h"#include <assert.h>#include <stdio.h>#include <FreeRTOS.h>#include <task.h>
Macros | |
| #define | LED_DELAY_MS 100 |
Functions | |
| int | pico_led_init (void) |
| Initialize the board-specific LED backend. | |
| void | pico_set_led (bool led_on) |
| Set the onboard LED state. | |
| static void | led_task (void *argument) |
FreeRTOS task that blinks the onboard LED at LED_DELAY_MS. | |
| static void | log_task (void *argument) |
| Low-priority FreeRTOS task for periodic logging. | |
| int | main () |
| Application entry point. | |
FreeRTOS-based LED test application for the Pico 2 W board.
This C source is intended for testing a Pico 2 W board by blinking the onboard LED using the Pico C SDK and FreeRTOS. It configures LED control for either:
PICO_DEFAULT_LED_PIN), orCYW43_WL_GPIO_LED_PIN).Two FreeRTOS tasks are created:
led_task(): toggles the LED periodically.log_task(): prints a periodic low-priority status message. | #define LED_DELAY_MS 100 |
|
static |
FreeRTOS task that blinks the onboard LED at LED_DELAY_MS.
Usage:
main() using xTaskCreate().vTaskDelay().| argument | Unused task argument. |

|
static |
Low-priority FreeRTOS task for periodic logging.
Usage:
main() with lower priority than led_task().| argument | Unused task argument. |
| int main | ( | void | ) |
Application entry point.
Startup sequence:
stdio_init_all()).pico_led_init()).led_task() and log_task()).vTaskStartScheduler()).Usage:

| int pico_led_init | ( | void | ) |
Initialize the board-specific LED backend.
Usage:
pico_set_led().main(), the return value is checked with hard_assert() to ensure initialization succeeded.PICO_OK on success for GPIO-based boards, or the result of cyw43_arch_init() for Pico W style boards. 
| void pico_set_led | ( | bool | led_on | ) |
Set the onboard LED state.
This function abstracts the hardware difference between direct GPIO LED control and CYW43-controlled LED GPIO on Pico W style boards.
Usage:
pico_led_init() succeeds.true to turn the LED on, false to turn it off.| led_on | Desired LED state (true = on, false = off). |
