mirror of
https://github.com/mytechnotalent/Embedded-Hacking.git
synced 2026-07-15 16:37:28 +02:00
54 lines
1.4 KiB
C
54 lines
1.4 KiB
C
/**
|
|
******************************************************************************
|
|
* @file main.c
|
|
* @author Kevin Thomas
|
|
* @brief Blink demonstration: toggle onboard LED every 500 ms.
|
|
*
|
|
* Demonstrates GPIO output control using the blink driver.
|
|
* The onboard LED on GPIO 25 is toggled every 500 ms and the
|
|
* current state is reported over UART.
|
|
*
|
|
******************************************************************************
|
|
* @attention
|
|
*
|
|
* Copyright (c) 2026 Kevin Thomas.
|
|
* All rights reserved.
|
|
*
|
|
* This software is licensed under terms that can be found in the LICENSE file
|
|
* in the root directory of this software component.
|
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
|
*
|
|
******************************************************************************
|
|
*/
|
|
|
|
#include "rp2350_led.h"
|
|
#include "rp2350_uart.h"
|
|
#include "rp2350_delay.h"
|
|
|
|
#define BLINK_DELAY_MS 500
|
|
|
|
/**
|
|
* @brief Print the current LED state over UART.
|
|
* @param pin GPIO pin number to query
|
|
* @retval None
|
|
*/
|
|
static void print_led_state(uint32_t pin)
|
|
{
|
|
if (led_get_state(pin))
|
|
uart_puts("LED: ON\r\n");
|
|
else
|
|
uart_puts("LED: OFF\r\n");
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
led_init(LED_PIN);
|
|
uart_puts("LED driver initialized on GPIO 25\r\n");
|
|
while (1)
|
|
{
|
|
led_toggle(LED_PIN);
|
|
print_led_state(LED_PIN);
|
|
delay_ms(BLINK_DELAY_MS);
|
|
}
|
|
}
|