From 0cfed0b79b4bfcb40437ba56ecf4865400cf2bd4 Mon Sep 17 00:00:00 2001 From: houchenyao Date: Thu, 6 Sep 2018 12:01:47 +0800 Subject: [PATCH] rmt test: add the case for bug in github[#1815] --- components/driver/test/test_rmt.c | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/components/driver/test/test_rmt.c b/components/driver/test/test_rmt.c index 8ac5cbbe7..57c2247af 100644 --- a/components/driver/test/test_rmt.c +++ b/components/driver/test/test_rmt.c @@ -767,4 +767,41 @@ TEST_CASE("RMT loop_en test", "[rmt][test_env=UT_T1_RMT][ignore]") TEST_ESP_OK(rmt_driver_uninstall(RMT_RX_CHANNEL)); } +TEST_CASE("RMT use multi channel", "[rmt][test_env=UT_T1_RMT]") +{ + rmt_tx_config_t tx_cfg = { + .loop_en = true, // set it as true + .carrier_duty_percent = 50, + .carrier_freq_hz = 38000, + .carrier_level = 1, + .carrier_en = RMT_TX_CARRIER_EN, + .idle_level = 0, + .idle_output_en = true, + }; + rmt_config_t rmt_tx1 = { + .channel = RMT_TX_CHANNEL, + .gpio_num = RMT_TX_GPIO_NUM, + .mem_block_num = 4, + .clk_div = RMT_CLK_DIV, + .tx_config = tx_cfg, + .rmt_mode = 0, + }; + rmt_config(&rmt_tx1); + rmt_driver_install(rmt_tx1.channel, 0, 0); + + rmt_config_t rmt_tx2 = rmt_tx1; + rmt_tx2.channel = 2; + rmt_config(&rmt_tx2); + rmt_driver_install(rmt_tx2.channel, 0, 0); + + rmt_config_t rmt_tx3 = rmt_tx1; + rmt_tx3.channel = 7; + rmt_tx3.mem_block_num = 1; + rmt_config(&rmt_tx3); + rmt_driver_install(rmt_tx3.channel, 0, 0); + + TEST_ESP_OK(rmt_driver_uninstall(RMT_TX_CHANNEL)); + TEST_ESP_OK(rmt_driver_uninstall(2)); + TEST_ESP_OK(rmt_driver_uninstall(7)); +}