mirror of
https://github.com/mytechnotalent/Embedded-Hacking.git
synced 2026-07-12 15:16:32 +02:00
Fixed improper _
This commit is contained in:
@@ -57,7 +57,7 @@
|
||||
*
|
||||
* @param last_state Pointer to the stored previous button state
|
||||
*/
|
||||
static void _poll_button(bool *last_state) {
|
||||
static void poll_button(bool *last_state) {
|
||||
bool pressed = button_is_pressed(BUTTON_PIN);
|
||||
button_led_set(LED_PIN, pressed);
|
||||
if (pressed != *last_state) {
|
||||
@@ -73,7 +73,7 @@ int main(void) {
|
||||
printf("Button driver initialized: button=GPIO%d led=GPIO%d\r\n", BUTTON_PIN, LED_PIN);
|
||||
bool last_state = false;
|
||||
while (true) {
|
||||
_poll_button(&last_state);
|
||||
poll_button(&last_state);
|
||||
sleep_ms(10);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ static uint32_t debounce_delay_ms = 20;
|
||||
* @param pin GPIO pin number to re-sample
|
||||
* @return bool true if the pin is still low after the debounce delay
|
||||
*/
|
||||
static bool _debounce_confirm(uint32_t pin) {
|
||||
static bool debounce_confirm(uint32_t pin) {
|
||||
sleep_ms(debounce_delay_ms);
|
||||
return !gpio_get(pin);
|
||||
}
|
||||
@@ -58,7 +58,7 @@ void button_init(uint32_t pin, uint32_t debounce_ms) {
|
||||
|
||||
bool button_is_pressed(uint32_t pin) {
|
||||
if (!gpio_get(pin)) {
|
||||
return _debounce_confirm(pin);
|
||||
return debounce_confirm(pin);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user