ICARUS OS (Intelligent Cooperative Architecture for Real-time Unified Systems)
0.1.0
Preemptive Real-Time Operating System for ARM Cortex-M7
Loading...
Searching...
No Matches
button.c
Go to the documentation of this file.
1
21
#include "
bsp/button.h
"
22
23
#ifndef HOST_TEST
24
25
#include "
bsp/config.h
"
26
#include "stm32h7xx_hal.h"
27
28
bool
Button_IsPressed
(
void
) {
29
return
HAL_GPIO_ReadPin(
BSP_KEY_PORT
,
BSP_KEY_PIN
) == GPIO_PIN_RESET;
30
}
31
32
#else
/* HOST_TEST — software model */
33
34
static
bool
g_button_pressed;
35
36
bool
Button_IsPressed
(
void
) {
37
return
g_button_pressed;
38
}
39
40
/* ---- Test-only host hooks ---------------------------------------------- */
41
42
void
__button_host_set_pressed(
bool
pressed) {
43
g_button_pressed = pressed;
44
}
45
46
void
__button_host_reset_state(
void
) {
47
g_button_pressed =
false
;
48
}
49
50
#endif
/* HOST_TEST */
config.h
Button_IsPressed
bool Button_IsPressed(void)
Read the K1 user button state.
Definition
button.c:28
button.h
BSP_KEY_PIN
#define BSP_KEY_PIN
Definition
config.h:90
BSP_KEY_PORT
#define BSP_KEY_PORT
Definition
config.h:91
Core
Src
bsp
button.c
Generated on Fri Apr 17 2026 13:48:31 for ICARUS OS (Intelligent Cooperative Architecture for Real-time Unified Systems) by
1.9.8