GPS Device
Loading...
Searching...
No Matches
button.h File Reference

Button module public API. More...

#include <stdint.h>
#include "io.h"
#include "stm32f401re.h"
#include "stm32f401re_gpio.h"
#include "err.h"
Include dependency graph for button.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  BUTTON_CFG_ts
 Configuration structure for initializing a button instance. More...

Typedefs

typedef struct button_handle_s BUTTON_HANDLE_ts
 Opaque handle representing a button instance.

Enumerations

enum  BUTTON_PUSHED_TYPE_te { BUTTON_PUSHED_TYPE_LOW , BUTTON_PUSHED_TYPE_HIGH }
 Defines the active level of a button press. More...

Functions

ERR_te button_init_subsys (void)
 Initializes the button subsystem.
ERR_te button_deinit_subsys (void)
 Deinitializes the button subsystem.
ERR_te button_start_subsys (void)
 Starts the button subsystem.
ERR_te button_stop_subsys (void)
 Stops the button subsystem.
ERR_te button_init_handle (BUTTON_CFG_ts *button_cfg, BUTTON_HANDLE_ts **button_handle)
 Initializes and registers a button handle.
ERR_te button_deinit_handle (BUTTON_HANDLE_ts const *button_handle)
 Deinitializes a button handle.
ERR_te button_run_handle (BUTTON_HANDLE_ts *button_handle)
 Executes the state machine for a single button.
ERR_te button_run_handle_all (void)
 Runs the state machine for all registered buttons.
ERR_te button_get_pushed_state (BUTTON_HANDLE_ts const *button_handle, bool *pushed_state_o)
 Retrieves the pushed (pressed) state of a button.
ERR_te button_get_held_state (BUTTON_HANDLE_ts const *button_handle, bool *held_state_o)
 Retrieves the held state of a button.

Detailed Description

Button module public API.

Author
github.com/Baksi675

This module provides functionality for handling physical button inputs, including:

  • Debouncing
  • Button press detection
  • Button hold detection

The module supports multiple button instances and integrates with the system's GPIO, logging, and command subsystems.

Typical usage:

Version
0.1
Date
2026-01-31

Definition in file button.h.