Add 0x0d_timer_cbm: bare-metal TIMER0 repeating alarm driver for RP2350

This commit is contained in:
Kevin Thomas
2026-04-05 20:28:23 -04:00
parent acd9db9d43
commit f63578de94
24 changed files with 1950 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
/**
******************************************************************************
* @file main.c
* @author Kevin Thomas
* @brief Repeating timer alarm demonstration.
*
* Configures TIMER0 alarm 0 to fire a callback every 1 second.
* The callback prints "Timer heartbeat" over UART. The main
* loop idles with WFI.
*
* Wiring:
* GPIO0 -> UART TX (USB-to-UART adapter RX)
* GPIO1 -> UART RX (USB-to-UART adapter TX)
* No external components required
*
******************************************************************************
* @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_timer.h"
#include "rp2350_uart.h"
/**
* @brief Heartbeat callback invoked by TIMER0 alarm 0 IRQ.
* @retval None
*/
static void _heartbeat(void)
{
uart_puts("Timer heartbeat\r\n");
}
/**
* @brief Application entry point for the repeating timer demo.
* @retval int does not return
*/
int main(void)
{
uart_puts("Timer alarm demo initialized\r\n");
timer_alarm_start(1000, _heartbeat);
while (1)
__asm__ volatile ("wfi");
}