Merge branch 'bugfix/remove_v40_deprecations_v4.0' into 'release/v4.0'

Remove features deprecated before ESP-IDF V4.0 (v4.0)

See merge request espressif/esp-idf!6150
This commit is contained in:
Jiang Jiang Jian 2019-09-20 19:51:51 +08:00
commit b4c7ed999c
45 changed files with 27 additions and 844 deletions

View File

@ -40,9 +40,6 @@ read_otadata: $(PARTITION_TABLE_CSV_PATH) partition_table_get_info | check_pytho
--partition-table-offset $(partition_table_offset) \
read_otadata
erase_ota: erase_otadata
@echo "WARNING: erase_ota is deprecated. Use erase_otadata instead."
all: blank_ota_data
flash: blank_ota_data
ifdef CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT

View File

@ -98,12 +98,6 @@ typedef struct {
esp_err_t esp_partition_table_verify(const esp_partition_info_t *partition_table, bool log_errors, int *num_partitions);
/* This function is included for compatibility with the ESP-IDF v3.x API */
inline static __attribute__((deprecated)) esp_err_t esp_partition_table_basic_verify(const esp_partition_info_t *partition_table, bool log_errors, int *num_partitions)
{
return esp_partition_table_verify(partition_table, log_errors, num_partitions);
}
/**
* Check whether the region on the main flash is safe to write.
*

View File

@ -51,36 +51,6 @@ typedef enum {
#endif
} esp_image_load_mode_t;
/**
* @brief Verify and (optionally, in bootloader mode) load an app image.
*
* This name is deprecated and is included for compatibility with the ESP-IDF v3.x API.
* It will be removed in V4.0 version.
* Function has been renamed to esp_image_verify().
* Use function esp_image_verify() to verify a image. And use function bootloader_load_image() to load image from a bootloader space.
*
* If encryption is enabled, data will be transparently decrypted.
*
* @param mode Mode of operation (verify, silent verify, or load).
* @param part Partition to load the app from.
* @param[inout] data Pointer to the image metadata structure which is be filled in by this function. 'start_addr' member should be set (to the start address of the image.) Other fields will all be initialised by this function.
*
* Image validation checks:
* - Magic byte.
* - Partition smaller than 16MB.
* - All segments & image fit in partition.
* - 8 bit image checksum is valid.
* - SHA-256 of image is valid (if image has this appended).
* - (Signature) if signature verification is enabled.
*
* @return
* - ESP_OK if verify or load was successful
* - ESP_ERR_IMAGE_FLASH_FAIL if a SPI flash error occurs
* - ESP_ERR_IMAGE_INVALID if the image appears invalid.
* - ESP_ERR_INVALID_ARG if the partition or data pointers are invalid.
*/
esp_err_t esp_image_load(esp_image_load_mode_t mode, const esp_partition_pos_t *part, esp_image_metadata_t *data) __attribute__((deprecated));
/**
* @brief Verify an app image.
*

View File

@ -268,8 +268,6 @@ esp_err_t esp_image_verify(esp_image_load_mode_t mode, const esp_partition_pos_t
return image_load(mode, part, data);
}
esp_err_t esp_image_load(esp_image_load_mode_t mode, const esp_partition_pos_t *part, esp_image_metadata_t *data) __attribute__((alias("esp_image_verify")));
static esp_err_t verify_image_header(uint32_t src_addr, const esp_image_header_t *image, bool silent)
{
esp_err_t err = ESP_OK;

View File

@ -1,3 +0,0 @@
#pragma once
#warning "This header is deprecated, please use functions defined in esp_bt.h instead."
#include "esp_bt.h"

View File

@ -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;
}
}

View File

@ -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
*/

View File

@ -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.
*

View File

@ -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.
*

View File

@ -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_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.

View File

@ -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.

View File

@ -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() instead
{
return adc1_get_raw(channel);
}
void adc1_ulp_enable(void)
{
adc_power_on();
@ -1849,36 +1838,7 @@ 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()
esp_err_t dac_i2s_enable(void)
{
portENTER_CRITICAL(&rtc_spinlock);
SET_PERI_REG_MASK(SENS_SAR_DAC_CTRL1_REG, SENS_DAC_DIG_FORCE_M | SENS_DAC_CLK_INV_M);

View File

@ -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,

View File

@ -31,9 +31,7 @@ extern "C" {
* Pass a pointer to this structure as an argument to esp_pm_configure function.
*/
typedef struct {
rtc_cpu_freq_t max_cpu_freq __attribute__((deprecated)); /*!< Maximum CPU frequency to use. Deprecated, use max_freq_mhz instead. */
int max_freq_mhz; /*!< Maximum CPU frequency, in MHz */
rtc_cpu_freq_t min_cpu_freq __attribute__((deprecated)); /*!< Minimum CPU frequency to use when no frequency locks are taken. Deprecated, use min_freq_mhz instead. */
int min_freq_mhz; /*!< Minimum CPU frequency to use when no locks are taken, in MHz */
bool light_sleep_enable; /*!< Enter light sleep when no locks are taken */
} esp_pm_config_esp32_t;

View File

@ -295,16 +295,6 @@ esp_err_t esp_light_sleep_start();
*/
void esp_deep_sleep(uint64_t time_in_us) __attribute__((noreturn));
/**
* @brief Enter deep-sleep mode
*
* Function has been renamed to esp_deep_sleep.
* This name is deprecated and will be removed in a future version.
*
* @param time_in_us deep-sleep time, unit: microsecond
*/
void system_deep_sleep(uint64_t time_in_us) __attribute__((noreturn, deprecated));
/**
* @brief Get the wakeup source which caused wakeup from sleep

View File

@ -182,15 +182,6 @@ esp_err_t esp_pm_configure(const void* vconfig)
int min_freq_mhz = config->min_freq_mhz;
int max_freq_mhz = config->max_freq_mhz;
if (min_freq_mhz == 0 && max_freq_mhz == 0) {
/* For compatibility, handle deprecated fields, min_cpu_freq and max_cpu_freq. */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
min_freq_mhz = rtc_clk_cpu_freq_value(config->min_cpu_freq) / MHZ;
max_freq_mhz = rtc_clk_cpu_freq_value(config->max_cpu_freq) / MHZ;
#pragma GCC diagnostic pop
}
if (min_freq_mhz > max_freq_mhz) {
return ESP_ERR_INVALID_ARG;
}

View File

@ -360,8 +360,6 @@ esp_err_t esp_light_sleep_start()
return err;
}
void system_deep_sleep(uint64_t) __attribute__((alias("esp_deep_sleep")));
esp_err_t esp_sleep_disable_wakeup_source(esp_sleep_source_t source)
{
// For most of sources it is enough to set trigger mask in local

View File

@ -46,10 +46,6 @@ static uint8_t base_mac_addr[6] = { 0 };
#define SHUTDOWN_HANDLERS_NO 2
static shutdown_handler_t shutdown_handlers[SHUTDOWN_HANDLERS_NO];
void system_init()
{
}
esp_err_t esp_base_mac_addr_set(uint8_t *mac)
{
if (mac == NULL) {
@ -121,9 +117,6 @@ esp_err_t esp_efuse_mac_get_default(uint8_t* mac)
return ESP_OK;
}
esp_err_t system_efuse_read_mac(uint8_t *mac) __attribute__((alias("esp_efuse_mac_get_default")));
esp_err_t esp_efuse_read_mac(uint8_t *mac) __attribute__((alias("esp_efuse_mac_get_default")));
esp_err_t esp_derive_local_mac(uint8_t* local_mac, const uint8_t* universal_mac)
{
uint8_t idx;
@ -342,8 +335,6 @@ void IRAM_ATTR esp_restart_noos()
}
}
void system_restart(void) __attribute__((alias("esp_restart")));
uint32_t esp_get_free_heap_size( void )
{
return heap_caps_get_free_size( MALLOC_CAP_DEFAULT );
@ -354,13 +345,6 @@ uint32_t esp_get_minimum_free_heap_size( void )
return heap_caps_get_minimum_free_size( MALLOC_CAP_DEFAULT );
}
uint32_t system_get_free_heap_size(void) __attribute__((alias("esp_get_free_heap_size")));
const char* system_get_sdk_version(void)
{
return "master";
}
const char* esp_get_idf_version(void)
{
return IDF_VER;

View File

@ -384,46 +384,3 @@ esp_err_t esp_task_wdt_status(TaskHandle_t handle)
portEXIT_CRITICAL(&twdt_spinlock);
return ESP_ERR_NOT_FOUND;
}
void esp_task_wdt_feed()
{
portENTER_CRITICAL(&twdt_spinlock);
//Return immediately if TWDT has not been initialized
ASSERT_EXIT_CRIT_RETURN((twdt_config != NULL), VOID_RETURN);
//Check if task is on list
TaskHandle_t handle = xTaskGetCurrentTaskHandle();
bool all_reset;
twdt_task_t *target_task = find_task_in_twdt_list(handle, &all_reset);
//reset the task if it's on the list, then return
if(target_task != NULL){
target_task->has_reset = true;
if(all_reset){
reset_hw_timer(); //Reset hardware timer if all other tasks have reset
}
portEXIT_CRITICAL(&twdt_spinlock);
return;
}
//Add task if it's has not on list
target_task = calloc(1, sizeof(twdt_task_t));
ASSERT_EXIT_CRIT_RETURN((target_task != NULL), VOID_RETURN); //If calloc failed
target_task->task_handle = handle;
target_task->has_reset = true;
target_task->next = NULL;
if (twdt_config->list == NULL) { //Adding to empty list
twdt_config->list = target_task;
} else { //Adding to tail of list
twdt_task_t *task;
for (task = twdt_config->list; task->next != NULL; task = task->next){
; //point task to current tail of wdt task list
}
task->next = target_task;
}
portEXIT_CRITICAL(&twdt_spinlock);
}

View File

@ -15,6 +15,8 @@
#include "esp32/ulp.h"
#include "soc/rtc_periph.h"
#define MHZ 1000000
TEST_CASE("Can dump power management lock stats", "[pm]")
{
esp_pm_dump_locks(stdout);
@ -31,15 +33,15 @@ static void switch_freq(int mhz)
};
ESP_ERROR_CHECK( esp_pm_configure(&pm_config) );
printf("Waiting for frequency to be set to %d MHz...\n", mhz);
while (esp_clk_cpu_freq() / 1000000 != mhz) {
while (esp_clk_cpu_freq() / MHZ != mhz) {
vTaskDelay(pdMS_TO_TICKS(200));
printf("Frequency is %d MHz\n", esp_clk_cpu_freq() / 1000000);
printf("Frequency is %d MHz\n", esp_clk_cpu_freq() / MHZ);
}
}
TEST_CASE("Can switch frequency using esp_pm_configure", "[pm]")
{
int orig_freq_mhz = esp_clk_cpu_freq() / 1000000;
int orig_freq_mhz = esp_clk_cpu_freq() / MHZ;
switch_freq(240);
switch_freq(40);
switch_freq(160);
@ -60,9 +62,12 @@ TEST_CASE("Can switch frequency using esp_pm_configure", "[pm]")
static void light_sleep_enable()
{
int cur_freq_mhz = esp_clk_cpu_freq() / MHZ;
int xtal_freq = (int) rtc_clk_xtal_freq_get();
const esp_pm_config_esp32_t pm_config = {
.max_cpu_freq = rtc_clk_cpu_freq_get(),
.min_cpu_freq = RTC_CPU_FREQ_XTAL,
.max_freq_mhz = cur_freq_mhz,
.min_freq_mhz = xtal_freq,
.light_sleep_enable = true
};
ESP_ERROR_CHECK( esp_pm_configure(&pm_config) );
@ -70,9 +75,11 @@ static void light_sleep_enable()
static void light_sleep_disable()
{
int cur_freq_mhz = esp_clk_cpu_freq() / MHZ;
const esp_pm_config_esp32_t pm_config = {
.max_cpu_freq = rtc_clk_cpu_freq_get(),
.min_cpu_freq = rtc_clk_cpu_freq_get(),
.max_freq_mhz = cur_freq_mhz,
.min_freq_mhz = cur_freq_mhz,
};
ESP_ERROR_CHECK( esp_pm_configure(&pm_config) );
}

View File

@ -390,23 +390,3 @@ esp_err_t esp_adc_cal_get_voltage(adc_channel_t channel,
*voltage = esp_adc_cal_raw_to_voltage((uint32_t)adc_reading, chars);
return ESP_OK;
}
/* ------------------------ Deprecated API --------------------------------- */
void esp_adc_cal_get_characteristics(uint32_t vref,
adc_atten_t atten,
adc_bits_width_t bit_width,
esp_adc_cal_characteristics_t *chars)
{
assert(chars != NULL);
esp_adc_cal_characterize(ADC_UNIT_1, atten, bit_width, vref, chars);
}
uint32_t adc1_to_voltage(adc1_channel_t channel, const esp_adc_cal_characteristics_t *chars)
{
assert(chars != NULL);
uint32_t voltage = 0;
esp_adc_cal_get_voltage((adc_channel_t)channel, chars, &voltage);
return voltage;
}

View File

@ -127,24 +127,6 @@ uint32_t esp_adc_cal_raw_to_voltage(uint32_t adc_reading, const esp_adc_cal_char
*/
esp_err_t esp_adc_cal_get_voltage(adc_channel_t channel, const esp_adc_cal_characteristics_t *chars, uint32_t *voltage);
/* -------------------------- Deprecated API ------------------------------- */
/** @cond */ //Doxygen command to hide deprecated function from API Reference
/**
* @deprecated ADC1 characterization function. Deprecated in order to accommodate
* ADC2 and eFuse functionality. Use esp_adc_cal_characterize() instead
*/
void esp_adc_cal_get_characteristics(uint32_t vref, adc_atten_t atten, adc_bits_width_t bit_width, esp_adc_cal_characteristics_t *chars) __attribute__((deprecated));
/*
* @deprecated This function reads ADC1 and returns the corrected voltage. This
* has been deprecated in order to accommodate ADC2 support. Use the
* new function esp_adc_cal_get_voltage() instead.
*/
uint32_t adc1_to_voltage(adc1_channel_t channel, const esp_adc_cal_characteristics_t *chars) __attribute__((deprecated));
/** @endcond */
#ifdef __cplusplus
}
#endif

View File

@ -58,22 +58,6 @@ typedef enum {
ESP_RST_SDIO, //!< Reset over SDIO
} esp_reset_reason_t;
/** @cond */
/**
* @attention Applications don't need to call this function anymore. It does nothing and will
* be removed in future version.
*/
void system_init(void) __attribute__ ((deprecated));
/**
* @brief Reset to default settings.
*
* Function has been deprecated, please use esp_wifi_restore instead.
* This name will be removed in a future release.
*/
void system_restore(void) __attribute__ ((deprecated));
/** @endcond */
/**
* Shutdown handler type
*/
@ -113,32 +97,12 @@ esp_err_t esp_unregister_shutdown_handler(shutdown_handler_t handle);
*/
void esp_restart(void) __attribute__ ((noreturn));
/** @cond */
/**
* @brief Restart system.
*
* Function has been renamed to esp_restart.
* This name will be removed in a future release.
*/
void system_restart(void) __attribute__ ((deprecated, noreturn));
/** @endcond */
/**
* @brief Get reason of last reset
* @return See description of esp_reset_reason_t for explanation of each value.
*/
esp_reset_reason_t esp_reset_reason(void);
/** @cond */
/**
* @brief Get system time, unit: microsecond.
*
* This function is deprecated. Use 'gettimeofday' function for 64-bit precision.
* This definition will be removed in a future release.
*/
uint32_t system_get_time(void) __attribute__ ((deprecated));
/** @endcond */
/**
* @brief Get the size of available heap.
*
@ -149,18 +113,6 @@ uint32_t system_get_time(void) __attribute__ ((deprecated));
*/
uint32_t esp_get_free_heap_size(void);
/** @cond */
/**
* @brief Get the size of available heap.
*
* Function has been renamed to esp_get_free_heap_size.
* This name will be removed in a future release.
*
* @return Available heap size, in bytes.
*/
uint32_t system_get_free_heap_size(void) __attribute__ ((deprecated));
/** @endcond */
/**
* @brief Get the minimum heap that has ever been available
*
@ -246,31 +198,6 @@ esp_err_t esp_efuse_mac_get_custom(uint8_t *mac);
*/
esp_err_t esp_efuse_mac_get_default(uint8_t *mac);
/** @cond */
/**
* @brief Read hardware MAC address from efuse.
*
* Function has been renamed to esp_efuse_mac_get_default.
* This name will be removed in a future release.
*
* @param mac hardware MAC address, length: 6 bytes.
*
* @return ESP_OK on success
*/
esp_err_t esp_efuse_read_mac(uint8_t *mac) __attribute__ ((deprecated));
/**
* @brief Read hardware MAC address.
*
* Function has been renamed to esp_efuse_mac_get_default.
* This name will be removed in a future release.
*
* @param mac hardware MAC address, length: 6 bytes.
* @return ESP_OK on success
*/
esp_err_t system_efuse_read_mac(uint8_t *mac) __attribute__ ((deprecated));
/** @endcond */
/**
* @brief Read base MAC address and set MAC address of the interface.
*
@ -301,17 +228,6 @@ esp_err_t esp_read_mac(uint8_t* mac, esp_mac_type_t type);
*/
esp_err_t esp_derive_local_mac(uint8_t* local_mac, const uint8_t* universal_mac);
/** @cond */
/**
* Get SDK version
*
* This function is deprecated and will be removed in a future release.
*
* @return constant string "master"
*/
const char* system_get_sdk_version(void) __attribute__ ((deprecated));
/** @endcond */
/**
* @brief Chip models
*/

View File

@ -141,23 +141,6 @@ esp_err_t esp_task_wdt_delete(TaskHandle_t handle);
*/
esp_err_t esp_task_wdt_status(TaskHandle_t handle);
/**
* @brief Reset the TWDT on behalf of the current running task, or
* subscribe the TWDT to if it has not done so already
*
* @warning This function is deprecated, use esp_task_wdt_add() and
* esp_task_wdt_reset() instead
*
* This function is similar to esp_task_wdt_reset() and will reset the TWDT on
* behalf of the current running task. However if this task has not subscribed
* to the TWDT, this function will automatically subscribe the task. Therefore,
* an unsubscribed task will subscribe to the TWDT on its first call to this
* function, then proceed to reset the TWDT on subsequent calls of this
* function.
*/
void esp_task_wdt_feed() __attribute__ ((deprecated));
#ifdef __cplusplus
}
#endif

View File

@ -514,10 +514,6 @@ void vRingbufferGetInfo(RingbufHandle_t xRingbuffer,
*/
void xRingbufferPrintInfo(RingbufHandle_t xRingbuffer);
/* ------------------------------- Deprecated ------------------------------- */
typedef RingbufferType_t ringbuf_type_t __attribute__((deprecated));
#ifdef __cplusplus
}
#endif

View File

@ -9,7 +9,6 @@ idf_component_register(SRCS "src/coexist.c"
"src/lib_printf.c"
"src/mesh_event.c"
"src/phy_init.c"
"src/restore.c"
"src/smartconfig.c"
"src/smartconfig_ack.c"
"src/wifi_init.c"

View File

@ -813,32 +813,6 @@ esp_err_t esp_wifi_ap_get_sta_list(wifi_sta_list_t *sta);
*/
esp_err_t esp_wifi_set_storage(wifi_storage_t storage);
/**
* @brief Set auto connect
* The default value is true
*
* @param en : true - enable auto connect / false - disable auto connect
*
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_MODE: WiFi internal error, the station/soft-AP control block is invalid
* - others: refer to error code in esp_err.h
*/
esp_err_t esp_wifi_set_auto_connect(bool en) __attribute__ ((deprecated));
/**
* @brief Get the auto connect flag
*
* @param[out] en store current auto connect configuration
*
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_INVALID_ARG: invalid argument
*/
esp_err_t esp_wifi_get_auto_connect(bool *en) __attribute__ ((deprecated));
/**
* @brief Function signature for received Vendor-Specific Information Element callback.
* @param ctx Context argument, as passed to esp_wifi_set_vendor_ie_cb() when registering callback.

View File

@ -181,9 +181,7 @@ typedef enum {
typedef struct {
int8_t rssi; /**< The minimum rssi to accept in the fast scan mode */
wifi_auth_mode_t authmode; /**< The weakest authmode to accept in the fast scan mode */
}wifi_fast_scan_threshold_t;
typedef wifi_fast_scan_threshold_t wifi_scan_threshold_t; /**< wifi_fast_scan_threshold_t only used in fast scan mode once, now it enabled in all channel scan, the wifi_fast_scan_threshold_t will be remove in version 4.0 */
}wifi_scan_threshold_t;
typedef enum {
WIFI_PS_NONE, /**< No power save */
@ -191,8 +189,6 @@ typedef enum {
WIFI_PS_MAX_MODEM, /**< Maximum modem power saving. In this mode, interval to receive beacons is determined by the listen_interval parameter in wifi_sta_config_t */
} wifi_ps_type_t;
#define WIFI_PS_MODEM WIFI_PS_MIN_MODEM /**< @deprecated Use WIFI_PS_MIN_MODEM or WIFI_PS_MAX_MODEM instead */
#define WIFI_PROTOCOL_11B 1
#define WIFI_PROTOCOL_11G 2
#define WIFI_PROTOCOL_11N 4

@ -1 +1 @@
Subproject commit b20273f632e7478268488a292c55653db92a6372
Subproject commit f915fe1df49b90ac969595a36e1ae1a36d2ece82

View File

@ -1,24 +0,0 @@
// Copyright 2013-2017 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "esp_system.h"
#include "esp_wifi.h"
/* This function is in a separate file from the reset of system APIs because
* it causes link time dependency on WiFi stack.
*/
void system_restore(void)
{
esp_wifi_restore();
}

View File

@ -51,20 +51,6 @@ extern "C" {
esp_err_t esp_vfs_fat_register(const char* base_path, const char* fat_drive,
size_t max_files, FATFS** out_fs);
/**
* @brief Un-register FATFS from VFS
*
* @note FATFS structure returned by esp_vfs_fat_register is destroyed after
* this call. Make sure to call f_mount function to unmount it before
* calling esp_vfs_fat_unregister.
* This function is left for compatibility and will be changed in
* future versions to accept base_path and replace the method below
* @return
* - ESP_OK on success
* - ESP_ERR_INVALID_STATE if FATFS is not registered in VFS
*/
esp_err_t esp_vfs_fat_unregister() __attribute__((deprecated));
/**
* @brief Un-register FATFS from VFS
*

View File

@ -205,19 +205,6 @@ esp_err_t esp_vfs_fat_unregister_path(const char* base_path)
return ESP_OK;
}
esp_err_t esp_vfs_fat_unregister()
{
if (s_fat_ctx == NULL) {
return ESP_ERR_INVALID_STATE;
}
esp_err_t err = esp_vfs_fat_unregister_path(s_fat_ctx->base_path);
if (err != ESP_OK) {
return err;
}
s_fat_ctx = NULL;
return ESP_OK;
}
static int get_next_fd(vfs_fat_ctx_t* fat_ctx)
{
for (size_t i = 0; i < fat_ctx->max_files; ++i) {

View File

@ -1,35 +0,0 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#warning "This header is deprecated, please use functions defined in esp_heap_caps.h instead."
#include "esp_heap_caps.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Deprecated FreeRTOS-style esp_heap_alloc_caps.h functions follow */
/* Please use heap_caps_malloc() instead of this function */
void *pvPortMallocCaps(size_t xWantedSize, uint32_t caps) asm("heap_caps_malloc") __attribute__((deprecated));
/* Please use heap_caps_get_minimum_free_size() instead of this function */
size_t xPortGetMinimumEverFreeHeapSizeCaps( uint32_t caps ) asm("heap_caps_get_minimum_free_size") __attribute__((deprecated));
/* Please use heap_caps_get_free_size() instead of this function */
size_t xPortGetFreeHeapSizeCaps( uint32_t caps ) asm("heap_caps_get_free_size") __attribute__((deprecated));
#ifdef __cplusplus
}
#endif

View File

@ -464,7 +464,6 @@ test cases:
SDK: |-
8266_NonOS
8266_RTOS
ESP32_IDF
Test App: SSC
allow fail: ''
auto test: 'Yes'
@ -1069,35 +1068,6 @@ test cases:
test point 1: basic function
test point 2: use WiFi API after WiFi stop
version: v1 (2016-12-31)
- CI ready: 'Yes'
ID: WIFI_CONN_1202
SDK: ESP32_IDF
Test App: SSC
allow fail: ''
auto test: 'Yes'
category: Function
cmd set:
- ''
- - SSC SSC1 sta -R -a 1
- - R SSC1 C +AUTORECONN:OK
- - SSC SSC1 sta -Q
- - R SSC1 C +JAP:DISCONNECTED
execution time: 0
expected result: |
1. OK
2. DISCONNECTED
initial condition: WIFISTO
level: Integration
module: WIFI MAC
steps: |
1. sta reconnect start
2. query sta state
sub module: WIFI Connect
summary: sta reconnect start and connect fail after WiFi stop
test environment: SSC_T1_5
test point 1: basic function
test point 2: use WiFi API after WiFi stop
version: v1 (2016-12-31)
- CI ready: 'Yes'
ID: WIFI_CONN_1203
SDK: ESP32_IDF

View File

@ -208,13 +208,6 @@ int esp_internal_aes_encrypt( esp_aes_context *ctx,
return r;
}
void esp_aes_encrypt( esp_aes_context *ctx,
const unsigned char input[16],
unsigned char output[16] )
{
esp_internal_aes_encrypt(ctx, input, output);
}
/*
* AES-ECB block decryption
*/
@ -237,13 +230,6 @@ int esp_internal_aes_decrypt( esp_aes_context *ctx,
return r;
}
void esp_aes_decrypt( esp_aes_context *ctx,
const unsigned char input[16],
unsigned char output[16] )
{
esp_internal_aes_decrypt(ctx, input, output);
}
/*
* AES-ECB block encryption/decryption
*/

View File

@ -332,9 +332,6 @@ int esp_aes_xts_setkey_dec( esp_aes_xts_context *ctx,
*/
int esp_internal_aes_encrypt( esp_aes_context *ctx, const unsigned char input[16], unsigned char output[16] );
/** Deprecated, see esp_aes_internal_encrypt */
void esp_aes_encrypt( esp_aes_context *ctx, const unsigned char input[16], unsigned char output[16] ) __attribute__((deprecated));
/**
* \brief Internal AES block decryption function
* (Only exposed to allow overriding it,
@ -346,9 +343,6 @@ void esp_aes_encrypt( esp_aes_context *ctx, const unsigned char input[16], unsig
*/
int esp_internal_aes_decrypt( esp_aes_context *ctx, const unsigned char input[16], unsigned char output[16] );
/** Deprecated, see esp_aes_internal_decrypt */
void esp_aes_decrypt( esp_aes_context *ctx, const unsigned char input[16], unsigned char output[16] ) __attribute__((deprecated));
/** AES-XTS buffer encryption/decryption */
int esp_aes_crypt_xts( esp_aes_xts_context *ctx, int mode, size_t length, const unsigned char data_unit[16], const unsigned char *input, unsigned char *output );

View File

@ -961,7 +961,6 @@
#define DPORT_CAN_CLK_EN (BIT(19))
#define DPORT_I2C_EXT1_CLK_EN (BIT(18))
#define DPORT_PWM0_CLK_EN (BIT(17))
#define DPORT_SPI_CLK_EN_2 (BIT(16)) /** Deprecated, please use DPORT_SPI3_CLK_EN **/
#define DPORT_SPI3_CLK_EN (BIT(16))
#define DPORT_TIMERGROUP1_CLK_EN (BIT(15))
#define DPORT_EFUSE_CLK_EN (BIT(14))
@ -972,13 +971,11 @@
#define DPORT_RMT_CLK_EN (BIT(9))
#define DPORT_UHCI0_CLK_EN (BIT(8))
#define DPORT_I2C_EXT0_CLK_EN (BIT(7))
#define DPORT_SPI_CLK_EN (BIT(6)) /** Deprecated, please use DPORT_SPI2_CLK_EN **/
#define DPORT_SPI2_CLK_EN (BIT(6))
#define DPORT_UART1_CLK_EN (BIT(5))
#define DPORT_I2S0_CLK_EN (BIT(4))
#define DPORT_WDG_CLK_EN (BIT(3))
#define DPORT_UART_CLK_EN (BIT(2))
#define DPORT_SPI_CLK_EN_1 (BIT(1)) /** Deprecated, please use DPORT_SPI01_CLK_EN **/
#define DPORT_SPI01_CLK_EN (BIT(1))
#define DPORT_TIMERS_CLK_EN (BIT(0))
#define DPORT_PERIP_RST_EN_REG (DR_REG_DPORT_BASE + 0x0C4)
@ -998,7 +995,6 @@
#define DPORT_CAN_RST (BIT(19))
#define DPORT_I2C_EXT1_RST (BIT(18))
#define DPORT_PWM0_RST (BIT(17))
#define DPORT_SPI_RST_2 (BIT(16)) /** Deprecated, please use DPORT_SPI3_RST **/
#define DPORT_SPI3_RST (BIT(16))
#define DPORT_TIMERGROUP1_RST (BIT(15))
#define DPORT_EFUSE_RST (BIT(14))
@ -1009,13 +1005,11 @@
#define DPORT_RMT_RST (BIT(9))
#define DPORT_UHCI0_RST (BIT(8))
#define DPORT_I2C_EXT0_RST (BIT(7))
#define DPORT_SPI_RST (BIT(6)) /** Deprecated, please use DPORT_SPI2_RST **/
#define DPORT_SPI2_RST (BIT(6))
#define DPORT_UART1_RST (BIT(5))
#define DPORT_I2S0_RST (BIT(4))
#define DPORT_WDG_RST (BIT(3))
#define DPORT_UART_RST (BIT(2))
#define DPORT_SPI_RST_1 (BIT(1)) /** Deprecated, please use DPORT_SPI01_RST **/
#define DPORT_SPI01_RST (BIT(1))
#define DPORT_TIMERS_RST (BIT(0))
#define DPORT_SLAVE_SPI_CONFIG_REG (DR_REG_DPORT_BASE + 0x0C8)

View File

@ -77,40 +77,6 @@
#define PIN_INPUT_DISABLE(PIN_NAME) CLEAR_PERI_REG_MASK(PIN_NAME,FUN_IE)
#define PIN_SET_DRV(PIN_NAME, drv) REG_SET_FIELD(PIN_NAME, FUN_DRV, (drv));
/*
* @attention
* The PIN_PULL[UP|DWN]_[EN|DIS]() functions used to exist as macros in previous SDK versions.
* Unfortunately, however, they do not work for some GPIOs on the ESP32 chip, which needs pullups
* and -downs turned on and off through RTC registers. The functions still exist for compatibility
* with older code, but are marked as deprecated in order to generate a warning.
* Please replace them in this fashion: (make sure to include driver/gpio.h as well)
* PIN_PULLUP_EN(GPIO_PIN_MUX_REG[x]) -> gpio_pullup_en(x)
* PIN_PULLUP_DIS(GPIO_PIN_MUX_REG[x]) -> gpio_pullup_dis(x)
* PIN_PULLDWN_EN(GPIO_PIN_MUX_REG[x]) -> gpio_pulldown_en(x)
* PIN_PULLDWN_DIS(GPIO_PIN_MUX_REG[x]) -> gpio_pulldown_dis(x)
*
*/
static inline void __attribute__ ((deprecated)) PIN_PULLUP_DIS(uint32_t PIN_NAME)
{
REG_CLR_BIT(PIN_NAME, FUN_PU);
}
static inline void __attribute__ ((deprecated)) PIN_PULLUP_EN(uint32_t PIN_NAME)
{
REG_SET_BIT(PIN_NAME, FUN_PU);
}
static inline void __attribute__ ((deprecated)) PIN_PULLDWN_DIS(uint32_t PIN_NAME)
{
REG_CLR_BIT(PIN_NAME, FUN_PD);
}
static inline void __attribute__ ((deprecated)) PIN_PULLDWN_EN(uint32_t PIN_NAME)
{
REG_SET_BIT(PIN_NAME, FUN_PD);
}
#define PIN_FUNC_SELECT(PIN_NAME, FUNC) REG_SET_FIELD(PIN_NAME, MCU_SEL, FUNC)
#define PIN_FUNC_GPIO 2

View File

@ -79,11 +79,6 @@ typedef volatile struct ledc_dev_s {
uint32_t low_speed_update: 1; /*This bit is only useful for low speed timer channels, reserved for high speed timers*/
uint32_t reserved26: 5;
};
struct {
uint32_t bit_num: 5 __attribute__((deprecated)); /*Deprecated in ESP-IDF 3.0. This is an alias to 'duty_resolution' for backward compatibility with ESP-IDF 2.1.*/
uint32_t div_num: 18 __attribute__((deprecated)); /*Deprecated in ESP-IDF 3.0. This is an alias to 'clock_divider' for backward compatibility with ESP-IDF 2.1.*/
uint32_t place_holder: 9 __attribute__((deprecated)); /*A place holder to accommodate deprecated members*/
};
uint32_t val;
} conf;
union {

View File

@ -305,82 +305,7 @@ void rtc_clk_fast_freq_set(rtc_fast_freq_t fast_freq);
rtc_fast_freq_t rtc_clk_fast_freq_get();
/**
* @brief Switch CPU frequency
*
* @note This function is deprecated and will be removed.
* See rtc_clk_cpu_freq_config_set instead.
*
* If a PLL-derived frequency is requested (80, 160, 240 MHz), this function
* will enable the PLL. Otherwise, PLL will be disabled.
* Note: this function is not optimized for switching speed. It may take several
* hundred microseconds to perform frequency switch.
*
* @param cpu_freq new CPU frequency
*/
void rtc_clk_cpu_freq_set(rtc_cpu_freq_t cpu_freq) __attribute__((deprecated));
/**
* @brief Switch CPU frequency
*
* @note This function is deprecated and will be removed.
* See rtc_clk_cpu_freq_set_config_fast instead.
*
* This is a faster version of rtc_clk_cpu_freq_set, which can handle some of
* the frequency switch paths (XTAL -> PLL, PLL -> XTAL).
* When switching from PLL to XTAL, PLL is not disabled (unlike rtc_clk_cpu_freq_set).
* When switching back from XTAL to PLL, only the same PLL can be used.
* Therefore it is not possible to switch 240 -> XTAL -> (80 or 160) using this
* function.
*
* For unsupported cases, this function falls back to rtc_clk_cpu_freq_set.
*
* Unlike rtc_clk_cpu_freq_set, this function relies on static data, so it is
* less safe to use it e.g. from a panic handler (when memory might be corrupted).
*
* @param cpu_freq new CPU frequency
*/
void rtc_clk_cpu_freq_set_fast(rtc_cpu_freq_t cpu_freq) __attribute__((deprecated));
/**
* @brief Get the currently selected CPU frequency
*
* @note This function is deprecated and will be removed.
* See rtc_clk_cpu_freq_get_config instead.
*
* Although CPU can be clocked by APLL and RTC 8M sources, such support is not
* exposed through this library. As such, this function will not return
* meaningful values when these clock sources are configured (e.g. using direct
* access to clock selection registers). In debug builds, it will assert; in
* release builds, it will return RTC_CPU_FREQ_XTAL.
*
* @return CPU frequency (one of rtc_cpu_freq_t values)
*/
rtc_cpu_freq_t rtc_clk_cpu_freq_get() __attribute__((deprecated));
/**
* @brief Get corresponding frequency value for rtc_cpu_freq_t enum value
*
* @note This function is deprecated and will be removed.
* See rtc_clk_cpu_freq_get/set_config instead.
*
* @param cpu_freq CPU frequency, on of rtc_cpu_freq_t values
* @return CPU frequency, in HZ
*/
uint32_t rtc_clk_cpu_freq_value(rtc_cpu_freq_t cpu_freq) __attribute__((deprecated));
/**
* @brief Get rtc_cpu_freq_t enum value for given CPU frequency
*
* @note This function is deprecated and will be removed.
* See rtc_clk_cpu_freq_mhz_to_config instead.
*
* @param cpu_freq_mhz CPU frequency, one of 80, 160, 240, 2, and XTAL frequency
* @param[out] out_val output, rtc_cpu_freq_t value corresponding to the frequency
* @return true if the given frequency value matches one of enum values
*/
bool rtc_clk_cpu_freq_from_mhz(int cpu_freq_mhz, rtc_cpu_freq_t* out_val) __attribute__((deprecated));
/**
* @brief Get CPU frequency config corresponding to a rtc_cpu_freq_t value
* @param cpu_freq CPU frequency enumeration value
* @param[out] out_config Output, CPU frequency configuration structure

View File

@ -104,7 +104,6 @@ static void rtc_clk_cpu_freq_to_8m();
static void rtc_clk_bbpll_disable();
static void rtc_clk_bbpll_enable();
static void rtc_clk_cpu_freq_to_pll_mhz(int cpu_freq_mhz);
static bool rtc_clk_cpu_freq_from_mhz_internal(int mhz, rtc_cpu_freq_t* out_val);
// Current PLL frequency, in MHZ (320 or 480). Zero if PLL is not enabled.
static int s_cur_pll_freq;
@ -501,22 +500,7 @@ static void rtc_clk_cpu_freq_to_pll_mhz(int cpu_freq_mhz)
rtc_clk_wait_for_slow_cycle();
}
void rtc_clk_cpu_freq_set(rtc_cpu_freq_t cpu_freq)
{
rtc_cpu_freq_config_t config;
rtc_clk_cpu_freq_to_config(cpu_freq, &config);
rtc_clk_cpu_freq_set_config(&config);
}
void rtc_clk_cpu_freq_set_fast(rtc_cpu_freq_t cpu_freq)
{
rtc_cpu_freq_config_t config;
rtc_clk_cpu_freq_to_config(cpu_freq, &config);
rtc_clk_cpu_freq_set_config_fast(&config);
}
void rtc_clk_cpu_freq_set_xtal()
void rtc_clk_cpu_freq_set_xtal(void)
{
int freq_mhz = (int) rtc_clk_xtal_freq_get();
@ -525,57 +509,6 @@ void rtc_clk_cpu_freq_set_xtal()
rtc_clk_bbpll_disable();
}
rtc_cpu_freq_t rtc_clk_cpu_freq_get()
{
rtc_cpu_freq_config_t config;
rtc_clk_cpu_freq_get_config(&config);
rtc_cpu_freq_t freq = RTC_CPU_FREQ_XTAL;
rtc_clk_cpu_freq_from_mhz_internal(config.freq_mhz, &freq);
return freq;
}
uint32_t rtc_clk_cpu_freq_value(rtc_cpu_freq_t cpu_freq)
{
switch (cpu_freq) {
case RTC_CPU_FREQ_XTAL:
return ((uint32_t) rtc_clk_xtal_freq_get()) * MHZ;
case RTC_CPU_FREQ_2M:
return 2 * MHZ;
case RTC_CPU_FREQ_80M:
return 80 * MHZ;
case RTC_CPU_FREQ_160M:
return 160 * MHZ;
case RTC_CPU_FREQ_240M:
return 240 * MHZ;
default:
SOC_LOGE(TAG, "invalid rtc_cpu_freq_t value");
return 0;
}
}
static bool rtc_clk_cpu_freq_from_mhz_internal(int mhz, rtc_cpu_freq_t* out_val)
{
if (mhz == 240) {
*out_val = RTC_CPU_FREQ_240M;
} else if (mhz == 160) {
*out_val = RTC_CPU_FREQ_160M;
} else if (mhz == 80) {
*out_val = RTC_CPU_FREQ_80M;
} else if (mhz == (int) rtc_clk_xtal_freq_get()) {
*out_val = RTC_CPU_FREQ_XTAL;
} else if (mhz == 2) {
*out_val = RTC_CPU_FREQ_2M;
} else {
return false;
}
return true;
}
bool rtc_clk_cpu_freq_from_mhz(int mhz, rtc_cpu_freq_t* out_val)
{
return rtc_clk_cpu_freq_from_mhz_internal(mhz, out_val);
}
void rtc_clk_cpu_freq_to_config(rtc_cpu_freq_t cpu_freq, rtc_cpu_freq_config_t* out_config)
{
uint32_t source_freq_mhz;

View File

@ -360,7 +360,7 @@ Advanced Make Targets
---------------------
- ``make app``, ``make bootloader``, ``make partition table`` can be used to build only the app, bootloader, or partition table from the project as applicable.
- ``make erase_flash`` and ``make erase_ota`` will use esptool.py to erase the entire flash chip and the OTA selection setting from the flash chip, respectively.
- ``make erase_flash`` and ``make erase_otadata`` will use esptool.py to erase the entire flash chip and the OTA selection setting from the flash chip, respectively.
- ``make size`` prints some size information about the app. ``make size-components`` and ``make size-files`` are similar targets which print more detailed per-component or per-source-file information, respectively.

View File

@ -289,7 +289,7 @@ ESP-IDF 构建系统会在命令行中添加以下 C 预处理定义:
~~~~~~~~~~~~~~~~~~
- ``make app````make bootloader````make partition table`` 可以根据需要为项目单独构建生成应用程序文件、启动引导文件和分区表文件。
- ``make erase_flash````make erase_ota`` 会调用 esptool.py 脚本分别擦除整块闪存芯片或者其中 OTA 分区的内容。
- ``make erase_flash````make erase_otadata`` 会调用 esptool.py 脚本分别擦除整块闪存芯片或者其中 OTA 分区的内容。
- ``make size`` 会打印应用程序的大小信息。``make size-components````make size-files`` 两者功能相似,分别打印每个组件或者每个源文件大小的详细信息。
调试 Make 的过程

View File

@ -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,

View File

@ -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,