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
28bool 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
34static bool g_button_pressed;
35
36bool Button_IsPressed(void) {
37 return g_button_pressed;
38}
39
40/* ---- Test-only host hooks ---------------------------------------------- */
41
42void __button_host_set_pressed(bool pressed) {
43 g_button_pressed = pressed;
44}
45
46void __button_host_reset_state(void) {
47 g_button_pressed = false;
48}
49
50#endif /* HOST_TEST */
bool Button_IsPressed(void)
Read the K1 user button state.
Definition button.c:28
#define BSP_KEY_PIN
Definition config.h:90
#define BSP_KEY_PORT
Definition config.h:91