diff --git a/components/driver/deprecated/driver/rmt_types_legacy.h b/components/driver/deprecated/driver/rmt_types_legacy.h index b297999b9f..f21c8851e5 100644 --- a/components/driver/deprecated/driver/rmt_types_legacy.h +++ b/components/driver/deprecated/driver/rmt_types_legacy.h @@ -18,7 +18,6 @@ extern "C" { #define RMT_CHANNEL_FLAGS_AWARE_DFS (1 << 0) /*!< Channel can work during APB clock scaling */ #define RMT_CHANNEL_FLAGS_INVERT_SIG (1 << 1) /*!< Invert RMT signal */ -#define RMT_CHANNEL_FLAGS_ALWAYS_ON _Pragma ("GCC warning \"'RMT_CHANNEL_FLAGS_ALWAYS_ON' macro is deprecated\"") RMT_CHANNEL_FLAGS_AWARE_DFS /** * @brief Define memory space of each RMT channel (in words = 4 bytes) diff --git a/components/driver/deprecated/driver/timer.h b/components/driver/deprecated/driver/timer.h index e035d16522..2569718641 100644 --- a/components/driver/deprecated/driver/timer.h +++ b/components/driver/deprecated/driver/timer.h @@ -315,14 +315,6 @@ esp_err_t timer_enable_intr(timer_group_t group_num, timer_idx_t timer_num); */ esp_err_t timer_disable_intr(timer_group_t group_num, timer_idx_t timer_num); -/** @brief Clear timer interrupt status, just used in ISR - * - * @param group_num Timer group number, 0 for TIMERG0 or 1 for TIMERG1 - * @param timer_num Timer index. - * - */ -void timer_group_intr_clr_in_isr(timer_group_t group_num, timer_idx_t timer_num) __attribute__((deprecated)); - /** @brief Clear timer interrupt status, just used in ISR * * @param group_num Timer group number, 0 for TIMERG0 or 1 for TIMERG1 @@ -367,14 +359,6 @@ void timer_group_set_alarm_value_in_isr(timer_group_t group_num, timer_idx_t tim */ void timer_group_set_counter_enable_in_isr(timer_group_t group_num, timer_idx_t timer_num, timer_start_t counter_en); -/** @brief Get the masked interrupt status, just used in ISR - * - * @param group_num Timer group number, 0 for TIMERG0 or 1 for TIMERG1 - * - * @return - * - Interrupt status - */ -timer_intr_t timer_group_intr_get_in_isr(timer_group_t group_num) __attribute__((deprecated)); /** @brief Get interrupt status, just used in ISR * @@ -384,15 +368,6 @@ timer_intr_t timer_group_intr_get_in_isr(timer_group_t group_num) __attribute__( * - Interrupt status */ uint32_t timer_group_get_intr_status_in_isr(timer_group_t group_num); - -/** @brief Clear the masked interrupt status, just used in ISR - * - * @param group_num Timer group number, 0 for TIMERG0 or 1 for TIMERG1 - * @param intr_mask Masked interrupt. - * - */ -void timer_group_clr_intr_sta_in_isr(timer_group_t group_num, timer_intr_t intr_mask) __attribute__((deprecated)); - /** @brief Get auto reload enable status, just used in ISR * * @param group_num Timer group number, 0 for TIMERG0 or 1 for TIMERG1 @@ -404,30 +379,6 @@ void timer_group_clr_intr_sta_in_isr(timer_group_t group_num, timer_intr_t intr_ */ bool timer_group_get_auto_reload_in_isr(timer_group_t group_num, timer_idx_t timer_num); -/** @brief Take timer spinlock to enter critical protect - * - * @note Deprecated, the recommended way is to use ISR callbacks instead, see timer_group_example_main - * - * @param group_num Timer group number, 0 for TIMERG0 or 1 for TIMERG1 - * - * @return - * - ESP_OK Success - * - ESP_ERR_INVALID_ARG Parameter error - */ -esp_err_t timer_spinlock_take(timer_group_t group_num) __attribute__ ((deprecated)); - -/** @brief Give timer spinlock to exit critical protect - * - * @note Deprecated, the recommended way is to use ISR callbacks instead, see timer_group_example_main - * - * @param group_num Timer group number, 0 for TIMERG0 or 1 for TIMERG1 - * - * @return - * - ESP_OK Success - * - ESP_ERR_INVALID_ARG Parameter error - */ -esp_err_t timer_spinlock_give(timer_group_t group_num) __attribute__ ((deprecated)); - #ifdef __cplusplus } #endif diff --git a/components/driver/deprecated/driver/timer_types_legacy.h b/components/driver/deprecated/driver/timer_types_legacy.h index 1099b4580f..16eaaf2061 100644 --- a/components/driver/deprecated/driver/timer_types_legacy.h +++ b/components/driver/deprecated/driver/timer_types_legacy.h @@ -16,13 +16,6 @@ extern "C" { #endif -/** - * @brief Frequency of the clock on the input of the timer groups - * @note This macro is not correct for Timer Groups with multiple clock sources (e.g. APB, XTAL) - * So please don't use it in your application, we keep it here only for backward compatible - */ -#define TIMER_BASE_CLK _Pragma ("GCC warning \"'TIMER_BASE_CLK' macro is deprecated\"") APB_CLK_FREQ - /** * @brief Timer-Group ID */ diff --git a/components/driver/deprecated/rmt_legacy.c b/components/driver/deprecated/rmt_legacy.c index e4659eb9e9..64c052a7bb 100644 --- a/components/driver/deprecated/rmt_legacy.c +++ b/components/driver/deprecated/rmt_legacy.c @@ -817,10 +817,10 @@ static void IRAM_ATTR rmt_driver_isr_default(void *arg) BaseType_t res = xRingbufferSendFromISR(p_rmt->rx_buf, (void *)addr, item_len * 4, &HPTaskAwoken); #endif if (res == pdFALSE) { - ESP_EARLY_LOGE(TAG, "RMT RX BUFFER FULL"); + ESP_DRAM_LOGE(TAG, "RMT RX BUFFER FULL"); } } else { - ESP_EARLY_LOGE(TAG, "RMT RX BUFFER ERROR"); + ESP_DRAM_LOGE(TAG, "RMT RX BUFFER ERROR"); } #if SOC_RMT_SUPPORT_RX_PINGPONG @@ -855,7 +855,7 @@ static void IRAM_ATTR rmt_driver_isr_default(void *arg) p_rmt->rx_item_start_idx = 0; } } else { - ESP_EARLY_LOGE(TAG, "---RX buffer too small: %d", sizeof(p_rmt->rx_item_buf)); + ESP_DRAM_LOGE(TAG, "---RX buffer too small: %d", sizeof(p_rmt->rx_item_buf)); } rmt_ll_clear_interrupt_status(hal->regs, RMT_LL_EVENT_RX_THRES(channel)); } @@ -894,8 +894,8 @@ static void IRAM_ATTR rmt_driver_isr_default(void *arg) if (p_rmt) { // Reset the receiver's write/read addresses to prevent endless err interrupts. rmt_ll_rx_reset_pointer(rmt_contex.hal.regs, channel); - ESP_EARLY_LOGD(TAG, "RMT RX channel %d error", channel); - ESP_EARLY_LOGD(TAG, "status: 0x%08x", rmt_ll_rx_get_status_word(rmt_contex.hal.regs, channel)); + ESP_DRAM_LOGD(TAG, "RMT RX channel %d error", channel); + ESP_DRAM_LOGD(TAG, "status: 0x%08x", rmt_ll_rx_get_status_word(rmt_contex.hal.regs, channel)); } rmt_ll_clear_interrupt_status(hal->regs, RMT_LL_EVENT_RX_ERROR(channel)); } @@ -909,8 +909,8 @@ static void IRAM_ATTR rmt_driver_isr_default(void *arg) if (p_rmt) { // Reset the transmitter's write/read addresses to prevent endless err interrupts. rmt_ll_tx_reset_pointer(rmt_contex.hal.regs, channel); - ESP_EARLY_LOGD(TAG, "RMT TX channel %d error", channel); - ESP_EARLY_LOGD(TAG, "status: 0x%08x", rmt_ll_tx_get_status_word(rmt_contex.hal.regs, channel)); + ESP_DRAM_LOGD(TAG, "RMT TX channel %d error", channel); + ESP_DRAM_LOGD(TAG, "status: 0x%08x", rmt_ll_tx_get_status_word(rmt_contex.hal.regs, channel)); } rmt_ll_clear_interrupt_status(hal->regs, RMT_LL_EVENT_TX_ERROR(channel)); } diff --git a/components/driver/deprecated/timer_legacy.c b/components/driver/deprecated/timer_legacy.c index f43a38652b..d753a75f16 100644 --- a/components/driver/deprecated/timer_legacy.c +++ b/components/driver/deprecated/timer_legacy.c @@ -406,12 +406,6 @@ esp_err_t timer_group_intr_disable(timer_group_t group_num, timer_intr_t disable return ESP_OK; } -/* This function is deprecated */ -timer_intr_t IRAM_ATTR timer_group_intr_get_in_isr(timer_group_t group_num) -{ - return timer_ll_get_intr_status(TIMER_LL_GET_HW(group_num)); -} - uint32_t IRAM_ATTR timer_group_get_intr_status_in_isr(timer_group_t group_num) { uint32_t intr_status = 0; @@ -431,12 +425,6 @@ void IRAM_ATTR timer_group_clr_intr_status_in_isr(timer_group_t group_num, timer timer_ll_clear_intr_status(p_timer_obj[group_num][timer_num]->hal.dev, TIMER_LL_EVENT_ALARM(timer_num)); } -/* This function is deprecated */ -void IRAM_ATTR timer_group_intr_clr_in_isr(timer_group_t group_num, timer_idx_t timer_num) -{ - timer_group_clr_intr_status_in_isr(group_num, timer_num); -} - void IRAM_ATTR timer_group_enable_alarm_in_isr(timer_group_t group_num, timer_idx_t timer_num) { timer_ll_enable_alarm(p_timer_obj[group_num][timer_num]->hal.dev, timer_num, true); @@ -460,35 +448,11 @@ void IRAM_ATTR timer_group_set_counter_enable_in_isr(timer_group_t group_num, ti p_timer_obj[group_num][timer_num]->counter_en = counter_en; } -/* This function is deprecated */ -void IRAM_ATTR timer_group_clr_intr_sta_in_isr(timer_group_t group_num, timer_intr_t intr_mask) -{ - for (uint32_t timer_idx = 0; timer_idx < TIMER_MAX; timer_idx++) { - if (intr_mask & BIT(timer_idx)) { - timer_group_clr_intr_status_in_isr(group_num, timer_idx); - } - } -} - bool IRAM_ATTR timer_group_get_auto_reload_in_isr(timer_group_t group_num, timer_idx_t timer_num) { return p_timer_obj[group_num][timer_num]->auto_reload_en; } -esp_err_t IRAM_ATTR timer_spinlock_take(timer_group_t group_num) -{ - ESP_RETURN_ON_FALSE(group_num < TIMER_GROUP_MAX, ESP_ERR_INVALID_ARG, TIMER_TAG, TIMER_GROUP_NUM_ERROR); - TIMER_ENTER_CRITICAL(&timer_spinlock[group_num]); - return ESP_OK; -} - -esp_err_t IRAM_ATTR timer_spinlock_give(timer_group_t group_num) -{ - ESP_RETURN_ON_FALSE(group_num < TIMER_GROUP_MAX, ESP_ERR_INVALID_ARG, TIMER_TAG, TIMER_GROUP_NUM_ERROR); - TIMER_EXIT_CRITICAL(&timer_spinlock[group_num]); - return ESP_OK; -} - /** * @brief This function will be called during start up, to check that this legacy timer group driver is not running along with the gptimer driver */ diff --git a/components/driver/include/driver/ledc.h b/components/driver/include/driver/ledc.h index 5754292414..05b499e2dc 100644 --- a/components/driver/include/driver/ledc.h +++ b/components/driver/include/driver/ledc.h @@ -55,10 +55,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 from ledc_clk_cfg_t. diff --git a/components/driver/include/driver/mcpwm.h b/components/driver/include/driver/mcpwm.h index aa435a71a3..7f900f78d4 100644 --- a/components/driver/include/driver/mcpwm.h +++ b/components/driver/include/driver/mcpwm.h @@ -170,16 +170,6 @@ typedef enum { MCPWM_BOTH_EDGE = BIT(1) | BIT(0), /*!dev, context[mcpwm_num].group_pre_scale); - mcpwm_ll_capture_enable_timer(hal->dev, true); - mcpwm_ll_capture_enable_channel(hal->dev, cap_sig, true); - mcpwm_ll_capture_enable_negedge(hal->dev, cap_sig, cap_edge & MCPWM_NEG_EDGE); - mcpwm_ll_capture_enable_posedge(hal->dev, cap_sig, cap_edge & MCPWM_POS_EDGE); - mcpwm_ll_capture_set_prescale(hal->dev, cap_sig, num_of_pulse + 1); - // capture feature should be used with interupt, so enable it by default - mcpwm_ll_intr_enable_capture(hal->dev, cap_sig, true); - mcpwm_ll_intr_clear_capture_status(hal->dev, 1 << cap_sig); - mcpwm_critical_exit(mcpwm_num); - return ESP_OK; -} - -esp_err_t mcpwm_capture_disable(mcpwm_unit_t mcpwm_num, mcpwm_capture_signal_t cap_sig) -{ - ESP_RETURN_ON_FALSE(mcpwm_num < SOC_MCPWM_GROUPS, ESP_ERR_INVALID_ARG, TAG, MCPWM_GROUP_NUM_ERROR); - ESP_RETURN_ON_FALSE(cap_sig < SOC_MCPWM_CAPTURE_CHANNELS_PER_TIMER, ESP_ERR_INVALID_ARG, TAG, MCPWM_CAPTURE_ERROR); - mcpwm_hal_context_t *hal = &context[mcpwm_num].hal; - - mcpwm_critical_enter(mcpwm_num); - mcpwm_ll_capture_enable_channel(hal->dev, cap_sig, false); - mcpwm_ll_intr_enable_capture(hal->dev, cap_sig, false); - mcpwm_critical_exit(mcpwm_num); - periph_module_disable(mcpwm_periph_signals.groups[mcpwm_num].module); - return ESP_OK; -} - esp_err_t mcpwm_capture_enable_channel(mcpwm_unit_t mcpwm_num, mcpwm_capture_channel_id_t cap_channel, const mcpwm_capture_config_t *cap_conf) { ESP_RETURN_ON_FALSE(mcpwm_num < SOC_MCPWM_GROUPS, ESP_ERR_INVALID_ARG, TAG, MCPWM_GROUP_NUM_ERROR); @@ -897,29 +856,6 @@ uint32_t MCPWM_ISR_ATTR mcpwm_capture_signal_get_edge(mcpwm_unit_t mcpwm_num, mc return mcpwm_ll_capture_is_negedge(hal->dev, cap_sig) ? 2 : 1; } -esp_err_t mcpwm_sync_enable(mcpwm_unit_t mcpwm_num, mcpwm_timer_t timer_num, mcpwm_sync_signal_t sync_sig, - uint32_t phase_val) -{ - MCPWM_TIMER_CHECK(mcpwm_num, timer_num); - ESP_RETURN_ON_FALSE(sync_sig <= MCPWM_SELECT_GPIO_SYNC2, ESP_ERR_INVALID_ARG, TAG, "invalid sync_sig"); - ESP_RETURN_ON_FALSE(phase_val < 1000, ESP_ERR_INVALID_ARG, TAG, "phase_val must within 0~999"); - mcpwm_hal_context_t *hal = &context[mcpwm_num].hal; - - mcpwm_critical_enter(mcpwm_num); - uint32_t set_phase = mcpwm_ll_timer_get_peak(hal->dev, timer_num, false) * phase_val / 1000; - mcpwm_ll_timer_set_sync_phase_value(hal->dev, timer_num, set_phase); - if (sync_sig == MCPWM_SELECT_NO_INPUT) { - mcpwm_ll_timer_set_soft_synchro(hal->dev, timer_num); - } else if (sync_sig <= MCPWM_SELECT_TIMER2_SYNC) { - mcpwm_ll_timer_set_timer_synchro(hal->dev, timer_num, sync_sig - MCPWM_SELECT_TIMER0_SYNC); - } else { - mcpwm_ll_timer_set_gpio_synchro(hal->dev, timer_num, sync_sig - MCPWM_SELECT_GPIO_SYNC0); - } - mcpwm_ll_timer_enable_sync_input(hal->dev, timer_num, true); - mcpwm_critical_exit(mcpwm_num); - return ESP_OK; -} - esp_err_t mcpwm_sync_configure(mcpwm_unit_t mcpwm_num, mcpwm_timer_t timer_num, const mcpwm_sync_config_t *sync_conf) { MCPWM_TIMER_CHECK(mcpwm_num, timer_num); @@ -1003,12 +939,3 @@ esp_err_t mcpwm_set_timer_sync_output(mcpwm_unit_t mcpwm_num, mcpwm_timer_t time mcpwm_critical_exit(mcpwm_num); return ESP_OK; } - -esp_err_t mcpwm_isr_register(mcpwm_unit_t mcpwm_num, void (*fn)(void *), void *arg, int intr_alloc_flags, intr_handle_t *handle) -{ - esp_err_t ret; - ESP_RETURN_ON_FALSE(mcpwm_num < SOC_MCPWM_GROUPS, ESP_ERR_INVALID_ARG, TAG, MCPWM_GROUP_NUM_ERROR); - ESP_RETURN_ON_FALSE(fn, ESP_ERR_INVALID_ARG, TAG, MCPWM_PARAM_ADDR_ERROR); - ret = esp_intr_alloc(mcpwm_periph_signals.groups[mcpwm_num].irq_id, intr_alloc_flags, fn, arg, handle); - return ret; -} diff --git a/components/driver/sdmmc_host.c b/components/driver/sdmmc_host.c index d2773518e4..1f2b281602 100644 --- a/components/driver/sdmmc_host.c +++ b/components/driver/sdmmc_host.c @@ -718,6 +718,3 @@ static esp_err_t sdmmc_host_pullup_en_internal(int slot, int width) } return ESP_OK; } - -/* Deprecared public function */ -esp_err_t sdmmc_host_pullup_en(int slot, int width) __attribute__((alias("sdmmc_host_pullup_en_internal"))); diff --git a/components/driver/spi_master.c b/components/driver/spi_master.c index 456b051c2e..30d5a2fb5c 100644 --- a/components/driver/spi_master.c +++ b/components/driver/spi_master.c @@ -456,11 +456,6 @@ esp_err_t spi_bus_remove_device(spi_device_handle_t handle) return ESP_OK; } -int spi_cal_clock(int fapb, int hz, int duty_cycle, uint32_t *reg_o) -{ - return spi_ll_master_cal_clock(fapb, hz, duty_cycle, reg_o); -} - int spi_get_actual_clock(int fapb, int hz, int duty_cycle) { return spi_hal_master_cal_clock(fapb, hz, duty_cycle); diff --git a/components/esp_lcd/test_apps/rgb_lcd/main/test_rgb_panel.c b/components/esp_lcd/test_apps/rgb_lcd/main/test_rgb_panel.c index 69bc6a19da..b8b3a42056 100644 --- a/components/esp_lcd/test_apps/rgb_lcd/main/test_rgb_panel.c +++ b/components/esp_lcd/test_apps/rgb_lcd/main/test_rgb_panel.c @@ -12,7 +12,7 @@ #include "esp_lcd_panel_ops.h" #include "esp_random.h" #include "esp_attr.h" -#include "nvs_flash.h" +#include "esp_spi_flash.h" #include "test_rgb_board.h" #if CONFIG_LCD_RGB_ISR_IRAM_SAFE @@ -137,7 +137,16 @@ TEST_LCD_CALLBACK_ATTR static bool test_rgb_panel_count_in_callback(esp_lcd_pane return false; } -TEST_CASE("lcd_rgb_panel_with_nvs_read_write", "[lcd]") +static void IRAM_ATTR test_disable_flash_cache(void) +{ + // disable flash cache + spi_flash_guard_get()->start(); + esp_rom_delay_us(100000); + // enable flash cache + spi_flash_guard_get()->end(); +} + +TEST_CASE("lcd_rgb_panel_iram_safe", "[lcd]") { uint8_t *img = malloc(TEST_IMG_SIZE); TEST_ASSERT_NOT_NULL(img); @@ -155,33 +164,11 @@ TEST_CASE("lcd_rgb_panel_with_nvs_read_write", "[lcd]") printf("The LCD driver should keep flushing the color block in the background (as it's in stream mode)\r\n"); // read/write the SPI Flash by NVS APIs, the LCD driver should stay work - printf("initialize NVS flash\r\n"); - esp_err_t err = nvs_flash_init(); - if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND) { - // NVS partition was truncated and needs to be erased - TEST_ESP_OK(nvs_flash_erase()); - // Retry nvs_flash_init - err = nvs_flash_init(); - } - TEST_ESP_OK(err); - printf("open NVS storage\r\n"); - nvs_handle_t my_handle; - TEST_ESP_OK(nvs_open("storage", NVS_READWRITE, &my_handle)); - TEST_ESP_OK(nvs_erase_all(my_handle)); - int test_count; - for (int i = 0; i < 50; i++) { - printf("write %d to NVS partition\r\n", i); - TEST_ESP_OK(nvs_set_i32(my_handle, "test_count", i)); - TEST_ESP_OK(nvs_commit(my_handle)); - TEST_ESP_OK(nvs_get_i32(my_handle, "test_count", &test_count)); - TEST_ASSERT_EQUAL(i, test_count); - vTaskDelay(pdMS_TO_TICKS(50)); - } - printf("close NVS storage\r\n"); - nvs_close(my_handle); - TEST_ESP_OK(nvs_flash_deinit()); - - TEST_ASSERT(callback_calls > 50); + printf("disable the cache for a while\r\n"); + test_disable_flash_cache(); + printf("the RGB ISR handle should keep working while the flash cache is disabled\r\n"); + printf("callback calls: %d\r\n", callback_calls); + TEST_ASSERT(callback_calls > 5); printf("delete RGB panel\r\n"); TEST_ESP_OK(esp_lcd_panel_del(panel_handle)); diff --git a/components/esp_lcd/test_apps/rgb_lcd/sdkconfig.defaults.esp32s3 b/components/esp_lcd/test_apps/rgb_lcd/sdkconfig.defaults.esp32s3 index aac45bf22e..2877855408 100644 --- a/components/esp_lcd/test_apps/rgb_lcd/sdkconfig.defaults.esp32s3 +++ b/components/esp_lcd/test_apps/rgb_lcd/sdkconfig.defaults.esp32s3 @@ -1,4 +1,3 @@ CONFIG_ESP32S3_SPIRAM_SUPPORT=y -CONFIG_ESPTOOLPY_OCT_FLASH=y CONFIG_SPIRAM_MODE_OCT=y CONFIG_SPIRAM_SPEED_80M=y diff --git a/components/hal/include/hal/i2c_types.h b/components/hal/include/hal/i2c_types.h index fba0bc9c70..1864b696cc 100644 --- a/components/hal/include/hal/i2c_types.h +++ b/components/hal/include/hal/i2c_types.h @@ -76,16 +76,6 @@ typedef enum { /// Use the highest speed that is available for the clock source picked by clk_flags #define I2C_CLK_FREQ_MAX (-1) -#if CONFIG_IDF_TARGET_ESP32 -typedef enum{ - I2C_CMD_RESTART = 0, /*! Note: -> -> 1. Please use the correct serial port number for connecting your board when entering commands in your serial port tool; +> +> 1. Please use the correct serial port number for connecting your board when entering commands in your serial port tool; > 2. Your PC and board should connect to the same Wi-Fi network; @@ -50,8 +50,8 @@ The `main` folder mainly implements the BLE Mesh feature. Details can be seen i The `components` folder mainly implements the Wi-Fi feature, which allows some basic commands and `iperf-related` test commands. -> Note: -> +> Note: +> > [Iperf](https://iperf.fr) is a tool for active measurements of the maximum achievable bandwidth on IP networks. It supports tuning of various parameters related to timing, buffers and protocols (TCP, UDP, SCTP with IPv4 and IPv6). # Example Walkthrough @@ -158,13 +158,13 @@ This demo calls the `bluetooth_init` function to: ret = esp_bt_controller_init(&bt_cfg); ``` - Next, the controller is enabled in BLE Mode. + Next, the controller is enabled in BLE Mode. ```c ret = esp_bt_controller_enable(ESP_BT_MODE_BLE); ``` The controller should be enabled in `ESP_BT_MODE_BTDM`, if you want to use the dual mode (BLE + BT). There are four Bluetooth modes supported: - + * `ESP_BT_MODE_IDLE`: Bluetooth not running * `ESP_BT_MODE_BLE`: BLE mode * `ESP_BT_MODE_CLASSIC_BT`: BT Classic mode @@ -180,8 +180,8 @@ This demo calls the `bluetooth_init` function to: ### Initializing the BLE Mesh This demo calls the `ble_mesh_init` function to: - -1. Initialize the board's uuid by setting the `dev_uuid` variable, which is used to distinguish devices when provisioning. + +1. Initialize the board's uuid by setting the `dev_uuid` variable, which is used to distinguish devices when provisioning. ```c static esp_err_t ble_mesh_init(void) @@ -209,12 +209,12 @@ static esp_err_t ble_mesh_init(void) ```c ESP_BLE_MESH_PROVISIONER_PROV_LINK_OPEN_EVT, /*!< Provisioner establish a BLE Mesh link event */ - + static void example_ble_mesh_provisioning_cb(esp_ble_mesh_prov_cb_event_t event, esp_ble_mesh_prov_cb_param_t *param) { esp_err_t err; - + switch (event) { case ESP_BLE_MESH_PROVISIONER_PROV_LINK_OPEN_EVT: ESP_LOGI(TAG, "ESP_BLE_MESH_PROVISIONER_PROV_LINK_OPEN_EVT"); @@ -235,67 +235,47 @@ static esp_err_t ble_mesh_init(void) ### Initializing the Wi-Fi Console -This demo calls the `wifi_console_init` function: +This demo calls the `wifi_console_init` function: ```c initialise_wifi(); - initialize_console(); - /* Register commands */ - esp_console_register_help_command(); + esp_console_repl_t *repl = NULL; + esp_console_repl_config_t repl_config = ESP_CONSOLE_REPL_CONFIG_DEFAULT(); + esp_console_dev_uart_config_t uart_config = ESP_CONSOLE_DEV_UART_CONFIG_DEFAULT(); + // init console REPL environment + ESP_ERROR_CHECK(esp_console_new_repl_uart(&uart_config, &repl_config, &repl)); + register_wifi(); + + // start console REPL + ESP_ERROR_CHECK(esp_console_start_repl(repl)); ``` -1. Initialize the basic Wi-Fi function by calling `initialise_wifi`, which sets +1. Initialize the basic Wi-Fi function by calling `initialise_wifi`, which sets * the Current Wi-Fi power save type to `WIFI_PS_MIN_MODEM`, which indicates the station wakes up to receive beacon every DTIM period * the Wi-Fi API configuration storage type to `WIFI_STORAGE_RAM`, which indicates all configuration will only be stored in the embedded memory * the Wi-Fi operating mode to `WIFI_MODE_STA`, which allows the board to work in Station mode. -2. Initialize the Wi-Fi console by calling the `initialize_console` function. -3. Enable the `Help` function by calling the `esp_console_register_help_command()`. After that, you can view all the currently supported Wi-Fi commands by entering the `help` command in your serial port tool. -4. Register the commands by calling the `register_wifi` function. +2. Create a UART based console REPL by calling the `esp_console_new_repl_uart` function. +3. Register the commands by calling the `register_wifi` function. * An example of registering a `restart` command with a `restart()` function to handle this command can be seen below. After the initialization, you can enter the `restart` command in your serial port tool to call the `restart()` function. - -```c - static int restart(int argc, char **argv) - { - ESP_LOGI(TAG, "Restarting"); - esp_restart(); - } - const esp_console_cmd_t restart_cmd = { - .command = "restart", - .help = "Restart the program", - .hint = NULL, - .func = &restart, - }; -``` + ```c + static int restart(int argc, char **argv) + { + ESP_LOGI(TAG, "Restarting"); + esp_restart(); + } + const esp_console_cmd_t restart_cmd = { + .command = "restart", + .help = "Restart the program", + .hint = NULL, + .func = &restart, + }; + ``` -Note that the `sta`,`scan`,`ap`,`query`,`iperf`,`restart` and `heap` commands are supported in this demo. + Note that the `sta`,`scan`,`ap`,`query`,`iperf`,`restart` and `heap` commands are supported in this demo. -The main program of the Wi-Fi constantly reads data from the command line. The `esp_console_run` function will parse the command entered from your serial port tool, then call the handler function registered for this command. - -```c - /* Main loop */ - while (true) { - /* Get a line using linenoise. - * The line is returned when ENTER is pressed. - */ - char *line = linenoise(prompt); - if (line == NULL) { /* Ignore empty lines */ - continue; - } - /* Add the command to the history */ - linenoiseHistoryAdd(line); - - /* Try to run the command */ - int ret; - esp_err_t err = esp_console_run(line, &ret); - ... - /* linenoise allocates line buffer on the heap, so need to free it */ - linenoiseFree(line); - } - return; -} -``` +4. Start the REPL by calling `esp_console_start_repl`. The repl task internally will read data from the command line and then invoke the handler previously registered. diff --git a/tools/check_term.py b/tools/check_term.py index b957c893f7..37b94fce44 100644 --- a/tools/check_term.py +++ b/tools/check_term.py @@ -1,18 +1,7 @@ #!/usr/bin/env python # -# Copyright 2019 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. +# SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD +# SPDX-License-Identifier: Apache-2.0 from __future__ import print_function @@ -33,10 +22,10 @@ if __name__ == '__main__': print('WARNING: The TERM environment variable is not defined. The curses-based menuconfig ' 'will probably fail to run. Please consult the documentation of your terminal to set it up.') else: - if term.endswith('256color'): + if term.endswith('256color') or term in ['alacritty']: print('TERM environment variable is set to "{}"'.format(term)) else: print('WARNING: Menuconfig may fail because of the TERM environment variable is set ' 'to "{}". Please consult the documentation of your terminal to set it up. ' 'Some good, proved to been working setups include xterm-256color, screen-256color, ' - 'rxvt-unicode-256color.'.format(term)) + 'rxvt-unicode-256color, alacritty.'.format(term)) diff --git a/tools/ci/check_copyright_ignore.txt b/tools/ci/check_copyright_ignore.txt index bea739ef1a..7a564caa4f 100644 --- a/tools/ci/check_copyright_ignore.txt +++ b/tools/ci/check_copyright_ignore.txt @@ -2309,7 +2309,6 @@ tools/ble/lib_gap.py tools/ble/lib_gatt.py tools/build_apps.py tools/catch/catch.hpp -tools/check_term.py tools/ci/check_artifacts_expire_time.py tools/ci/check_build_warnings.py tools/ci/check_callgraph.py diff --git a/tools/ci/mypy_ignore_list.txt b/tools/ci/mypy_ignore_list.txt index 4ce0370c85..04b33b6d30 100644 --- a/tools/ci/mypy_ignore_list.txt +++ b/tools/ci/mypy_ignore_list.txt @@ -147,7 +147,6 @@ examples/wifi/iperf/iperf_test.py tools/ble/lib_ble_client.py tools/ble/lib_gap.py tools/ble/lib_gatt.py -tools/check_term.py tools/ci/check_artifacts_expire_time.py tools/ci/check_callgraph.py tools/ci/check_codeowners.py