#include "main.h" #include "hw_button.h" // #include "ctrl_app.h" #include "ctrl_bottom_button.h" static ButtonKey_t bottom_buttons[BTN_BOT_MAX]; void CTRL_bottomButtonInit(void) { bottom_buttons[BTN_BOT_1].instance = BTN_BOT_1; bottom_buttons[BTN_BOT_1].buttonPressed = CTRL_pushedDispBtnEvent; bottom_buttons[BTN_BOT_1].gpio_port = BTN1_GPIO_Port; bottom_buttons[BTN_BOT_1].gpio_pin = BTN1_Pin; bottom_buttons[BTN_BOT_1].pushed_state = GPIO_PIN_RESET; bottom_buttons[BTN_BOT_2].instance = BTN_BOT_2; bottom_buttons[BTN_BOT_2].buttonPressed = CTRL_pushedDispBtnEvent; bottom_buttons[BTN_BOT_2].gpio_port = BTN2_GPIO_Port; bottom_buttons[BTN_BOT_2].gpio_pin = BTN2_Pin; bottom_buttons[BTN_BOT_2].pushed_state = GPIO_PIN_RESET; bottom_buttons[BTN_BOT_3].instance = BTN_BOT_3; bottom_buttons[BTN_BOT_3].buttonPressed = CTRL_pushedDispBtnEvent; bottom_buttons[BTN_BOT_3].gpio_port = BTN3_GPIO_Port; bottom_buttons[BTN_BOT_3].gpio_pin = BTN3_Pin; bottom_buttons[BTN_BOT_3].pushed_state = GPIO_PIN_RESET; bottom_buttons[BTN_BOT_4].instance = BTN_BOT_4; bottom_buttons[BTN_BOT_4].buttonPressed = CTRL_pushedDispBtnEvent; bottom_buttons[BTN_BOT_4].gpio_port = BTN4_GPIO_Port; bottom_buttons[BTN_BOT_4].gpio_pin = BTN4_Pin; bottom_buttons[BTN_BOT_4].pushed_state = GPIO_PIN_RESET; bottom_buttons[BTN_BOT_5].instance = BTN_BOT_5; bottom_buttons[BTN_BOT_5].buttonPressed = CTRL_pushedDispBtnEvent; bottom_buttons[BTN_BOT_5].gpio_port = BTN5_GPIO_Port; bottom_buttons[BTN_BOT_5].gpio_pin = BTN5_Pin; bottom_buttons[BTN_BOT_5].pushed_state = GPIO_PIN_RESET; for (HW_BotBtnName_t btn_key = BTN_BOT_1; btn_key < BTN_BOT_MAX; btn_key++) { bottom_buttons[btn_key].state = IDLE; bottom_buttons[btn_key].timer_debounce = BTN_DEFAULT_DEBOUNCE_MS; bottom_buttons[btn_key].timer_long_pressed = BTN_DEFAULT_LONGPRESSED_MS; bottom_buttons[btn_key].timer_repeat_delay = BTN_DEFAULT_REPEAT_MS; } } void CTRL_bottomButtonsHandler(void) { for (HW_BotBtnName_t btn_key = BTN_BOT_1; btn_key < BTN_BOT_MAX; btn_key++) { buttonHandler(&bottom_buttons[btn_key]); } } __weak void CTRL_pushedDispBtnEvent(ButtonKey_t *key) { UNUSED(key); }