mirror of
https://github.com/mytechnotalent/Embedded-Hacking.git
synced 2026-06-04 05:18:01 +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
45 lines
1.5 KiB
C
45 lines
1.5 KiB
C
/**
|
|
******************************************************************************
|
|
* @file rp2350_button.h
|
|
* @author Kevin Thomas
|
|
* @brief Button input driver header for RP2350.
|
|
*
|
|
* Push-button GPIO input driver with software debounce.
|
|
* The button pin is configured as active-low with internal
|
|
* pull-up; pressing the button connects the pin to GND.
|
|
*
|
|
******************************************************************************
|
|
* @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.
|
|
*
|
|
******************************************************************************
|
|
*/
|
|
|
|
#ifndef __RP2350_BUTTON_H
|
|
#define __RP2350_BUTTON_H
|
|
|
|
#include "rp2350.h"
|
|
|
|
/**
|
|
* @brief Initialize a GPIO pin as an active-low button input with pull-up.
|
|
* @param pin GPIO pin number to configure as a button input
|
|
* @param debounce_ms debounce settling time in milliseconds
|
|
* @retval None
|
|
*/
|
|
void button_init(uint32_t pin, uint32_t debounce_ms);
|
|
|
|
/**
|
|
* @brief Read the debounced state of the button.
|
|
* @param pin GPIO pin number previously initialized with button_init()
|
|
* @retval bool true if the button is firmly pressed, false if released
|
|
*/
|
|
bool button_is_pressed(uint32_t pin);
|
|
|
|
#endif /* __RP2350_BUTTON_H */
|