[wip] controllers and display
This commit is contained in:
62
firmware/shared_libs/controllers/ctrl_channel_button.c
Normal file
62
firmware/shared_libs/controllers/ctrl_channel_button.c
Normal file
@@ -0,0 +1,62 @@
|
||||
#include "main.h"
|
||||
#include "config.h"
|
||||
#include "hw_button.h"
|
||||
#include "ctrl_button.h"
|
||||
#include "ctrl_channel_button.h"
|
||||
|
||||
static ButtonKey_t channel_buttons[BTN_CH_MAX];
|
||||
|
||||
void CTRL_channelButtonInit(void)
|
||||
{
|
||||
channel_buttons[BTN_CH_1].instance = BTN_CH_1;
|
||||
channel_buttons[BTN_CH_1].buttonPressed = CTRL_pushedChanBtnEvent;
|
||||
channel_buttons[BTN_CH_1].gpio_port = BTN1_GPIO_Port;
|
||||
channel_buttons[BTN_CH_1].gpio_pin = BTN1_Pin;
|
||||
channel_buttons[BTN_CH_1].pushed_state = GPIO_PIN_SET;
|
||||
|
||||
channel_buttons[BTN_CH_2].instance = BTN_CH_2;
|
||||
channel_buttons[BTN_CH_2].buttonPressed = CTRL_pushedChanBtnEvent;
|
||||
channel_buttons[BTN_CH_2].gpio_port = BTN2_GPIO_Port;
|
||||
channel_buttons[BTN_CH_2].gpio_pin = BTN2_Pin;
|
||||
channel_buttons[BTN_CH_2].pushed_state = GPIO_PIN_SET;
|
||||
|
||||
channel_buttons[BTN_CH_3].instance = BTN_CH_3;
|
||||
channel_buttons[BTN_CH_3].buttonPressed = CTRL_pushedChanBtnEvent;
|
||||
channel_buttons[BTN_CH_3].gpio_port = BTN3_GPIO_Port;
|
||||
channel_buttons[BTN_CH_3].gpio_pin = BTN3_Pin;
|
||||
channel_buttons[BTN_CH_3].pushed_state = GPIO_PIN_SET;
|
||||
|
||||
channel_buttons[BTN_CH_4].instance = BTN_CH_4;
|
||||
channel_buttons[BTN_CH_4].buttonPressed = CTRL_pushedChanBtnEvent;
|
||||
channel_buttons[BTN_CH_4].gpio_port = BTN4_GPIO_Port;
|
||||
channel_buttons[BTN_CH_4].gpio_pin = BTN4_Pin;
|
||||
channel_buttons[BTN_CH_4].pushed_state = GPIO_PIN_SET;
|
||||
|
||||
channel_buttons[BTN_CH_5].instance = BTN_CH_5;
|
||||
channel_buttons[BTN_CH_5].buttonPressed = CTRL_pushedChanBtnEvent;
|
||||
channel_buttons[BTN_CH_5].gpio_port = BTN5_GPIO_Port;
|
||||
channel_buttons[BTN_CH_5].gpio_pin = BTN5_Pin;
|
||||
channel_buttons[BTN_CH_5].pushed_state = GPIO_PIN_SET;
|
||||
|
||||
channel_buttons[BTN_CH_6].instance = BTN_CH_6;
|
||||
channel_buttons[BTN_CH_6].buttonPressed = CTRL_pushedChanBtnEvent;
|
||||
channel_buttons[BTN_CH_6].gpio_port = BTN5_GPIO_Port;
|
||||
channel_buttons[BTN_CH_6].gpio_pin = BTN5_Pin;
|
||||
channel_buttons[BTN_CH_6].pushed_state = GPIO_PIN_SET;
|
||||
|
||||
for (HW_chanBtnName_t btn_key = BTN_CH_1; btn_key < BTN_CH_MAX; btn_key++)
|
||||
{
|
||||
channel_buttons[btn_key].state = IDLE;
|
||||
channel_buttons[btn_key].timer_debounce = BTN_DEFAULT_DEBOUNCE_MS;
|
||||
channel_buttons[btn_key].timer_long_pressed = BTN_DEFAULT_LONGPRESSED_MS;
|
||||
channel_buttons[btn_key].timer_repeat_delay = BTN_DEFAULT_REPEAT_MS;
|
||||
}
|
||||
}
|
||||
|
||||
void CTRL_channelButtonsHandler(void)
|
||||
{
|
||||
for (HW_chanBtnName_t btn_key = BTN_CH_1; btn_key < BTN_CH_MAX; btn_key++)
|
||||
{
|
||||
buttonHandler(&channel_buttons[btn_key]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user