GPS Device
Loading...
Searching...
No Matches
button_handle_s Struct Reference

Internal structure representing a single button instance. More...

Collaboration diagram for button_handle_s:

Public Attributes

char name [CONFIG_BUTTON_MAX_NAME_LEN]
GPIO_REGDEF_tsgpio_port
GPIO_PIN_te gpio_pin
BUTTON_PUSHED_TYPE_te pushed_type
uint32_t debounce_limit_ms
uint32_t held_limit_ms
uint32_t debounce_started_ms
uint32_t held_started_ms
bool debounce_started
bool held_started
bool pushed
bool held
bool in_use

Detailed Description

Internal structure representing a single button instance.

Holds all runtime state for one button, including configuration copied from BUTTON_CFG_ts, debounce and hold timing state, and the current logical pressed/held flags.

This structure is opaque to the caller; it is accessed only through the BUTTON_HANDLE_ts pointer returned by button_init_handle.

Definition at line 34 of file button.c.

Member Data Documentation

◆ name

char button_handle_s::name[CONFIG_BUTTON_MAX_NAME_LEN]

Human-readable name of the button (null-terminated).

Definition at line 36 of file button.c.

◆ gpio_port

GPIO_REGDEF_ts* button_handle_s::gpio_port

GPIO port the button is connected to.

Definition at line 39 of file button.c.

◆ gpio_pin

GPIO_PIN_te button_handle_s::gpio_pin

GPIO pin the button is connected to.

Definition at line 42 of file button.c.

◆ pushed_type

BUTTON_PUSHED_TYPE_te button_handle_s::pushed_type

Active level that represents a "pressed" state.

Definition at line 45 of file button.c.

◆ debounce_limit_ms

uint32_t button_handle_s::debounce_limit_ms

Debounce window in milliseconds.

Definition at line 48 of file button.c.

◆ held_limit_ms

uint32_t button_handle_s::held_limit_ms

Duration in milliseconds required to register a held state.

Definition at line 51 of file button.c.

◆ debounce_started_ms

uint32_t button_handle_s::debounce_started_ms

Timestamp (ms) when the current debounce window started.

Definition at line 54 of file button.c.

◆ held_started_ms

uint32_t button_handle_s::held_started_ms

Timestamp (ms) when the hold timer started.

Definition at line 57 of file button.c.

◆ debounce_started

bool button_handle_s::debounce_started

True while a debounce window is in progress.

Definition at line 60 of file button.c.

◆ held_started

bool button_handle_s::held_started

True while the hold timer is running.

Definition at line 63 of file button.c.

◆ pushed

bool button_handle_s::pushed

True when the button is considered debounced and pressed.

Definition at line 66 of file button.c.

◆ held

bool button_handle_s::held

True when the button has been held longer than held_limit_ms.

Definition at line 69 of file button.c.

◆ in_use

bool button_handle_s::in_use

True when this slot is occupied by an active button instance.

Definition at line 72 of file button.c.


The documentation for this struct was generated from the following file: