added btn press up event
This commit is contained in:
@@ -29,7 +29,7 @@ void button_event_cb(void *arg, void *data)
|
||||
|
||||
void initialize_buttons(){
|
||||
const button_config_t btn_cfg = {0};
|
||||
button_handle_t btns[5];
|
||||
button_handle_t btns[10];
|
||||
|
||||
for (size_t i = 0; i < sizeof(actions) / sizeof(actions[0]); i++)
|
||||
{
|
||||
@@ -39,5 +39,6 @@ void initialize_buttons(){
|
||||
};
|
||||
ESP_RETURN_VOID_ON_ERROR(iot_button_new_gpio_device(&btn_cfg, &btn_gpio_cfg, &btns[i]), TAG, "");
|
||||
iot_button_register_cb(btns[i], BUTTON_PRESS_DOWN, NULL, button_event_cb, (void *) &actions[i]);
|
||||
iot_button_register_cb(btns[i], BUTTON_PRESS_UP, NULL, button_event_cb, (void *) &actions[i]);
|
||||
}
|
||||
}
|
||||
@@ -20,8 +20,7 @@ typedef struct
|
||||
buttonAction btnAcc;
|
||||
const char* name;
|
||||
char shortcut;
|
||||
int pin;
|
||||
|
||||
int pin;
|
||||
}action;
|
||||
|
||||
void button_event_cb(void *arg, void *data);
|
||||
|
||||
Reference in New Issue
Block a user