From f406d020d8ab4695f66afeb08b9a99e82383c4ad Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 21 Aug 2019 12:31:44 +1000 Subject: [PATCH] driver: Remove features deprecated pre-IDF V4.0 --- components/driver/i2s.c | 50 ---------------- components/driver/include/driver/adc.h | 14 ----- components/driver/include/driver/dac.h | 19 ------ components/driver/include/driver/i2s.h | 60 ------------------- components/driver/include/driver/ledc.h | 5 +- components/driver/include/driver/touch_pad.h | 15 ----- components/driver/rtc_module.c | 40 ------------- components/driver/test/test_ledc.c | 8 +-- .../internal_communication/main/mesh_light.c | 2 +- .../mesh/manual_networking/main/mesh_light.c | 2 +- 10 files changed, 7 insertions(+), 208 deletions(-) diff --git a/components/driver/i2s.c b/components/driver/i2s.c index 10a38b15ba..2d2046e1b9 100644 --- a/components/driver/i2s.c +++ b/components/driver/i2s.c @@ -1180,18 +1180,6 @@ esp_err_t i2s_driver_uninstall(i2s_port_t i2s_num) return ESP_OK; } -int i2s_write_bytes(i2s_port_t i2s_num, const void *src, size_t size, TickType_t ticks_to_wait) -{ - size_t bytes_written = 0; - int res = 0; - res = i2s_write(i2s_num, src, size, &bytes_written, ticks_to_wait); - if (res != ESP_OK) { - return ESP_FAIL; - } else { - return bytes_written; - } -} - esp_err_t i2s_write(i2s_port_t i2s_num, const void *src, size_t size, size_t *bytes_written, TickType_t ticks_to_wait) { char *data_ptr, *src_byte; @@ -1317,18 +1305,6 @@ esp_err_t i2s_write_expand(i2s_port_t i2s_num, const void *src, size_t size, siz return ESP_OK; } -int i2s_read_bytes(i2s_port_t i2s_num, void *dest, size_t size, TickType_t ticks_to_wait) -{ - size_t bytes_read = 0; - int res = 0; - res = i2s_read(i2s_num, dest, size, &bytes_read, ticks_to_wait); - if (res != ESP_OK) { - return ESP_FAIL; - } else { - return bytes_read; - } -} - esp_err_t i2s_read(i2s_port_t i2s_num, void *dest, size_t size, size_t *bytes_read, TickType_t ticks_to_wait) { char *data_ptr, *dest_byte; @@ -1367,29 +1343,3 @@ esp_err_t i2s_read(i2s_port_t i2s_num, void *dest, size_t size, size_t *bytes_re xSemaphoreGive(p_i2s_obj[i2s_num]->rx->mux); return ESP_OK; } - -int i2s_push_sample(i2s_port_t i2s_num, const void *sample, TickType_t ticks_to_wait) -{ - size_t bytes_push = 0; - int res = 0; - I2S_CHECK((i2s_num < I2S_NUM_MAX), "i2s_num error", ESP_FAIL); - res = i2s_write(i2s_num, sample, p_i2s_obj[i2s_num]->bytes_per_sample, &bytes_push, ticks_to_wait); - if (res != ESP_OK) { - return ESP_FAIL; - } else { - return bytes_push; - } -} - -int i2s_pop_sample(i2s_port_t i2s_num, void *sample, TickType_t ticks_to_wait) -{ - size_t bytes_pop = 0; - int res = 0; - I2S_CHECK((i2s_num < I2S_NUM_MAX), "i2s_num error", ESP_FAIL); - res = i2s_read(i2s_num, sample, p_i2s_obj[i2s_num]->bytes_per_sample, &bytes_pop, ticks_to_wait); - if (res != ESP_OK) { - return ESP_FAIL; - } else { - return bytes_pop; - } -} diff --git a/components/driver/include/driver/adc.h b/components/driver/include/driver/adc.h index df166b1c8d..520970d79f 100644 --- a/components/driver/include/driver/adc.h +++ b/components/driver/include/driver/adc.h @@ -212,20 +212,6 @@ esp_err_t adc1_config_channel_atten(adc1_channel_t channel, adc_atten_t atten); */ int adc1_get_raw(adc1_channel_t channel); -/** @cond */ //Doxygen command to hide deprecated function from API Reference -/* - * @note When the power switch of SARADC1, SARADC2, HALL sensor and AMP sensor is turned on, - * the input of GPIO36 and GPIO39 will be pulled down for about 80ns. - * When enabling power for any of these peripherals, ignore input from GPIO36 and GPIO39. - * Please refer to section 3.11 of 'ECO_and_Workarounds_for_Bugs_in_ESP32' for the description of this issue. - * - * @deprecated This function returns an ADC1 reading but is deprecated due to - * a misleading name and has been changed to directly call the new function. - * Use the new function adc1_get_raw() instead - */ -int adc1_get_voltage(adc1_channel_t channel) __attribute__((deprecated)); -/** @endcond */ - /** * @brief Enable ADC power */ diff --git a/components/driver/include/driver/dac.h b/components/driver/include/driver/dac.h index 5ed96e201f..d153230bde 100644 --- a/components/driver/include/driver/dac.h +++ b/components/driver/include/driver/dac.h @@ -42,25 +42,6 @@ typedef enum { */ esp_err_t dac_pad_get_io_num(dac_channel_t channel, gpio_num_t *gpio_num); -/** @cond */ -/** - * @brief Set DAC output voltage. - * - * @note Function has been deprecated, please use dac_output_voltage instead. - * This name will be removed in a future release. - * The difference is that before calling dac_output_voltage, we need to initialize the dac pad by dac_output_enable - * - * - * @param channel DAC channel - * @param dac_value DAC output value - * - * @return - * - ESP_OK success - * - ESP_ERR_INVALID_ARG Parameter error - */ -esp_err_t dac_out_voltage(dac_channel_t channel, uint8_t dac_value) __attribute__ ((deprecated)); -/** @endcond */ - /** * @brief Set DAC output voltage. * diff --git a/components/driver/include/driver/i2s.h b/components/driver/include/driver/i2s.h index c00be6632f..37d8278d63 100644 --- a/components/driver/include/driver/i2s.h +++ b/components/driver/include/driver/i2s.h @@ -286,18 +286,6 @@ esp_err_t i2s_driver_install(i2s_port_t i2s_num, const i2s_config_t *i2s_config, */ esp_err_t i2s_driver_uninstall(i2s_port_t i2s_num); -/** - * @brief Write data to I2S DMA transmit buffer. - * - * This function is deprecated. Use 'i2s_write' instead. - * This definition will be removed in a future release. - * - * @return - * - The amount of bytes written, if timeout, the result will be less than the size passed in. - * - ESP_FAIL Parameter error - */ -int i2s_write_bytes(i2s_port_t i2s_num, const void *src, size_t size, TickType_t ticks_to_wait) __attribute__ ((deprecated)); - /** * @brief Write data to I2S DMA transmit buffer. * @@ -353,18 +341,6 @@ esp_err_t i2s_write(i2s_port_t i2s_num, const void *src, size_t size, size_t *by */ esp_err_t i2s_write_expand(i2s_port_t i2s_num, const void *src, size_t size, size_t src_bits, size_t aim_bits, size_t *bytes_written, TickType_t ticks_to_wait); -/** - * @brief Read data from I2S DMA receive buffer - * - * This function is deprecated. Use 'i2s_read' instead. - * This definition will be removed in a future release. - * - * @return - * - The amount of bytes read, if timeout, bytes read will be less than the size passed in - * - ESP_FAIL Parameter error - */ -int i2s_read_bytes(i2s_port_t i2s_num, void *dest, size_t size, TickType_t ticks_to_wait) __attribute__ ((deprecated)); - /** * @brief Read data from I2S DMA receive buffer * @@ -387,42 +363,6 @@ int i2s_read_bytes(i2s_port_t i2s_num, void *dest, size_t size, TickType_t ticks */ esp_err_t i2s_read(i2s_port_t i2s_num, void *dest, size_t size, size_t *bytes_read, TickType_t ticks_to_wait); -/** - * @brief Write a single sample to the I2S DMA TX buffer. - * - * This function is deprecated. Use 'i2s_write' instead. - * This definition will be removed in a future release. - * - * @param i2s_num I2S_NUM_0, I2S_NUM_1 - * - * @param sample Buffer to read data. Size of buffer (in bytes) = bits_per_sample / 8. - * - * @param ticks_to_wait Timeout in RTOS ticks. If a sample is not available in the DMA buffer within this period, no data is read and function returns zero. - * - * @return - * - Number of bytes successfully pushed to DMA buffer, will be either zero or the size of configured sample buffer (in bytes). - * - ESP_FAIL Parameter error - */ -int i2s_push_sample(i2s_port_t i2s_num, const void *sample, TickType_t ticks_to_wait) __attribute__ ((deprecated)); - -/** - * @brief Read a single sample from the I2S DMA RX buffer. - * - * This function is deprecated. Use 'i2s_read' instead. - * This definition will be removed in a future release. - * - * @param i2s_num I2S_NUM_0, I2S_NUM_1 - * - * @param sample Buffer to write data. Size of buffer (in bytes) = bits_per_sample / 8. - * - * @param ticks_to_wait Timeout in RTOS ticks. If a sample is not available in the DMA buffer within this period, no data is read and function returns zero. - * - * @return - * - Number of bytes successfully read from DMA buffer, will be either zero or the size of configured sample buffer (in bytes). - * - ESP_FAIL Parameter error - */ -int i2s_pop_sample(i2s_port_t i2s_num, void *sample, TickType_t ticks_to_wait) __attribute__ ((deprecated)); - /** * @brief Set sample rate used for I2S RX and TX. * diff --git a/components/driver/include/driver/ledc.h b/components/driver/include/driver/ledc.h index 4d5593abb7..845f44286b 100644 --- a/components/driver/include/driver/ledc.h +++ b/components/driver/include/driver/ledc.h @@ -126,10 +126,7 @@ typedef struct { */ typedef struct { ledc_mode_t speed_mode; /*!< LEDC speed speed_mode, high-speed mode or low-speed mode */ - union { - ledc_timer_bit_t duty_resolution; /*!< LEDC channel duty resolution */ - ledc_timer_bit_t bit_num __attribute__((deprecated)); /*!< Deprecated in ESP-IDF 3.0. This is an alias to 'duty_resolution' for backward compatibility with ESP-IDF 2.1 */ - }; + ledc_timer_bit_t duty_resolution; /*!< LEDC channel duty resolution */ ledc_timer_t timer_num; /*!< The timer source of channel (0 - 3) */ uint32_t freq_hz; /*!< LEDC timer frequency (Hz) */ ledc_clk_cfg_t clk_cfg; /*!< Configure LEDC source clock. diff --git a/components/driver/include/driver/touch_pad.h b/components/driver/include/driver/touch_pad.h index 53d5b37389..8731115b4b 100644 --- a/components/driver/include/driver/touch_pad.h +++ b/components/driver/include/driver/touch_pad.h @@ -221,21 +221,6 @@ typedef void (* filter_cb_t)(uint16_t *raw_value, uint16_t *filtered_value); */ esp_err_t touch_pad_set_filter_read_cb(filter_cb_t read_cb); -/** - * @brief Register touch-pad ISR, - * @note Deprecated function, users should replace this with touch_pad_isr_register, - * because RTC modules share a same interrupt index. - * @param fn Pointer to ISR handler - * @param arg Parameter for ISR - * @param unused Reserved, not used - * @param handle_unused Reserved, not used - * @return - * - ESP_OK Success ; - * - ESP_ERR_INVALID_ARG GPIO error - * - ESP_ERR_NO_MEM No memory - */ -esp_err_t touch_pad_isr_handler_register(void(*fn)(void *), void *arg, int unused, intr_handle_t *handle_unused) __attribute__ ((deprecated)); - /** * @brief Register touch-pad ISR. * The handler will be attached to the same CPU core that this function is running on. diff --git a/components/driver/rtc_module.c b/components/driver/rtc_module.c index d5954c9e6d..2162b015b6 100644 --- a/components/driver/rtc_module.c +++ b/components/driver/rtc_module.c @@ -429,12 +429,6 @@ inline static touch_pad_t touch_pad_num_wrap(touch_pad_t touch_num) return touch_num; } -esp_err_t touch_pad_isr_handler_register(void (*fn)(void *), void *arg, int no_use, intr_handle_t *handle_no_use) -{ - RTC_MODULE_CHECK(fn, "Touch_Pad ISR null", ESP_ERR_INVALID_ARG); - return rtc_isr_register(fn, arg, RTC_CNTL_TOUCH_INT_ST_M); -} - esp_err_t touch_pad_isr_register(intr_handler_t fn, void* arg) { RTC_MODULE_CHECK(fn, "Touch_Pad ISR null", ESP_ERR_INVALID_ARG); @@ -1548,11 +1542,6 @@ int adc1_get_raw(adc1_channel_t channel) return adc_value; } -int adc1_get_voltage(adc1_channel_t channel) //Deprecated. Use adc1_get_raw(void) instead -{ - return adc1_get_raw(channel); -} - void adc1_ulp_enable(void) { adc_power_on(); @@ -1849,35 +1838,6 @@ esp_err_t dac_output_voltage(dac_channel_t channel, uint8_t dac_value) return ESP_OK; } -esp_err_t dac_out_voltage(dac_channel_t channel, uint8_t dac_value) -{ - RTC_MODULE_CHECK((channel >= DAC_CHANNEL_1) && (channel < DAC_CHANNEL_MAX), DAC_ERR_STR_CHANNEL_ERROR, ESP_ERR_INVALID_ARG); - portENTER_CRITICAL(&rtc_spinlock); - //Disable Tone - CLEAR_PERI_REG_MASK(SENS_SAR_DAC_CTRL1_REG, SENS_SW_TONE_EN); - - //Disable Channel Tone - if (channel == DAC_CHANNEL_1) { - CLEAR_PERI_REG_MASK(SENS_SAR_DAC_CTRL2_REG, SENS_DAC_CW_EN1_M); - } else if (channel == DAC_CHANNEL_2) { - CLEAR_PERI_REG_MASK(SENS_SAR_DAC_CTRL2_REG, SENS_DAC_CW_EN2_M); - } - - //Set the Dac value - if (channel == DAC_CHANNEL_1) { - SET_PERI_REG_BITS(RTC_IO_PAD_DAC1_REG, RTC_IO_PDAC1_DAC, dac_value, RTC_IO_PDAC1_DAC_S); //dac_output - } else if (channel == DAC_CHANNEL_2) { - SET_PERI_REG_BITS(RTC_IO_PAD_DAC2_REG, RTC_IO_PDAC2_DAC, dac_value, RTC_IO_PDAC2_DAC_S); //dac_output - } - - portEXIT_CRITICAL(&rtc_spinlock); - //dac pad init - dac_rtc_pad_init(channel); - dac_output_enable(channel); - - return ESP_OK; -} - esp_err_t dac_i2s_enable(void) { portENTER_CRITICAL(&rtc_spinlock); diff --git a/components/driver/test/test_ledc.c b/components/driver/test/test_ledc.c index b676c4232a..02fab583f7 100644 --- a/components/driver/test/test_ledc.c +++ b/components/driver/test/test_ledc.c @@ -83,7 +83,7 @@ static void timer_frequency_test(ledc_channel_t channel, ledc_timer_bit_t timer_ }; ledc_timer_config_t ledc_time_config = { .speed_mode = speed_mode, - .bit_num = timer_bit, + .duty_resolution = timer_bit, .timer_num = timer, .freq_hz = 5000, .clk_cfg = LEDC_AUTO_CLK, @@ -124,7 +124,7 @@ static void timer_duty_test(ledc_channel_t channel, ledc_timer_bit_t timer_bit, }; ledc_timer_config_t ledc_time_config = { .speed_mode = speed_mode, - .bit_num = timer_bit, + .duty_resolution = timer_bit, .timer_num = timer, .freq_hz = 5000, .clk_cfg = LEDC_AUTO_CLK, @@ -228,7 +228,7 @@ TEST_CASE("LEDC normal channel and timer config", "[ledc][test_env=UT_T1_LEDC]") ledc_timer_config_t ledc_time_config = { .speed_mode = LEDC_HIGH_SPEED_MODE, - .bit_num = LEDC_TIMER_13_BIT, + .duty_resolution = LEDC_TIMER_13_BIT, .timer_num = LEDC_TIMER_0, .freq_hz = 5000, .clk_cfg = LEDC_AUTO_CLK, @@ -298,7 +298,7 @@ TEST_CASE("LEDC timer set", "[ledc][test_env=UT_T1_LEDC]") ledc_timer_config_t ledc_time_config = { .speed_mode = LEDC_HIGH_SPEED_MODE, - .bit_num = 13, + .duty_resolution = 13, .timer_num = LEDC_TIMER_0, .freq_hz = 5000, .clk_cfg = LEDC_AUTO_CLK, diff --git a/examples/mesh/internal_communication/main/mesh_light.c b/examples/mesh/internal_communication/main/mesh_light.c index b1f4c6705c..360c14f43a 100644 --- a/examples/mesh/internal_communication/main/mesh_light.c +++ b/examples/mesh/internal_communication/main/mesh_light.c @@ -39,7 +39,7 @@ esp_err_t mesh_light_init(void) s_light_inited = true; ledc_timer_config_t ledc_timer = { - .bit_num = LEDC_TIMER_13_BIT, + .duty_resolution = LEDC_TIMER_13_BIT, .freq_hz = 5000, .speed_mode = LEDC_HIGH_SPEED_MODE, .timer_num = LEDC_TIMER_0, diff --git a/examples/mesh/manual_networking/main/mesh_light.c b/examples/mesh/manual_networking/main/mesh_light.c index e181be41bf..ebd620d63c 100644 --- a/examples/mesh/manual_networking/main/mesh_light.c +++ b/examples/mesh/manual_networking/main/mesh_light.c @@ -39,7 +39,7 @@ esp_err_t mesh_light_init(void) s_light_inited = true; ledc_timer_config_t ledc_timer = { - .bit_num = LEDC_TIMER_13_BIT, + .duty_resolution = LEDC_TIMER_13_BIT, .freq_hz = 5000, .speed_mode = LEDC_HIGH_SPEED_MODE, .timer_num = LEDC_TIMER_0, -- 2.40.0