From 5b5dc4c8cab7a82b979a004683c68d180c1e6b8e Mon Sep 17 00:00:00 2001 From: laokaiyao Date: Tue, 20 Apr 2021 15:58:14 +0800 Subject: [PATCH] examples/i2c_tools: fixed the build error of i2ctools example on esp32c3 --- examples/peripherals/i2c/i2c_tools/README.md | 5 +---- .../peripherals/i2c/i2c_tools/main/cmd_i2ctools.c | 12 +----------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/examples/peripherals/i2c/i2c_tools/README.md b/examples/peripherals/i2c/i2c_tools/README.md index 070f2ff4a5..2fc7ee285c 100644 --- a/examples/peripherals/i2c/i2c_tools/README.md +++ b/examples/peripherals/i2c/i2c_tools/README.md @@ -1,6 +1,3 @@ -| Supported Targets | ESP32 | -| ----------------- | ----- | - # I2C Tools Example (See the README.md file in the upper level 'examples' directory for more information about examples.) @@ -65,7 +62,7 @@ See the [Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/l | | ============================================================== -esp32> help +i2c-tools> help help Print the list of registered commands diff --git a/examples/peripherals/i2c/i2c_tools/main/cmd_i2ctools.c b/examples/peripherals/i2c/i2c_tools/main/cmd_i2ctools.c index 5a2138a692..5a6148e3f1 100644 --- a/examples/peripherals/i2c/i2c_tools/main/cmd_i2ctools.c +++ b/examples/peripherals/i2c/i2c_tools/main/cmd_i2ctools.c @@ -34,17 +34,7 @@ static esp_err_t i2c_get_port(int port, i2c_port_t *i2c_port) ESP_LOGE(TAG, "Wrong port number: %d", port); return ESP_FAIL; } - switch (port) { - case 0: - *i2c_port = I2C_NUM_0; - break; - case 1: - *i2c_port = I2C_NUM_1; - break; - default: - *i2c_port = I2C_NUM_0; - break; - } + *i2c_port = port; return ESP_OK; }