GPS Device
Loading...
Searching...
No Matches
button.h
Go to the documentation of this file.
1
27
33
34#ifndef BUTTON_H_
35#define BUTTON_H_
36
37#include <stdint.h>
38
39#include "io.h"
40#include "stm32f401re.h"
41#include "stm32f401re_gpio.h"
42#include "err.h"
43
50
67
75typedef struct {
76
78 char name[CONFIG_BUTTON_MAX_NAME_LEN];
79
82
85
92
95
97 uint32_t held_limit_ms;
98
100
111
113
120
138
156
172
187
209ERR_te button_init_handle(BUTTON_CFG_ts *button_cfg, BUTTON_HANDLE_ts **button_handle);
210
227ERR_te button_deinit_handle(BUTTON_HANDLE_ts const *button_handle);
228
247
259
272ERR_te button_get_pushed_state(BUTTON_HANDLE_ts const *button_handle, bool *pushed_state_o);
273
286ERR_te button_get_held_state(BUTTON_HANDLE_ts const *button_handle, bool *held_state_o);
287
289
290#endif
291
System-wide error code definitions.
ERR_te button_init_subsys(void)
Initializes the button subsystem.
Definition button.c:159
ERR_te button_run_handle_all(void)
Runs the state machine for all registered buttons.
Definition button.c:502
ERR_te button_deinit_handle(BUTTON_HANDLE_ts const *button_handle)
Deinitializes a button handle.
Definition button.c:347
ERR_te button_stop_subsys(void)
Stops the button subsystem.
Definition button.c:245
ERR_te button_get_pushed_state(BUTTON_HANDLE_ts const *button_handle, bool *pushed_state_o)
Retrieves the pushed (pressed) state of a button.
Definition button.c:516
ERR_te button_init_handle(BUTTON_CFG_ts *button_cfg, BUTTON_HANDLE_ts **button_handle)
Initializes and registers a button handle.
Definition button.c:269
ERR_te button_get_held_state(BUTTON_HANDLE_ts const *button_handle, bool *held_state_o)
Retrieves the held state of a button.
Definition button.c:533
ERR_te button_run_handle(BUTTON_HANDLE_ts *button_handle)
Executes the state machine for a single button.
Definition button.c:402
ERR_te button_start_subsys(void)
Starts the button subsystem.
Definition button.c:221
ERR_te button_deinit_subsys(void)
Deinitializes the button subsystem.
Definition button.c:196
BUTTON_PUSHED_TYPE_te
Defines the active level of a button press.
Definition button.h:58
struct button_handle_s BUTTON_HANDLE_ts
Opaque handle representing a button instance.
Definition button.h:110
@ BUTTON_PUSHED_TYPE_HIGH
Definition button.h:64
@ BUTTON_PUSHED_TYPE_LOW
Definition button.h:61
ERR_te
Standard return type used by all public API functions.
Definition err.h:35
GPIO_PIN_te
GPIO pin number within a port (0–15).
Digital IO module public API.
STM32F401RE MCU-specific peripheral register definitions and bit position enumerations.
STM32F401RE GPIO driver public API.
Configuration structure for initializing a button instance.
Definition button.h:75
uint32_t debounce_limit_ms
Definition button.h:94
uint32_t held_limit_ms
Definition button.h:97
char name[CONFIG_BUTTON_MAX_NAME_LEN]
Definition button.h:78
GPIO_PIN_te gpio_pin
Definition button.h:84
GPIO_REGDEF_ts * gpio_port
Definition button.h:81
BUTTON_PUSHED_TYPE_te pushed_type
Definition button.h:91
GPIO peripheral register map.
Definition stm32f401re.h:95
Internal structure representing a single button instance.
Definition button.c:34