mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-30 19:19:21 +00:00
sdm: correct concept duty to density
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -37,7 +37,7 @@ TEST_CASE("sdm_channel_install_uninstall", "[sdm]")
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("sdm_channel_set_duty", "[sdm]")
|
||||
TEST_CASE("sdm_channel_set_pulse_density", "[sdm]")
|
||||
{
|
||||
const int sdm_chan_gpios[2] = {0, 2};
|
||||
sdm_config_t config = {
|
||||
@@ -49,7 +49,7 @@ TEST_CASE("sdm_channel_set_duty", "[sdm]")
|
||||
config.gpio_num = sdm_chan_gpios[i];
|
||||
TEST_ESP_OK(sdm_new_channel(&config, &chans[i]));
|
||||
// should see a ~250KHz (sample_rate/4) square wave
|
||||
TEST_ESP_OK(sdm_channel_set_duty(chans[i], 0));
|
||||
TEST_ESP_OK(sdm_channel_set_pulse_density(chans[i], 0));
|
||||
TEST_ESP_OK(sdm_channel_enable(chans[i]));
|
||||
}
|
||||
vTaskDelay(pdMS_TO_TICKS(500));
|
||||
@@ -57,8 +57,8 @@ TEST_CASE("sdm_channel_set_duty", "[sdm]")
|
||||
// can't delete the channel if the channel is in the enable state
|
||||
TEST_ESP_ERR(ESP_ERR_INVALID_STATE, sdm_del_channel(chans[0]));
|
||||
|
||||
TEST_ESP_OK(sdm_channel_set_duty(chans[0], 127));
|
||||
TEST_ESP_OK(sdm_channel_set_duty(chans[1], -128));
|
||||
TEST_ESP_OK(sdm_channel_set_pulse_density(chans[0], 127));
|
||||
TEST_ESP_OK(sdm_channel_set_pulse_density(chans[1], -128));
|
||||
vTaskDelay(pdMS_TO_TICKS(500));
|
||||
|
||||
for (size_t i = 0; i < 2; i++) {
|
||||
|
Reference in New Issue
Block a user