mirror of
https://github.com/mytechnotalent/Embedded-Hacking.git
synced 2026-07-17 17:37:30 +02:00
afdc1fa594
- GPIO15 active-low button input with internal pull-up - 20ms software debounce via busy-wait confirmation - LED mirrors button state, UART reports edge transitions - New gpio_config_input_pullup() in GPIO driver - 1555B FLASH, 13 source files, zero warnings
40 lines
1.0 KiB
C
40 lines
1.0 KiB
C
/**
|
|
******************************************************************************
|
|
* @file rp2350_delay.c
|
|
* @author Kevin Thomas
|
|
* @brief Delay driver implementation for RP2350.
|
|
*
|
|
* Busy-wait millisecond delay calibrated for a 14.5 MHz clock
|
|
* (3600 loop iterations per millisecond).
|
|
*
|
|
******************************************************************************
|
|
* @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_delay.h"
|
|
|
|
void delay_ms(uint32_t ms)
|
|
{
|
|
if (ms == 0)
|
|
return;
|
|
__asm__ volatile (
|
|
"mov r4, #3600\n\t"
|
|
"mul r5, %0, r4\n\t"
|
|
"1:\n\t"
|
|
"subs r5, #1\n\t"
|
|
"bne 1b\n\t"
|
|
:
|
|
: "r" (ms)
|
|
: "r4", "r5", "cc"
|
|
);
|
|
}
|