Skip to content

Commit e89dc28

Browse files
committed
test(mcpwm): add multi input banding to the same pin test
Closes #14958
1 parent 45a9a31 commit e89dc28

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

components/esp_driver_mcpwm/test_apps/mcpwm/main/test_mcpwm_cap.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -73,7 +73,7 @@ TEST_CASE("mcpwm_capture_ext_gpio", "[mcpwm]")
7373
printf("init a gpio to simulate the external capture signal\r\n");
7474
const int cap_gpio = TEST_CAP_GPIO;
7575
gpio_config_t ext_gpio_conf = {
76-
.mode = GPIO_MODE_OUTPUT,
76+
.mode = GPIO_MODE_INPUT_OUTPUT,
7777
.pin_bit_mask = BIT(cap_gpio),
7878
};
7979
TEST_ESP_OK(gpio_config(&ext_gpio_conf));
@@ -110,6 +110,12 @@ TEST_CASE("mcpwm_capture_ext_gpio", "[mcpwm]")
110110
printf("enable capture channel\r\n");
111111
TEST_ESP_OK(mcpwm_capture_channel_enable(pps_channel));
112112

113+
printf("check input function before starting capture\r\n");
114+
gpio_set_level(cap_gpio, 1);
115+
TEST_ASSERT_EQUAL(1, gpio_get_level(cap_gpio));
116+
gpio_set_level(cap_gpio, 0);
117+
TEST_ASSERT_EQUAL(0, gpio_get_level(cap_gpio));
118+
113119
printf("enable and start capture timer\r\n");
114120
TEST_ESP_OK(mcpwm_capture_timer_enable(cap_timer));
115121
TEST_ESP_OK(mcpwm_capture_timer_start(cap_timer));
@@ -131,6 +137,13 @@ TEST_CASE("mcpwm_capture_ext_gpio", "[mcpwm]")
131137
TEST_ESP_OK(mcpwm_del_capture_channel(pps_channel));
132138
TEST_ESP_OK(mcpwm_capture_timer_disable(cap_timer));
133139
TEST_ESP_OK(mcpwm_del_capture_timer(cap_timer));
140+
141+
printf("check input function after removing capture\r\n");
142+
gpio_set_level(cap_gpio, 1);
143+
TEST_ASSERT_EQUAL(1, gpio_get_level(cap_gpio));
144+
gpio_set_level(cap_gpio, 0);
145+
TEST_ASSERT_EQUAL(0, gpio_get_level(cap_gpio));
146+
134147
TEST_ESP_OK(gpio_reset_pin(cap_gpio));
135148
}
136149

0 commit comments

Comments
 (0)