Skip to content

Commit

Permalink
Merge branch 'feature/expose_rmt_channel_id' into 'master'
Browse files Browse the repository at this point in the history
rmt: expose private API to get channel ID

Closes IDFGH-9206, IDF-6846, IDF-6810, and IDF-6783

See merge request espressif/esp-idf!22384
  • Loading branch information
suda-morris committed Feb 16, 2023
2 parents 31b7f8f + 195f6b9 commit 4a604be
Show file tree
Hide file tree
Showing 14 changed files with 52 additions and 32 deletions.
10 changes: 1 addition & 9 deletions components/driver/.build-test-rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ components/driver/test_apps/legacy_mcpwm_driver:
disable_test:
- if: IDF_TARGET in ["esp32h2"]
temporary: true
reason: cannot pass test, IDF-6812
reason: default group resolution changed, IDF-6812

components/driver/test_apps/legacy_pcnt_driver:
disable:
Expand All @@ -78,10 +78,6 @@ components/driver/test_apps/legacy_timer_driver:
components/driver/test_apps/mcpwm:
disable:
- if: SOC_MCPWM_SUPPORTED != 1
disable_test:
- if: IDF_TARGET in ["esp32h2"]
temporary: true
reason: cannot pass test, IDF-6812

components/driver/test_apps/pulse_cnt:
disable:
Expand All @@ -90,10 +86,6 @@ components/driver/test_apps/pulse_cnt:
components/driver/test_apps/rmt:
disable:
- if: SOC_RMT_SUPPORTED != 1
disable_test:
- if: IDF_TARGET in ["esp32h2"]
temporary: true
reason: cannot pass test, IDF-6810

components/driver/test_apps/rs485:
disable_test:
Expand Down
33 changes: 33 additions & 0 deletions components/driver/include/esp_private/rmt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/

// DO NOT USE THESE APIS IN YOUR APPLICATIONS
// The following APIs are for internal test.

#pragma once

#include "esp_err.h"
#include "driver/rmt_types.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief Get the unique ID of RMT channel
*
* @param[in] channel RMT generic channel that created by `rmt_new_tx_channel()` or `rmt_new_rx_channel()`
* @param[out] ret_id The unique ID of RMT channel
* @return
* - ESP_OK: Get RMT channel ID successfully
* - ESP_ERR_INVALID_ARG: Get RMT channel ID failed because of invalid argument
* - ESP_FAIL: Get RMT channel ID failed because of other reasons
*/
esp_err_t rmt_get_channel_id(rmt_channel_handle_t channel, int *ret_id);

#ifdef __cplusplus
}
#endif
7 changes: 7 additions & 0 deletions components/driver/rmt/rmt_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,13 @@ esp_err_t rmt_select_periph_clock(rmt_channel_handle_t chan, rmt_clock_source_t
return ret;
}

esp_err_t rmt_get_channel_id(rmt_channel_handle_t channel, int *ret_id)
{
ESP_RETURN_ON_FALSE(channel && ret_id, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
*ret_id = channel->channel_id;
return ESP_OK;
}

esp_err_t rmt_apply_carrier(rmt_channel_handle_t channel, const rmt_carrier_config_t *config)
{
// specially, we allow config to be NULL, means to disable the carrier submodule
Expand Down
2 changes: 1 addition & 1 deletion components/driver/test_apps/mcpwm/pytest_mcpwm.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@pytest.mark.esp32
@pytest.mark.esp32s3
@pytest.mark.esp32c6
# @pytest.mark.esp32h2 # IDF-6812
@pytest.mark.esp32h2
@pytest.mark.generic
@pytest.mark.parametrize(
'config',
Expand Down
2 changes: 1 addition & 1 deletion components/driver/test_apps/mcpwm/sdkconfig.defaults
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
CONFIG_FREERTOS_HZ=1000
CONFIG_ESP_TASK_WDT=n
CONFIG_ESP_TASK_WDT_INIT=n
2 changes: 1 addition & 1 deletion components/driver/test_apps/rmt/main/test_rmt_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ static void test_rmt_multi_channels_trans(size_t channel0_mem_block_symbols, siz
{
#define TEST_RMT_CHANS 2
#define TEST_LED_NUM 1
#define TEST_STOP_TIME_NO_SYNCHRO_DELTA 250
#define TEST_STOP_TIME_NO_SYNCHRO_DELTA 300
#define TEST_STOP_TIME_SYNCHRO_DELTA 60
rmt_tx_channel_config_t tx_channel_cfg = {
.clk_src = RMT_CLK_SRC_DEFAULT,
Expand Down
2 changes: 1 addition & 1 deletion components/driver/test_apps/rmt/pytest_rmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@pytest.mark.esp32s3
@pytest.mark.esp32c3
@pytest.mark.esp32c6
# @pytest.mark.esp32h2 IDF-6810
@pytest.mark.esp32h2
@pytest.mark.generic
@pytest.mark.parametrize(
'config',
Expand Down
2 changes: 1 addition & 1 deletion components/esp_system/port/soc/esp32h2/Kconfig.cpu
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
choice ESP_DEFAULT_CPU_FREQ_MHZ
prompt "CPU frequency"
default ESP_DEFAULT_CPU_FREQ_MHZ_64 if IDF_ENV_FPGA
default ESP_DEFAULT_CPU_FREQ_MHZ_32 if IDF_ENV_FPGA
default ESP_DEFAULT_CPU_FREQ_MHZ_96
help
CPU frequency to be set on application startup.
Expand Down
2 changes: 0 additions & 2 deletions components/esp_system/test/test_delay.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ static void test_delay_task(void *p)
vTaskDelete(NULL);
}

#if !CONFIG_IDF_TARGET_ESP32H2 // IDF-6783
TEST_CASE("esp_rom_delay_us produces correct delay on CPUs", "[delay]")
{
int delay_ms = 50;
Expand All @@ -61,7 +60,6 @@ TEST_CASE("esp_rom_delay_us produces correct delay on CPUs", "[delay]")
ref_clock_deinit();
vSemaphoreDelete(args.done);
}
#endif

TEST_CASE("vTaskDelay produces correct delay on CPUs", "[delay]")
{
Expand Down
9 changes: 0 additions & 9 deletions examples/peripherals/.build-test-rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,6 @@ examples/peripherals/rmt/onewire_ds18b20:
examples/peripherals/rmt/stepper_motor:
disable:
- if: SOC_RMT_SUPPORT_TX_LOOP_AUTO_STOP != 1
- if: IDF_TARGET == "esp32h2"
temporary: true
reason: wrong GPIO on esp32h2

examples/peripherals/sdio/host:
enable:
Expand Down Expand Up @@ -213,12 +210,6 @@ examples/peripherals/timer_group:
disable:
- if: SOC_GPTIMER_SUPPORTED != 1

examples/peripherals/timer_group/gptimer:
disable_test:
- if: IDF_TARGET in ["esp32h2"]
temporary: true
reason: cannot pass target test IDF-6846

examples/peripherals/timer_group/gptimer_capture_hc_sr04:
disable:
- if: SOC_TIMER_SUPPORT_ETM != 1
Expand Down
4 changes: 2 additions & 2 deletions examples/peripherals/rmt/stepper_motor/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
| Supported Targets | ESP32-C6 | ESP32-S3 |
| ----------------- | -------- | -------- |
| Supported Targets | ESP32-C6 | ESP32-H2 | ESP32-S3 |
| ----------------- | -------- | -------- | -------- |

# RMT Based Stepper Motor Smooth Controller

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#include "stepper_motor_encoder.h"

///////////////////////////////Change the following configurations according to your board//////////////////////////////
#define STEP_MOTOR_GPIO_EN 19
#define STEP_MOTOR_GPIO_DIR 20
#define STEP_MOTOR_GPIO_STEP 18
#define STEP_MOTOR_GPIO_EN 0
#define STEP_MOTOR_GPIO_DIR 2
#define STEP_MOTOR_GPIO_STEP 4
#define STEP_MOTOR_ENABLE_LEVEL 0 // DRV8825 is enabled on low level
#define STEP_MOTOR_SPIN_DIR_CLOCKWISE 0
#define STEP_MOTOR_SPIN_DIR_COUNTERCLOCKWISE !STEP_MOTOR_SPIN_DIR_CLOCKWISE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

@pytest.mark.esp32s3
@pytest.mark.esp32c6
# @pytest.mark.esp32h2 IDF-6808
@pytest.mark.esp32h2
@pytest.mark.generic
def test_stepper_motor_example(dut: Dut) -> None:
dut.expect_exact('example: Initialize EN + DIR GPIO')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


@pytest.mark.supported_targets
@pytest.mark.temp_skip_ci(targets=['esp32h2'], reason='test failed') # IDF-6846
@pytest.mark.generic
def test_gptimer_example(dut: Dut) -> None:
dut.expect_exact('Create timer handle', timeout=5)
Expand Down

0 comments on commit 4a604be

Please sign in to comment.