mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-02 12:14:32 +02:00
refactor(ledc): remove deprecated API/macro for v6.0
This commit is contained in:
@@ -10,13 +10,12 @@ endif()
|
||||
if(${target} STREQUAL "linux")
|
||||
set(priv_requires "")
|
||||
else()
|
||||
set(priv_requires esp_pm)
|
||||
set(priv_requires esp_pm esp_driver_gpio)
|
||||
endif()
|
||||
|
||||
idf_component_register(
|
||||
SRCS ${srcs}
|
||||
INCLUDE_DIRS ${public_include}
|
||||
PRIV_REQUIRES "${priv_requires}"
|
||||
REQUIRES esp_driver_gpio # IDF-11989: Remove this in IDF v6.0
|
||||
LDFRAGMENTS "linker.lf"
|
||||
)
|
||||
|
@@ -9,27 +9,11 @@
|
||||
#include "esp_err.h"
|
||||
#include "esp_intr_alloc.h"
|
||||
#include "hal/ledc_types.h"
|
||||
#include "driver/gpio.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if SOC_LEDC_SUPPORT_APB_CLOCK
|
||||
/**
|
||||
* @brief Frequency of one of the LEDC peripheral clock sources, APB_CLK
|
||||
* @note This macro should have no use in your application, we keep it here only for backward compatible
|
||||
*/
|
||||
#define LEDC_APB_CLK_HZ _Pragma ("GCC warning \"'LEDC_APB_CLK_HZ' macro is deprecated\"") (APB_CLK_FREQ)
|
||||
#endif
|
||||
#if SOC_LEDC_SUPPORT_REF_TICK
|
||||
/**
|
||||
* @brief Frequency of one of the LEDC peripheral clock sources, REF_TICK
|
||||
* @note This macro should have no use in your application, we keep it here only for backward compatible
|
||||
*/
|
||||
#define LEDC_REF_CLK_HZ _Pragma ("GCC warning \"'LEDC_REF_CLK_HZ' macro is deprecated\"") (REF_CLK_FREQ)
|
||||
#endif
|
||||
|
||||
#define LEDC_ERR_DUTY (0xFFFFFFFF)
|
||||
#define LEDC_ERR_VAL (-1)
|
||||
|
||||
@@ -349,27 +333,6 @@ esp_err_t ledc_set_fade(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t
|
||||
*/
|
||||
esp_err_t ledc_isr_register(void (*fn)(void *), void *arg, int intr_alloc_flags, ledc_isr_handle_t *handle);
|
||||
|
||||
/**
|
||||
* @brief Configure LEDC timer settings
|
||||
*
|
||||
* This function does not take care of whether the chosen clock source is enabled or not, also does not handle the clock source
|
||||
* to meet channel sleep mode choice.
|
||||
*
|
||||
* If the chosen clock source is a new clock source to the LEDC timer, please use `ledc_timer_config`;
|
||||
* If the clock source is kept to be the same, but frequency needs to be updated, please use `ledc_set_freq`.
|
||||
*
|
||||
* @param speed_mode Select the LEDC channel group with specified speed mode. Note that not all targets support high speed mode.
|
||||
* @param timer_sel Timer index (0-3), there are 4 timers in LEDC module
|
||||
* @param clock_divider Timer clock divide value, the timer clock is divided from the selected clock source
|
||||
* @param duty_resolution Resolution of duty setting in number of bits. The range is [1, SOC_LEDC_TIMER_BIT_WIDTH]
|
||||
* @param clk_src Select LEDC source clock.
|
||||
*
|
||||
* @return
|
||||
* - (-1) Parameter error
|
||||
* - Other Current LEDC duty
|
||||
*/
|
||||
esp_err_t ledc_timer_set(ledc_mode_t speed_mode, ledc_timer_t timer_sel, uint32_t clock_divider, uint32_t duty_resolution, ledc_clk_src_t clk_src) __attribute__((deprecated("Please use ledc_timer_config() or ledc_set_freq()")));
|
||||
|
||||
/**
|
||||
* @brief Reset LEDC timer
|
||||
*
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include "clk_ctrl_os.h"
|
||||
#include "esp_private/esp_sleep_internal.h"
|
||||
#include "esp_private/periph_ctrl.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "esp_private/gpio.h"
|
||||
#include "esp_private/esp_clk_tree_common.h"
|
||||
#include "esp_private/esp_gpio_reserve.h"
|
||||
@@ -260,13 +261,6 @@ static esp_err_t ledc_set_timer_params(ledc_mode_t speed_mode, ledc_timer_t time
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
// Deprecated public API
|
||||
esp_err_t ledc_timer_set(ledc_mode_t speed_mode, ledc_timer_t timer_sel, uint32_t clock_divider, uint32_t duty_resolution,
|
||||
ledc_clk_src_t clk_src)
|
||||
{
|
||||
return ledc_set_timer_params(speed_mode, timer_sel, clock_divider, duty_resolution, clk_src);
|
||||
}
|
||||
|
||||
static IRAM_ATTR esp_err_t ledc_duty_config(ledc_mode_t speed_mode, ledc_channel_t channel, int hpoint_val,
|
||||
int duty_val, ledc_duty_direction_t duty_direction, uint32_t duty_num, uint32_t duty_cycle, uint32_t duty_scale)
|
||||
{
|
||||
|
@@ -14,14 +14,13 @@
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "unity.h"
|
||||
#include "soc/gpio_periph.h"
|
||||
#include "soc/io_mux_reg.h"
|
||||
#include "esp_system.h"
|
||||
#include "esp_timer.h"
|
||||
#include "driver/ledc.h"
|
||||
#include "soc/ledc_struct.h"
|
||||
#include "esp_clk_tree.h"
|
||||
#include "test_ledc_utils.h"
|
||||
#include "driver/gpio.h"
|
||||
|
||||
static void fade_setup(void)
|
||||
{
|
||||
|
@@ -49,6 +49,15 @@ GPIO
|
||||
|
||||
:func:`gpio_iomux_in` and :func:`gpio_iomux_out` have been replaced by :func:`gpio_iomux_input` and :func:`gpio_iomux_output`, and have been moved to ``esp_private/gpio.h`` header file as private APIs for internal use only.
|
||||
|
||||
LEDC
|
||||
----
|
||||
|
||||
- :func:`ledc_timer_set` has been removed. Use :func:`ledc_timer_config` or :func:`ledc_set_freq` instead.
|
||||
|
||||
- ``LEDC_APB_CLK_HZ`` and ``LEDC_REF_CLK_HZ`` have been removed.
|
||||
|
||||
- Removed esp_driver_gpio as a public required component from esp_driver_ledc.
|
||||
|
||||
I2C
|
||||
---
|
||||
|
||||
|
@@ -49,6 +49,15 @@ GPIO
|
||||
|
||||
:func:`gpio_iomux_in` 和 :func:`gpio_iomux_out` 已被 :func:`gpio_iomux_input` 和 :func:`gpio_iomux_output` 函数取代, 并移至 ``esp_private/gpio.h`` 头文件中作为仅供内部使用的私有 API。
|
||||
|
||||
LEDC
|
||||
----
|
||||
|
||||
- :func:`ledc_timer_set` 已被移除。请使用 :func:`ledc_timer_config` 或 :func:`ledc_set_freq` 代替。
|
||||
|
||||
- ``LEDC_APB_CLK_HZ`` 和 ``LEDC_REF_CLK_HZ`` 已被移除。
|
||||
|
||||
- esp_driver_gpio 不再作为 esp_driver_ledc 的公共依赖组件。
|
||||
|
||||
I2C
|
||||
---
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* AliGenie - Example
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
@@ -419,11 +419,10 @@ void user_genie_event_handle(genie_event_t event, void *p_arg)
|
||||
ESP_LOGI(TAG, "GENIE_EVT_RESET_BY_REPEAT_NOTIFY");
|
||||
lightbulb_set_switch(false);
|
||||
lightbulb_effect_config_t effect1 = {
|
||||
.red = 0,
|
||||
.green = 255,
|
||||
.blue = 0,
|
||||
.max_brightness = 100,
|
||||
.min_brightness = 0,
|
||||
.hue = 120,
|
||||
.saturation = 100,
|
||||
.max_value_brightness = 100,
|
||||
.min_value_brightness = 0,
|
||||
.effect_cycle_ms = CONFIG_LIGHT_BLINK_PERIOD_MS,
|
||||
.effect_type = EFFECT_BLINK,
|
||||
.mode = WORK_COLOR,
|
||||
@@ -435,11 +434,10 @@ void user_genie_event_handle(genie_event_t event, void *p_arg)
|
||||
ESP_LOGI(TAG, "GENIE_EVT_HW_RESET_START");
|
||||
lightbulb_set_switch(false);
|
||||
lightbulb_effect_config_t effect2 = {
|
||||
.red = 0,
|
||||
.green = 255,
|
||||
.blue = 0,
|
||||
.max_brightness = 100,
|
||||
.min_brightness = 0,
|
||||
.hue = 120,
|
||||
.saturation = 100,
|
||||
.max_value_brightness = 100,
|
||||
.min_value_brightness = 0,
|
||||
.effect_cycle_ms = CONFIG_LIGHT_BLINK_PERIOD_MS,
|
||||
.effect_type = EFFECT_BLINK,
|
||||
.mode = WORK_COLOR,
|
||||
@@ -1009,7 +1007,7 @@ static void example_ble_mesh_config_server_cb(esp_ble_mesh_cfg_server_cb_event_t
|
||||
#if GENIE_VENDOR_MODEL_VERSION == 0
|
||||
|
||||
#elif GENIE_VENDOR_MODEL_VERSION == 1
|
||||
// local bind AppKEY and Subcribe Group Address
|
||||
// local bind AppKEY and Subscribe Group Address
|
||||
local_operation(param->value.state_change.appkey_add.app_idx);
|
||||
// genie mesh init
|
||||
genie_mesh_init();
|
||||
@@ -1315,11 +1313,10 @@ static esp_err_t ble_mesh_init(void)
|
||||
ESP_LOGW(TAG, "node not provisioned");
|
||||
lightbulb_set_switch(false);
|
||||
lightbulb_effect_config_t effect3 = {
|
||||
.red = 0,
|
||||
.green = 255,
|
||||
.blue = 0,
|
||||
.max_brightness = 100,
|
||||
.min_brightness = 0,
|
||||
.hue = 120,
|
||||
.saturation = 100,
|
||||
.max_value_brightness = 100,
|
||||
.min_value_brightness = 0,
|
||||
.effect_cycle_ms = CONFIG_LIGHT_BLINK_PERIOD_MS,
|
||||
.effect_type = EFFECT_BLINK,
|
||||
.mode = WORK_COLOR,
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* AliGenie - Example
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
@@ -45,12 +45,12 @@ static void board_led_init(void)
|
||||
lightbulb_config_t config = {
|
||||
.type = DRIVER_ESP_PWM,
|
||||
.driver_conf.pwm.freq_hz = 4000,
|
||||
.capability.enable_fades = true,
|
||||
.capability.fades_ms = CONFIG_LIGHT_FADE_PERIOD_MS,
|
||||
.capability.enable_fade = true,
|
||||
.capability.fade_time_ms = CONFIG_LIGHT_FADE_PERIOD_MS,
|
||||
.capability.enable_lowpower = false,
|
||||
.capability.enable_mix_cct = false,
|
||||
.capability.enable_hardware_cct = false,
|
||||
.capability.enable_status_storage = false,
|
||||
.capability.mode_mask = COLOR_MODE,
|
||||
.capability.led_beads = LED_BEADS_3CH_RGB,
|
||||
.capability.storage_cb = NULL,
|
||||
.capability.sync_change_brightness_value = true,
|
||||
.io_conf.pwm_io.red = CONFIG_LIGHT_GPIO_RED,
|
||||
|
@@ -1,3 +1,3 @@
|
||||
## IDF Component Manager Manifest File
|
||||
dependencies:
|
||||
espressif/lightbulb_driver: "==0.5.5"
|
||||
espressif/lightbulb_driver: ">=1.8.3"
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017 Intel Corporation
|
||||
* SPDX-FileContributor: 2018-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileContributor: 2018-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -61,10 +61,10 @@ static void board_led_init(void)
|
||||
.type = DRIVER_WS2812,
|
||||
.driver_conf.ws2812.led_num = 3,
|
||||
.driver_conf.ws2812.ctrl_io = 8,
|
||||
.capability.enable_fades = true,
|
||||
.capability.fades_ms = 800,
|
||||
.capability.enable_fade = true,
|
||||
.capability.fade_time_ms = 800,
|
||||
.capability.enable_status_storage = false,
|
||||
.capability.mode_mask = COLOR_MODE,
|
||||
.capability.led_beads = LED_BEADS_3CH_RGB,
|
||||
.capability.storage_cb = NULL,
|
||||
.external_limit = NULL,
|
||||
.gamma_conf = NULL,
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017 Intel Corporation
|
||||
* SPDX-FileContributor: 2018-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileContributor: 2018-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -58,10 +58,10 @@ static void board_led_init(void)
|
||||
.type = DRIVER_WS2812,
|
||||
.driver_conf.ws2812.led_num = 3,
|
||||
.driver_conf.ws2812.ctrl_io = 8,
|
||||
.capability.enable_fades = true,
|
||||
.capability.fades_ms = 800,
|
||||
.capability.enable_fade = true,
|
||||
.capability.fade_time_ms = 800,
|
||||
.capability.enable_status_storage = false,
|
||||
.capability.mode_mask = COLOR_MODE,
|
||||
.capability.led_beads = LED_BEADS_3CH_RGB,
|
||||
.capability.storage_cb = NULL,
|
||||
.external_limit = NULL,
|
||||
.gamma_conf = NULL,
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017 Intel Corporation
|
||||
* SPDX-FileContributor: 2018-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileContributor: 2018-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -41,10 +41,10 @@ static void board_led_init(void)
|
||||
.type = DRIVER_WS2812,
|
||||
.driver_conf.ws2812.led_num = 3,
|
||||
.driver_conf.ws2812.ctrl_io = 8,
|
||||
.capability.enable_fades = true,
|
||||
.capability.fades_ms = 800,
|
||||
.capability.enable_fade = true,
|
||||
.capability.fade_time_ms = 800,
|
||||
.capability.enable_status_storage = false,
|
||||
.capability.mode_mask = COLOR_MODE,
|
||||
.capability.led_beads = LED_BEADS_3CH_RGB,
|
||||
.capability.storage_cb = NULL,
|
||||
.external_limit = NULL,
|
||||
.gamma_conf = NULL,
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017 Intel Corporation
|
||||
* SPDX-FileContributor: 2018-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileContributor: 2018-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -34,10 +34,10 @@ static void board_led_init(void)
|
||||
.type = DRIVER_WS2812,
|
||||
.driver_conf.ws2812.led_num = 3,
|
||||
.driver_conf.ws2812.ctrl_io = 8,
|
||||
.capability.enable_fades = true,
|
||||
.capability.fades_ms = 800,
|
||||
.capability.enable_fade = true,
|
||||
.capability.fade_time_ms = 800,
|
||||
.capability.enable_status_storage = false,
|
||||
.capability.mode_mask = COLOR_MODE,
|
||||
.capability.led_beads = LED_BEADS_3CH_RGB,
|
||||
.capability.storage_cb = NULL,
|
||||
.external_limit = NULL,
|
||||
.gamma_conf = NULL,
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017 Intel Corporation
|
||||
* SPDX-FileContributor: 2018-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileContributor: 2018-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -34,10 +34,10 @@ static void board_led_init(void)
|
||||
.type = DRIVER_WS2812,
|
||||
.driver_conf.ws2812.led_num = 3,
|
||||
.driver_conf.ws2812.ctrl_io = 8,
|
||||
.capability.enable_fades = true,
|
||||
.capability.fades_ms = 800,
|
||||
.capability.enable_fade = true,
|
||||
.capability.fade_time_ms = 800,
|
||||
.capability.enable_status_storage = false,
|
||||
.capability.mode_mask = COLOR_MODE,
|
||||
.capability.led_beads = LED_BEADS_3CH_RGB,
|
||||
.capability.storage_cb = NULL,
|
||||
.external_limit = NULL,
|
||||
.gamma_conf = NULL,
|
||||
|
Reference in New Issue
Block a user