ChaosDMX
Open-Source DMX-Interface
Loading...
Searching...
No Matches
button_actions.h File Reference

Hardware button abstraction layer for short and long press detection. More...

#include "esp_err.h"
#include <stdbool.h>
Include dependency graph for button_actions.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

esp_err_t button_init (void)
 Initializes the hardware button configuration and event callbacks.
bool button_is_pressed (void)
 Checks if the button is currently physically pressed.

Detailed Description

Hardware button abstraction layer for short and long press detection.

This module wraps the official Espressif IoT button component to handle custom actions.

Definition in file button_actions.h.

Function Documentation

◆ button_init()

esp_err_t button_init ( void )

Initializes the hardware button configuration and event callbacks.

Configures the designated GPIO pin, sets up the debounce thresholds, and registers callbacks for both a single/double/triple short click

Returns
  • ESP_OK: Success
  • ESP_FAIL: Failed to initialize the button or register callbacks

Definition at line 120 of file button_actions.c.

References BUTTON_GPIO_NUM, iot_button_double_click_cb(), iot_button_multiple_click_cb(), iot_button_single_click_cb(), LOGE, LOGI, RESET_HOLD_TIME_MS, and s_btn_handle.

Referenced by app_main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ button_is_pressed()

bool button_is_pressed ( void )

Checks if the button is currently physically pressed.

Returns
true if pressed (active level), false otherwise.

Definition at line 163 of file button_actions.c.

References s_btn_handle.

Referenced by app_main().

Here is the caller graph for this function: