mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
fix(ana_cmpr): fix the crash of the etm example
This commit is contained in:
parent
dc86c17b38
commit
5e2c83332f
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
@ -30,17 +30,13 @@ static void example_etm_bind_ana_cmpr_event_with_gpio_task(ana_cmpr_handle_t cmp
|
||||
ESP_ERROR_CHECK(ana_cmpr_new_etm_event(cmpr, &evt_cfg, &cmpr_neg_evt));
|
||||
|
||||
/* Allocate the GPIO set & clear tasks */
|
||||
esp_etm_task_handle_t gpio_pos_task = NULL;
|
||||
esp_etm_task_handle_t gpio_neg_task = NULL;
|
||||
esp_etm_task_handle_t gpio_toggle_task = NULL;
|
||||
gpio_etm_task_config_t task_cfg = {
|
||||
.action = GPIO_ETM_TASK_ACTION_SET,
|
||||
.action = GPIO_ETM_TASK_ACTION_TOG,
|
||||
};
|
||||
ESP_ERROR_CHECK(gpio_new_etm_task(&task_cfg, &gpio_pos_task));
|
||||
task_cfg.action = GPIO_ETM_TASK_ACTION_CLR;
|
||||
ESP_ERROR_CHECK(gpio_new_etm_task(&task_cfg, &gpio_neg_task));
|
||||
ESP_ERROR_CHECK(gpio_new_etm_task(&task_cfg, &gpio_toggle_task));
|
||||
/* Add task to the monitor GPIO */
|
||||
ESP_ERROR_CHECK(gpio_etm_task_add_gpio(gpio_pos_task, EXAMPLE_MONITOR_GPIO_NUM));
|
||||
ESP_ERROR_CHECK(gpio_etm_task_add_gpio(gpio_neg_task, EXAMPLE_MONITOR_GPIO_NUM));
|
||||
ESP_ERROR_CHECK(gpio_etm_task_add_gpio(gpio_toggle_task, EXAMPLE_MONITOR_GPIO_NUM));
|
||||
|
||||
/* Allocate the Event Task Matrix channels */
|
||||
esp_etm_channel_handle_t etm_pos_handle;
|
||||
@ -49,8 +45,8 @@ static void example_etm_bind_ana_cmpr_event_with_gpio_task(ana_cmpr_handle_t cmp
|
||||
ESP_ERROR_CHECK(esp_etm_new_channel(&etm_cfg, &etm_pos_handle));
|
||||
ESP_ERROR_CHECK(esp_etm_new_channel(&etm_cfg, &etm_neg_handle));
|
||||
/* Bind the events and tasks */
|
||||
ESP_ERROR_CHECK(esp_etm_channel_connect(etm_pos_handle, cmpr_pos_evt, gpio_pos_task));
|
||||
ESP_ERROR_CHECK(esp_etm_channel_connect(etm_neg_handle, cmpr_neg_evt, gpio_neg_task));
|
||||
ESP_ERROR_CHECK(esp_etm_channel_connect(etm_pos_handle, cmpr_pos_evt, gpio_toggle_task));
|
||||
ESP_ERROR_CHECK(esp_etm_channel_connect(etm_neg_handle, cmpr_neg_evt, gpio_toggle_task));
|
||||
/* Enable the ETM channels */
|
||||
ESP_ERROR_CHECK(esp_etm_channel_enable(etm_pos_handle));
|
||||
ESP_ERROR_CHECK(esp_etm_channel_enable(etm_neg_handle));
|
||||
|
Loading…
Reference in New Issue
Block a user