Updated button idf_component to 2.3.0

This commit is contained in:
Rohit Jadhav
2022-11-25 14:54:45 +05:30
parent 65da485411
commit 54741bea51
8 changed files with 50 additions and 19 deletions
+4 -4
View File
@@ -17,7 +17,7 @@
static const char *TAG = "app_reset";
static bool perform_factory_reset = false;
static void button_factory_reset_pressed_cb(void *arg)
static void button_factory_reset_pressed_cb(void *arg, void *data)
{
if (!perform_factory_reset) {
ESP_LOGI(TAG, "Factory reset triggered. Release the button to start factory reset.");
@@ -25,7 +25,7 @@ static void button_factory_reset_pressed_cb(void *arg)
}
}
static void button_factory_reset_released_cb(void *arg)
static void button_factory_reset_released_cb(void *arg, void *data)
{
if (perform_factory_reset) {
ESP_LOGI(TAG, "Starting factory reset");
@@ -42,7 +42,7 @@ esp_err_t app_reset_button_register(void *handle)
}
button_handle_t button_handle = (button_handle_t)handle;
esp_err_t err = ESP_OK;
err |= iot_button_register_cb(button_handle, BUTTON_LONG_PRESS_HOLD, button_factory_reset_pressed_cb);
err |= iot_button_register_cb(button_handle, BUTTON_PRESS_UP, button_factory_reset_released_cb);
err |= iot_button_register_cb(button_handle, BUTTON_LONG_PRESS_HOLD, button_factory_reset_pressed_cb, NULL);
err |= iot_button_register_cb(button_handle, BUTTON_PRESS_UP, button_factory_reset_released_cb, NULL);
return err;
}
+2 -2
View File
@@ -52,7 +52,7 @@ static esp_err_t app_driver_light_set_temperature(led_driver_handle_t handle, es
return led_driver_set_temperature(handle, value);
}
static void app_driver_button_toggle_cb(void *arg)
static void app_driver_button_toggle_cb(void *arg, void *data)
{
ESP_LOGI(TAG, "Toggle button pressed");
uint16_t endpoint_id = light_endpoint_id;
@@ -158,6 +158,6 @@ app_driver_handle_t app_driver_button_init()
/* Initialize button */
button_config_t config = button_driver_get_config();
button_handle_t handle = iot_button_create(&config);
iot_button_register_cb(handle, BUTTON_PRESS_DOWN, app_driver_button_toggle_cb);
iot_button_register_cb(handle, BUTTON_PRESS_DOWN, app_driver_button_toggle_cb, NULL);
return (app_driver_handle_t)handle;
}
+2 -2
View File
@@ -563,7 +563,7 @@ void app_driver_client_group_command_callback(uint8_t fabric_index, client::comm
}
}
static void app_driver_button_toggle_cb(void *arg)
static void app_driver_button_toggle_cb(void *arg, void *data)
{
ESP_LOGI(TAG, "Toggle button pressed");
client::command_handle_t cmd_handle;
@@ -581,7 +581,7 @@ app_driver_handle_t app_driver_switch_init()
/* Initialize button */
button_config_t config = button_driver_get_config();
button_handle_t handle = iot_button_create(&config);
iot_button_register_cb(handle, BUTTON_PRESS_DOWN, app_driver_button_toggle_cb);
iot_button_register_cb(handle, BUTTON_PRESS_DOWN, app_driver_button_toggle_cb, NULL);
/* Other initializations */
#if CONFIG_ENABLE_CHIP_SHELL
+2 -2
View File
@@ -54,7 +54,7 @@ static esp_err_t app_driver_light_set_temperature(led_driver_handle_t handle, es
return led_driver_set_temperature(handle, value);
}
static void app_driver_button_toggle_cb(void *arg)
static void app_driver_button_toggle_cb(void *arg, void *data)
{
ESP_LOGI(TAG, "Toggle button pressed");
uint16_t endpoint_id = light_endpoint_id;
@@ -163,6 +163,6 @@ app_driver_handle_t app_driver_button_init()
/* Initialize button */
button_config_t config = button_driver_get_config();
button_handle_t handle = iot_button_create(&config);
iot_button_register_cb(handle, BUTTON_PRESS_DOWN, app_driver_button_toggle_cb);
iot_button_register_cb(handle, BUTTON_PRESS_DOWN, app_driver_button_toggle_cb, NULL);
return (app_driver_handle_t)handle;
}