Merge branch 'bugfix/ledc_update_duty_wait' into 'master'

fix(ledc): duty_start update bit should wait for its self-clear before next set

Closes IDF-11989

See merge request espressif/esp-idf!39949
This commit is contained in:
Song Ruo Jing
2025-07-24 14:55:16 +08:00
31 changed files with 111 additions and 167 deletions

View File

@@ -10,13 +10,12 @@ endif()
if(${target} STREQUAL "linux") if(${target} STREQUAL "linux")
set(priv_requires "") set(priv_requires "")
else() else()
set(priv_requires esp_pm) set(priv_requires esp_pm esp_driver_gpio)
endif() endif()
idf_component_register( idf_component_register(
SRCS ${srcs} SRCS ${srcs}
INCLUDE_DIRS ${public_include} INCLUDE_DIRS ${public_include}
PRIV_REQUIRES "${priv_requires}" PRIV_REQUIRES "${priv_requires}"
REQUIRES esp_driver_gpio # IDF-11989: Remove this in IDF v6.0
LDFRAGMENTS "linker.lf" LDFRAGMENTS "linker.lf"
) )

View File

@@ -9,27 +9,11 @@
#include "esp_err.h" #include "esp_err.h"
#include "esp_intr_alloc.h" #include "esp_intr_alloc.h"
#include "hal/ledc_types.h" #include "hal/ledc_types.h"
#include "driver/gpio.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #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_DUTY (0xFFFFFFFF)
#define LEDC_ERR_VAL (-1) #define LEDC_ERR_VAL (-1)
@@ -52,7 +36,7 @@ typedef struct {
int gpio_num; /*!< the LEDC output gpio_num, if you want to use gpio16, gpio_num = 16 */ int gpio_num; /*!< the LEDC output gpio_num, if you want to use gpio16, gpio_num = 16 */
ledc_mode_t speed_mode; /*!< LEDC speed speed_mode, high-speed mode (only exists on esp32) or low-speed mode */ ledc_mode_t speed_mode; /*!< LEDC speed speed_mode, high-speed mode (only exists on esp32) or low-speed mode */
ledc_channel_t channel; /*!< LEDC channel (0 - LEDC_CHANNEL_MAX-1) */ ledc_channel_t channel; /*!< LEDC channel (0 - LEDC_CHANNEL_MAX-1) */
ledc_intr_type_t intr_type; /*!< configure interrupt, Fade interrupt enable or Fade interrupt disable */ ledc_intr_type_t intr_type __attribute__((deprecated)); /*!< @deprecated, no need to explicitly configure interrupt, handled in the driver */
ledc_timer_t timer_sel; /*!< Select the timer source of channel (0 - LEDC_TIMER_MAX-1) */ ledc_timer_t timer_sel; /*!< Select the timer source of channel (0 - LEDC_TIMER_MAX-1) */
uint32_t duty; /*!< LEDC channel duty, the range of duty setting is [0, (2**duty_resolution)] */ uint32_t duty; /*!< LEDC channel duty, the range of duty setting is [0, (2**duty_resolution)] */
int hpoint; /*!< LEDC channel hpoint value, the range is [0, (2**duty_resolution)-1] */ int hpoint; /*!< LEDC channel hpoint value, the range is [0, (2**duty_resolution)-1] */
@@ -347,28 +331,7 @@ esp_err_t ledc_set_fade(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t
* - ESP_ERR_INVALID_ARG Parameter error * - ESP_ERR_INVALID_ARG Parameter error
* - ESP_ERR_NOT_FOUND Failed to find available interrupt source * - ESP_ERR_NOT_FOUND Failed to find available interrupt source
*/ */
esp_err_t ledc_isr_register(void (*fn)(void *), void *arg, int intr_alloc_flags, ledc_isr_handle_t *handle); esp_err_t ledc_isr_register(void (*fn)(void *), void *arg, int intr_alloc_flags, ledc_isr_handle_t *handle) __attribute__((deprecated("LEDC interrupt handling is implemented by driver itself, please only register event callbacks if necessary")));
/**
* @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 * @brief Reset LEDC timer

View File

@@ -20,6 +20,7 @@
#include "clk_ctrl_os.h" #include "clk_ctrl_os.h"
#include "esp_private/esp_sleep_internal.h" #include "esp_private/esp_sleep_internal.h"
#include "esp_private/periph_ctrl.h" #include "esp_private/periph_ctrl.h"
#include "driver/gpio.h"
#include "esp_private/gpio.h" #include "esp_private/gpio.h"
#include "esp_private/esp_clk_tree_common.h" #include "esp_private/esp_clk_tree_common.h"
#include "esp_private/esp_gpio_reserve.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; 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, 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) int duty_val, ledc_duty_direction_t duty_direction, uint32_t duty_num, uint32_t duty_cycle, uint32_t duty_scale)
{ {
@@ -832,7 +826,6 @@ esp_err_t ledc_channel_config(const ledc_channel_config_t *ledc_conf)
int gpio_num = ledc_conf->gpio_num; int gpio_num = ledc_conf->gpio_num;
uint32_t ledc_channel = ledc_conf->channel; uint32_t ledc_channel = ledc_conf->channel;
uint32_t timer_select = ledc_conf->timer_sel; uint32_t timer_select = ledc_conf->timer_sel;
uint32_t intr_type = ledc_conf->intr_type;
uint32_t duty = ledc_conf->duty; uint32_t duty = ledc_conf->duty;
uint32_t hpoint = ledc_conf->hpoint; uint32_t hpoint = ledc_conf->hpoint;
bool output_invert = ledc_conf->flags.output_invert; bool output_invert = ledc_conf->flags.output_invert;
@@ -840,7 +833,6 @@ esp_err_t ledc_channel_config(const ledc_channel_config_t *ledc_conf)
LEDC_ARG_CHECK(speed_mode < LEDC_SPEED_MODE_MAX, "speed_mode"); LEDC_ARG_CHECK(speed_mode < LEDC_SPEED_MODE_MAX, "speed_mode");
LEDC_ARG_CHECK(GPIO_IS_VALID_OUTPUT_GPIO(gpio_num), "gpio_num"); LEDC_ARG_CHECK(GPIO_IS_VALID_OUTPUT_GPIO(gpio_num), "gpio_num");
LEDC_ARG_CHECK(timer_select < LEDC_TIMER_MAX, "timer_select"); LEDC_ARG_CHECK(timer_select < LEDC_TIMER_MAX, "timer_select");
LEDC_ARG_CHECK(intr_type < LEDC_INTR_MAX, "intr_type");
LEDC_ARG_CHECK(ledc_conf->sleep_mode < LEDC_SLEEP_MODE_INVALID, "sleep_mode"); LEDC_ARG_CHECK(ledc_conf->sleep_mode < LEDC_SLEEP_MODE_INVALID, "sleep_mode");
#if !SOC_LEDC_SUPPORT_SLEEP_RETENTION #if !SOC_LEDC_SUPPORT_SLEEP_RETENTION
ESP_RETURN_ON_FALSE(ledc_conf->sleep_mode != LEDC_SLEEP_MODE_NO_ALIVE_ALLOW_PD, ESP_ERR_NOT_SUPPORTED, LEDC_TAG, "register back up is not supported"); ESP_RETURN_ON_FALSE(ledc_conf->sleep_mode != LEDC_SLEEP_MODE_NO_ALIVE_ALLOW_PD, ESP_ERR_NOT_SUPPORTED, LEDC_TAG, "register back up is not supported");
@@ -881,10 +873,6 @@ esp_err_t ledc_channel_config(const ledc_channel_config_t *ledc_conf)
ledc_update_duty(speed_mode, ledc_channel); ledc_update_duty(speed_mode, ledc_channel);
/*bind the channel with the timer*/ /*bind the channel with the timer*/
ledc_bind_channel_timer(speed_mode, ledc_channel, timer_select); ledc_bind_channel_timer(speed_mode, ledc_channel, timer_select);
/*set interrupt type*/
portENTER_CRITICAL(&ledc_spinlock);
ledc_enable_intr_type(speed_mode, ledc_channel, intr_type);
portEXIT_CRITICAL(&ledc_spinlock);
ESP_LOGD(LEDC_TAG, "LEDC_PWM CHANNEL %"PRIu32"|GPIO %02u|Duty %04"PRIu32"|Time %"PRIu32, ESP_LOGD(LEDC_TAG, "LEDC_PWM CHANNEL %"PRIu32"|GPIO %02u|Duty %04"PRIu32"|Time %"PRIu32,
ledc_channel, gpio_num, duty, timer_select); ledc_channel, gpio_num, duty, timer_select);
/*set LEDC signal in gpio matrix*/ /*set LEDC signal in gpio matrix*/
@@ -975,7 +963,7 @@ esp_err_t ledc_channel_config(const ledc_channel_config_t *ledc_conf)
static void _ledc_update_duty(ledc_mode_t speed_mode, ledc_channel_t channel) static void _ledc_update_duty(ledc_mode_t speed_mode, ledc_channel_t channel)
{ {
ledc_hal_set_sig_out_en(&(p_ledc_obj[speed_mode]->ledc_hal), channel, true); ledc_hal_set_sig_out_en(&(p_ledc_obj[speed_mode]->ledc_hal), channel, true);
ledc_hal_set_duty_start(&(p_ledc_obj[speed_mode]->ledc_hal), channel, true); ledc_hal_set_duty_start(&(p_ledc_obj[speed_mode]->ledc_hal), channel);
ledc_ls_channel_update(speed_mode, channel); ledc_ls_channel_update(speed_mode, channel);
} }
@@ -998,7 +986,6 @@ esp_err_t ledc_stop(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t idl
portENTER_CRITICAL_SAFE(&ledc_spinlock); portENTER_CRITICAL_SAFE(&ledc_spinlock);
ledc_hal_set_idle_level(&(p_ledc_obj[speed_mode]->ledc_hal), channel, idle_level); ledc_hal_set_idle_level(&(p_ledc_obj[speed_mode]->ledc_hal), channel, idle_level);
ledc_hal_set_sig_out_en(&(p_ledc_obj[speed_mode]->ledc_hal), channel, false); ledc_hal_set_sig_out_en(&(p_ledc_obj[speed_mode]->ledc_hal), channel, false);
ledc_hal_set_duty_start(&(p_ledc_obj[speed_mode]->ledc_hal), channel, false);
ledc_ls_channel_update(speed_mode, channel); ledc_ls_channel_update(speed_mode, channel);
portEXIT_CRITICAL_SAFE(&ledc_spinlock); portEXIT_CRITICAL_SAFE(&ledc_spinlock);
return ESP_OK; return ESP_OK;
@@ -1261,7 +1248,7 @@ static void IRAM_ATTR ledc_fade_isr(void *arg)
cycle, cycle,
scale); scale);
s_ledc_fade_rec[speed_mode][channel]->fsm = LEDC_FSM_HW_FADE; s_ledc_fade_rec[speed_mode][channel]->fsm = LEDC_FSM_HW_FADE;
ledc_hal_set_duty_start(&(p_ledc_obj[speed_mode]->ledc_hal), channel, true); ledc_hal_set_duty_start(&(p_ledc_obj[speed_mode]->ledc_hal), channel);
ledc_ls_channel_update(speed_mode, channel); ledc_ls_channel_update(speed_mode, channel);
} }
portEXIT_CRITICAL_ISR(&ledc_spinlock); portEXIT_CRITICAL_ISR(&ledc_spinlock);
@@ -1534,7 +1521,7 @@ esp_err_t ledc_fade_func_install(int intr_alloc_flags)
{ {
LEDC_CHECK(s_ledc_fade_isr_handle == NULL, "fade function already installed", ESP_ERR_INVALID_STATE); LEDC_CHECK(s_ledc_fade_isr_handle == NULL, "fade function already installed", ESP_ERR_INVALID_STATE);
//OR intr_alloc_flags with ESP_INTR_FLAG_IRAM because the fade isr is in IRAM //OR intr_alloc_flags with ESP_INTR_FLAG_IRAM because the fade isr is in IRAM
return ledc_isr_register(ledc_fade_isr, NULL, intr_alloc_flags | ESP_INTR_FLAG_IRAM, &s_ledc_fade_isr_handle); return esp_intr_alloc(ETS_LEDC_INTR_SOURCE, intr_alloc_flags | ESP_INTR_FLAG_IRAM, ledc_fade_isr, NULL, &s_ledc_fade_isr_handle);
} }
void ledc_fade_func_uninstall(void) void ledc_fade_func_uninstall(void)

View File

@@ -14,14 +14,13 @@
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
#include "unity.h" #include "unity.h"
#include "soc/gpio_periph.h"
#include "soc/io_mux_reg.h"
#include "esp_system.h" #include "esp_system.h"
#include "esp_timer.h" #include "esp_timer.h"
#include "driver/ledc.h" #include "driver/ledc.h"
#include "soc/ledc_struct.h" #include "soc/ledc_struct.h"
#include "esp_clk_tree.h" #include "esp_clk_tree.h"
#include "test_ledc_utils.h" #include "test_ledc_utils.h"
#include "driver/gpio.h"
static void fade_setup(void) static void fade_setup(void)
{ {
@@ -91,13 +90,6 @@ TEST_CASE("LEDC channel config wrong channel", "[ledc]")
TEST_ASSERT(ledc_channel_config(&ledc_ch_config) == ESP_ERR_INVALID_ARG); TEST_ASSERT(ledc_channel_config(&ledc_ch_config) == ESP_ERR_INVALID_ARG);
} }
TEST_CASE("LEDC channel config wrong interrupt type", "[ledc]")
{
ledc_channel_config_t ledc_ch_config = initialize_channel_config();
ledc_ch_config.intr_type = 2;
TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, ledc_channel_config(&ledc_ch_config));
}
TEST_CASE("LEDC wrong timer", "[ledc]") TEST_CASE("LEDC wrong timer", "[ledc]")
{ {
ledc_channel_config_t ledc_ch_config = initialize_channel_config(); ledc_channel_config_t ledc_ch_config = initialize_channel_config();
@@ -150,6 +142,12 @@ TEST_CASE("LEDC output idle level test", "[ledc]")
TEST_ESP_OK(ledc_stop(test_speed_mode, LEDC_CHANNEL_0, !current_level)); TEST_ESP_OK(ledc_stop(test_speed_mode, LEDC_CHANNEL_0, !current_level));
vTaskDelay(1000 / portTICK_PERIOD_MS); vTaskDelay(1000 / portTICK_PERIOD_MS);
TEST_ASSERT_EQUAL_INT32(!current_level, LEDC.channel_group[test_speed_mode].channel[LEDC_CHANNEL_0].conf0.idle_lv); TEST_ASSERT_EQUAL_INT32(!current_level, LEDC.channel_group[test_speed_mode].channel[LEDC_CHANNEL_0].conf0.idle_lv);
// check real output level over some period
gpio_input_enable(PULSE_IO);
for (int i = 0; i < 40; i++) {
TEST_ASSERT_EQUAL_INT32(!current_level, gpio_get_level(PULSE_IO));
esp_rom_delay_us(50);
}
} }
TEST_CASE("LEDC iterate over all channel and timer configs", "[ledc]") TEST_CASE("LEDC iterate over all channel and timer configs", "[ledc]")

View File

@@ -18,7 +18,6 @@ ledc_channel_config_t initialize_channel_config(void)
config.gpio_num = PULSE_IO; config.gpio_num = PULSE_IO;
config.speed_mode = TEST_SPEED_MODE; config.speed_mode = TEST_SPEED_MODE;
config.channel = LEDC_CHANNEL_0; config.channel = LEDC_CHANNEL_0;
config.intr_type = LEDC_INTR_DISABLE;
config.timer_sel = LEDC_TIMER_0; config.timer_sel = LEDC_TIMER_0;
config.duty = 4000; config.duty = 4000;
config.hpoint = 0; config.hpoint = 0;

View File

@@ -481,13 +481,15 @@ static inline void ledc_ll_set_sig_out_en(ledc_dev_t *hw, ledc_mode_t speed_mode
* @param hw Beginning address of the peripheral registers * @param hw Beginning address of the peripheral registers
* @param speed_mode LEDC speed_mode, high-speed mode or low-speed mode * @param speed_mode LEDC speed_mode, high-speed mode or low-speed mode
* @param channel_num LEDC channel index (0-7), select from ledc_channel_t * @param channel_num LEDC channel index (0-7), select from ledc_channel_t
* @param duty_start The duty start
* *
* @return None * @return None
*/ */
static inline void ledc_ll_set_duty_start(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_channel_t channel_num, bool duty_start) static inline void ledc_ll_set_duty_start(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_channel_t channel_num)
{ {
hw->channel_group[speed_mode].channel[channel_num].conf1.duty_start = duty_start; // wait until the last duty change took effect (duty_start bit will be self-cleared when duty update or fade is done)
// this is necessary on ESP32 only, otherwise, internal logic might mess up (later targets with SOC_LEDC_SUPPORT_FADE_STOP allow to re-configure parameters while last update is still in progress)
while (hw->channel_group[speed_mode].channel[channel_num].conf1.duty_start);
hw->channel_group[speed_mode].channel[channel_num].conf1.duty_start = 1;
} }
/** /**

View File

@@ -458,13 +458,12 @@ static inline void ledc_ll_set_sig_out_en(ledc_dev_t *hw, ledc_mode_t speed_mode
* @param hw Beginning address of the peripheral registers * @param hw Beginning address of the peripheral registers
* @param speed_mode LEDC speed_mode, high-speed mode or low-speed mode * @param speed_mode LEDC speed_mode, high-speed mode or low-speed mode
* @param channel_num LEDC channel index (0-7), select from ledc_channel_t * @param channel_num LEDC channel index (0-7), select from ledc_channel_t
* @param duty_start The duty start
* *
* @return None * @return None
*/ */
static inline void ledc_ll_set_duty_start(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_channel_t channel_num, bool duty_start) static inline void ledc_ll_set_duty_start(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_channel_t channel_num)
{ {
hw->channel_group[speed_mode].channel[channel_num].conf1.duty_start = duty_start; hw->channel_group[speed_mode].channel[channel_num].conf1.duty_start = 1;
} }
/** /**

View File

@@ -459,13 +459,12 @@ static inline void ledc_ll_set_sig_out_en(ledc_dev_t *hw, ledc_mode_t speed_mode
* @param hw Beginning address of the peripheral registers * @param hw Beginning address of the peripheral registers
* @param speed_mode LEDC speed_mode, high-speed mode or low-speed mode * @param speed_mode LEDC speed_mode, high-speed mode or low-speed mode
* @param channel_num LEDC channel index (0-7), select from ledc_channel_t * @param channel_num LEDC channel index (0-7), select from ledc_channel_t
* @param duty_start The duty start
* *
* @return None * @return None
*/ */
static inline void ledc_ll_set_duty_start(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_channel_t channel_num, bool duty_start) static inline void ledc_ll_set_duty_start(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_channel_t channel_num)
{ {
hw->channel_group[speed_mode].channel[channel_num].conf1.duty_start = duty_start; hw->channel_group[speed_mode].channel[channel_num].conf1.duty_start = 1;
} }
/** /**

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -458,13 +458,12 @@ static inline void ledc_ll_set_sig_out_en(ledc_dev_t *hw, ledc_mode_t speed_mode
* @param hw Beginning address of the peripheral registers * @param hw Beginning address of the peripheral registers
* @param speed_mode LEDC speed_mode, low-speed mode only * @param speed_mode LEDC speed_mode, low-speed mode only
* @param channel_num LEDC channel index (0-5), select from ledc_channel_t * @param channel_num LEDC channel index (0-5), select from ledc_channel_t
* @param duty_start The duty start
* *
* @return None * @return None
*/ */
static inline void ledc_ll_set_duty_start(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_channel_t channel_num, bool duty_start) static inline void ledc_ll_set_duty_start(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_channel_t channel_num)
{ {
hw->channel_group[speed_mode].channel[channel_num].conf1.duty_start = duty_start; hw->channel_group[speed_mode].channel[channel_num].conf1.duty_start = 1;
} }
/** /**

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -579,13 +579,12 @@ static inline void ledc_ll_set_sig_out_en(ledc_dev_t *hw, ledc_mode_t speed_mode
* @param hw Beginning address of the peripheral registers * @param hw Beginning address of the peripheral registers
* @param speed_mode LEDC speed_mode, low-speed mode only * @param speed_mode LEDC speed_mode, low-speed mode only
* @param channel_num LEDC channel index (0-5), select from ledc_channel_t * @param channel_num LEDC channel index (0-5), select from ledc_channel_t
* @param duty_start The duty start
* *
* @return None * @return None
*/ */
static inline void ledc_ll_set_duty_start(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_channel_t channel_num, bool duty_start) static inline void ledc_ll_set_duty_start(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_channel_t channel_num)
{ {
hw->channel_group[speed_mode].channel[channel_num].conf1.duty_start = duty_start; hw->channel_group[speed_mode].channel[channel_num].conf1.duty_start = 1;
} }
/** /**

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -458,13 +458,12 @@ static inline void ledc_ll_set_sig_out_en(ledc_dev_t *hw, ledc_mode_t speed_mode
* @param hw Beginning address of the peripheral registers * @param hw Beginning address of the peripheral registers
* @param speed_mode LEDC speed_mode, low-speed mode only * @param speed_mode LEDC speed_mode, low-speed mode only
* @param channel_num LEDC channel index (0-5), select from ledc_channel_t * @param channel_num LEDC channel index (0-5), select from ledc_channel_t
* @param duty_start The duty start
* *
* @return None * @return None
*/ */
static inline void ledc_ll_set_duty_start(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_channel_t channel_num, bool duty_start) static inline void ledc_ll_set_duty_start(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_channel_t channel_num)
{ {
hw->channel_group[speed_mode].channel[channel_num].conf1.duty_start = duty_start; hw->channel_group[speed_mode].channel[channel_num].conf1.duty_start = 1;
} }
/** /**

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -577,13 +577,12 @@ static inline void ledc_ll_set_sig_out_en(ledc_dev_t *hw, ledc_mode_t speed_mode
* @param hw Beginning address of the peripheral registers * @param hw Beginning address of the peripheral registers
* @param speed_mode LEDC speed_mode, low-speed mode only * @param speed_mode LEDC speed_mode, low-speed mode only
* @param channel_num LEDC channel index (0-5), select from ledc_channel_t * @param channel_num LEDC channel index (0-5), select from ledc_channel_t
* @param duty_start The duty start
* *
* @return None * @return None
*/ */
static inline void ledc_ll_set_duty_start(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_channel_t channel_num, bool duty_start) static inline void ledc_ll_set_duty_start(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_channel_t channel_num)
{ {
hw->channel_group[speed_mode].channel[channel_num].conf1.duty_start = duty_start; hw->channel_group[speed_mode].channel[channel_num].conf1.duty_start = 1;
} }
/** /**

View File

@@ -484,13 +484,12 @@ static inline void ledc_ll_set_sig_out_en(ledc_dev_t *hw, ledc_mode_t speed_mode
* @param hw Beginning address of the peripheral registers * @param hw Beginning address of the peripheral registers
* @param speed_mode LEDC speed_mode, low-speed mode only * @param speed_mode LEDC speed_mode, low-speed mode only
* @param channel_num LEDC channel index (0-5), select from ledc_channel_t * @param channel_num LEDC channel index (0-5), select from ledc_channel_t
* @param duty_start The duty start
* *
* @return None * @return None
*/ */
static inline void ledc_ll_set_duty_start(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_channel_t channel_num, bool duty_start) static inline void ledc_ll_set_duty_start(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_channel_t channel_num)
{ {
hw->channel_group[speed_mode].channel[channel_num].conf1.duty_start = duty_start; hw->channel_group[speed_mode].channel[channel_num].conf1.duty_start = 1;
} }
/** /**

View File

@@ -498,13 +498,12 @@ static inline void ledc_ll_set_sig_out_en(ledc_dev_t *hw, ledc_mode_t speed_mode
* @param hw Beginning address of the peripheral registers * @param hw Beginning address of the peripheral registers
* @param speed_mode LEDC speed_mode, high-speed mode or low-speed mode * @param speed_mode LEDC speed_mode, high-speed mode or low-speed mode
* @param channel_num LEDC channel index (0-7), select from ledc_channel_t * @param channel_num LEDC channel index (0-7), select from ledc_channel_t
* @param duty_start The duty start
* *
* @return None * @return None
*/ */
static inline void ledc_ll_set_duty_start(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_channel_t channel_num, bool duty_start) static inline void ledc_ll_set_duty_start(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_channel_t channel_num)
{ {
hw->channel_group[speed_mode].channel[channel_num].conf1.duty_start = duty_start; hw->channel_group[speed_mode].channel[channel_num].conf1.duty_start = 1;
} }
/** /**

View File

@@ -459,13 +459,12 @@ static inline void ledc_ll_set_sig_out_en(ledc_dev_t *hw, ledc_mode_t speed_mode
* @param hw Beginning address of the peripheral registers * @param hw Beginning address of the peripheral registers
* @param speed_mode LEDC speed_mode, high-speed mode or low-speed mode * @param speed_mode LEDC speed_mode, high-speed mode or low-speed mode
* @param channel_num LEDC channel index (0-7), select from ledc_channel_t * @param channel_num LEDC channel index (0-7), select from ledc_channel_t
* @param duty_start The duty start
* *
* @return None * @return None
*/ */
static inline void ledc_ll_set_duty_start(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_channel_t channel_num, bool duty_start) static inline void ledc_ll_set_duty_start(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_channel_t channel_num)
{ {
hw->channel_group[speed_mode].channel[channel_num].conf1.duty_start = duty_start; hw->channel_group[speed_mode].channel[channel_num].conf1.duty_start = 1;
} }
/** /**

View File

@@ -263,11 +263,10 @@ void ledc_hal_ls_channel_update(ledc_hal_context_t *hal, ledc_channel_t channel_
* *
* @param hal Context of the HAL layer * @param hal Context of the HAL layer
* @param channel_num LEDC channel index (0-7), select from ledc_channel_t * @param channel_num LEDC channel index (0-7), select from ledc_channel_t
* @param duty_start The duty start
* *
* @return None * @return None
*/ */
void ledc_hal_set_duty_start(ledc_hal_context_t *hal, ledc_channel_t channel_num, bool duty_start); void ledc_hal_set_duty_start(ledc_hal_context_t *hal, ledc_channel_t channel_num);
/** /**
* @brief Set LEDC the integer part of duty value * @brief Set LEDC the integer part of duty value

View File

@@ -16,9 +16,9 @@ void ledc_hal_ls_channel_update(ledc_hal_context_t *hal, ledc_channel_t channel_
ledc_ll_ls_channel_update(hal->dev, hal->speed_mode, channel_num); ledc_ll_ls_channel_update(hal->dev, hal->speed_mode, channel_num);
} }
void ledc_hal_set_duty_start(ledc_hal_context_t *hal, ledc_channel_t channel_num, bool duty_start) void ledc_hal_set_duty_start(ledc_hal_context_t *hal, ledc_channel_t channel_num)
{ {
ledc_ll_set_duty_start(hal->dev, hal->speed_mode, channel_num, duty_start); ledc_ll_set_duty_start(hal->dev, hal->speed_mode, channel_num);
} }
void ledc_hal_set_duty_int_part(ledc_hal_context_t *hal, ledc_channel_t channel_num, uint32_t duty_val) void ledc_hal_set_duty_int_part(ledc_hal_context_t *hal, ledc_channel_t channel_num, uint32_t duty_val)

View File

@@ -332,14 +332,6 @@ There are several individual timer-specific functions that can be used to change
The first function is called "behind the scenes" by :cpp:func:`ledc_timer_config` to provide a startup of a timer after it is configured. The first function is called "behind the scenes" by :cpp:func:`ledc_timer_config` to provide a startup of a timer after it is configured.
Use Interrupts
^^^^^^^^^^^^^^
When configuring an LEDC channel, one of the parameters selected within :cpp:type:`ledc_channel_config_t` is :cpp:type:`ledc_intr_type_t` which triggers an interrupt on fade completion.
For registration of a handler to address this interrupt, call :cpp:func:`ledc_isr_register`.
Power Management Power Management
---------------- ----------------

View File

@@ -49,6 +49,19 @@ 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. :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.
- :func:`ledc_isr_register` has been deprecated. LEDC interrupt handling is implemented by driver itself, please only register event callbacks if necessary.
- :cpp:member:`ledc_channel_config_t::intr_type` has been deprecated. `LEDC_INTR_FADE_END` interrupt enable / disable control is handled by the driver internally. Users can still register a callback for this interrupt by :cpp:func:`ledc_cb_register`.
I2C I2C
--- ---

View File

@@ -332,14 +332,6 @@ LED PWM 控制器 API 有多种方式即时改变 PWM 频率:
第一个定时器复位函数在函数 :cpp:func:`ledc_timer_config` 内部完成所有定时器配置后会被调用一次。 第一个定时器复位函数在函数 :cpp:func:`ledc_timer_config` 内部完成所有定时器配置后会被调用一次。
使用中断
^^^^^^^^^^^^^^
配置 LED PWM 控制器通道时,可在 :cpp:type:`ledc_channel_config_t` 中选取参数 :cpp:type:`ledc_intr_type_t` ,在渐变完成时触发中断。
要注册处理程序来处理中断,可调用函数 :cpp:func:`ledc_isr_register`
电源管理 电源管理
-------- --------

View File

@@ -49,6 +49,19 @@ GPIO
:func:`gpio_iomux_in` 和 :func:`gpio_iomux_out` 已被 :func:`gpio_iomux_input` 和 :func:`gpio_iomux_output` 函数取代, 并移至 ``esp_private/gpio.h`` 头文件中作为仅供内部使用的私有 API。 :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 的公共依赖组件。
- :func:`ledc_isr_register` 已被弃用。LEDC 中断处理由驱动内部实现,如果需要注册中断回调,仅需要注册事件回调即可。
- :cpp:member:`ledc_channel_config_t::intr_type` 已被弃用。`LEDC_INTR_FADE_END` 中断使能/禁用控制由驱动内部处理。用户仍可以通过 :cpp:func:`ledc_cb_register` 注册该中断的回调。
I2C I2C
--- ---

View File

@@ -1,7 +1,7 @@
/* /*
* AliGenie - Example * 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 * 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"); ESP_LOGI(TAG, "GENIE_EVT_RESET_BY_REPEAT_NOTIFY");
lightbulb_set_switch(false); lightbulb_set_switch(false);
lightbulb_effect_config_t effect1 = { lightbulb_effect_config_t effect1 = {
.red = 0, .hue = 120,
.green = 255, .saturation = 100,
.blue = 0, .max_value_brightness = 100,
.max_brightness = 100, .min_value_brightness = 0,
.min_brightness = 0,
.effect_cycle_ms = CONFIG_LIGHT_BLINK_PERIOD_MS, .effect_cycle_ms = CONFIG_LIGHT_BLINK_PERIOD_MS,
.effect_type = EFFECT_BLINK, .effect_type = EFFECT_BLINK,
.mode = WORK_COLOR, .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"); ESP_LOGI(TAG, "GENIE_EVT_HW_RESET_START");
lightbulb_set_switch(false); lightbulb_set_switch(false);
lightbulb_effect_config_t effect2 = { lightbulb_effect_config_t effect2 = {
.red = 0, .hue = 120,
.green = 255, .saturation = 100,
.blue = 0, .max_value_brightness = 100,
.max_brightness = 100, .min_value_brightness = 0,
.min_brightness = 0,
.effect_cycle_ms = CONFIG_LIGHT_BLINK_PERIOD_MS, .effect_cycle_ms = CONFIG_LIGHT_BLINK_PERIOD_MS,
.effect_type = EFFECT_BLINK, .effect_type = EFFECT_BLINK,
.mode = WORK_COLOR, .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 #if GENIE_VENDOR_MODEL_VERSION == 0
#elif GENIE_VENDOR_MODEL_VERSION == 1 #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); local_operation(param->value.state_change.appkey_add.app_idx);
// genie mesh init // genie mesh init
genie_mesh_init(); genie_mesh_init();
@@ -1315,11 +1313,10 @@ static esp_err_t ble_mesh_init(void)
ESP_LOGW(TAG, "node not provisioned"); ESP_LOGW(TAG, "node not provisioned");
lightbulb_set_switch(false); lightbulb_set_switch(false);
lightbulb_effect_config_t effect3 = { lightbulb_effect_config_t effect3 = {
.red = 0, .hue = 120,
.green = 255, .saturation = 100,
.blue = 0, .max_value_brightness = 100,
.max_brightness = 100, .min_value_brightness = 0,
.min_brightness = 0,
.effect_cycle_ms = CONFIG_LIGHT_BLINK_PERIOD_MS, .effect_cycle_ms = CONFIG_LIGHT_BLINK_PERIOD_MS,
.effect_type = EFFECT_BLINK, .effect_type = EFFECT_BLINK,
.mode = WORK_COLOR, .mode = WORK_COLOR,

View File

@@ -1,7 +1,7 @@
/* /*
* AliGenie - Example * 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 * SPDX-License-Identifier: Unlicense OR CC0-1.0
*/ */
@@ -45,12 +45,12 @@ static void board_led_init(void)
lightbulb_config_t config = { lightbulb_config_t config = {
.type = DRIVER_ESP_PWM, .type = DRIVER_ESP_PWM,
.driver_conf.pwm.freq_hz = 4000, .driver_conf.pwm.freq_hz = 4000,
.capability.enable_fades = true, .capability.enable_fade = true,
.capability.fades_ms = CONFIG_LIGHT_FADE_PERIOD_MS, .capability.fade_time_ms = CONFIG_LIGHT_FADE_PERIOD_MS,
.capability.enable_lowpower = false, .capability.enable_lowpower = false,
.capability.enable_mix_cct = false, .capability.enable_hardware_cct = false,
.capability.enable_status_storage = false, .capability.enable_status_storage = false,
.capability.mode_mask = COLOR_MODE, .capability.led_beads = LED_BEADS_3CH_RGB,
.capability.storage_cb = NULL, .capability.storage_cb = NULL,
.capability.sync_change_brightness_value = true, .capability.sync_change_brightness_value = true,
.io_conf.pwm_io.red = CONFIG_LIGHT_GPIO_RED, .io_conf.pwm_io.red = CONFIG_LIGHT_GPIO_RED,

View File

@@ -1,3 +1,3 @@
## IDF Component Manager Manifest File ## IDF Component Manager Manifest File
dependencies: dependencies:
espressif/lightbulb_driver: "==0.5.5" espressif/lightbulb_driver: ">=1.8.3"

View File

@@ -2,7 +2,7 @@
/* /*
* SPDX-FileCopyrightText: 2017 Intel Corporation * 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 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -61,10 +61,10 @@ static void board_led_init(void)
.type = DRIVER_WS2812, .type = DRIVER_WS2812,
.driver_conf.ws2812.led_num = 3, .driver_conf.ws2812.led_num = 3,
.driver_conf.ws2812.ctrl_io = 8, .driver_conf.ws2812.ctrl_io = 8,
.capability.enable_fades = true, .capability.enable_fade = true,
.capability.fades_ms = 800, .capability.fade_time_ms = 800,
.capability.enable_status_storage = false, .capability.enable_status_storage = false,
.capability.mode_mask = COLOR_MODE, .capability.led_beads = LED_BEADS_3CH_RGB,
.capability.storage_cb = NULL, .capability.storage_cb = NULL,
.external_limit = NULL, .external_limit = NULL,
.gamma_conf = NULL, .gamma_conf = NULL,

View File

@@ -2,7 +2,7 @@
/* /*
* SPDX-FileCopyrightText: 2017 Intel Corporation * 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 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -58,10 +58,10 @@ static void board_led_init(void)
.type = DRIVER_WS2812, .type = DRIVER_WS2812,
.driver_conf.ws2812.led_num = 3, .driver_conf.ws2812.led_num = 3,
.driver_conf.ws2812.ctrl_io = 8, .driver_conf.ws2812.ctrl_io = 8,
.capability.enable_fades = true, .capability.enable_fade = true,
.capability.fades_ms = 800, .capability.fade_time_ms = 800,
.capability.enable_status_storage = false, .capability.enable_status_storage = false,
.capability.mode_mask = COLOR_MODE, .capability.led_beads = LED_BEADS_3CH_RGB,
.capability.storage_cb = NULL, .capability.storage_cb = NULL,
.external_limit = NULL, .external_limit = NULL,
.gamma_conf = NULL, .gamma_conf = NULL,

View File

@@ -2,7 +2,7 @@
/* /*
* SPDX-FileCopyrightText: 2017 Intel Corporation * 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 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -41,10 +41,10 @@ static void board_led_init(void)
.type = DRIVER_WS2812, .type = DRIVER_WS2812,
.driver_conf.ws2812.led_num = 3, .driver_conf.ws2812.led_num = 3,
.driver_conf.ws2812.ctrl_io = 8, .driver_conf.ws2812.ctrl_io = 8,
.capability.enable_fades = true, .capability.enable_fade = true,
.capability.fades_ms = 800, .capability.fade_time_ms = 800,
.capability.enable_status_storage = false, .capability.enable_status_storage = false,
.capability.mode_mask = COLOR_MODE, .capability.led_beads = LED_BEADS_3CH_RGB,
.capability.storage_cb = NULL, .capability.storage_cb = NULL,
.external_limit = NULL, .external_limit = NULL,
.gamma_conf = NULL, .gamma_conf = NULL,

View File

@@ -2,7 +2,7 @@
/* /*
* SPDX-FileCopyrightText: 2017 Intel Corporation * 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 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -34,10 +34,10 @@ static void board_led_init(void)
.type = DRIVER_WS2812, .type = DRIVER_WS2812,
.driver_conf.ws2812.led_num = 3, .driver_conf.ws2812.led_num = 3,
.driver_conf.ws2812.ctrl_io = 8, .driver_conf.ws2812.ctrl_io = 8,
.capability.enable_fades = true, .capability.enable_fade = true,
.capability.fades_ms = 800, .capability.fade_time_ms = 800,
.capability.enable_status_storage = false, .capability.enable_status_storage = false,
.capability.mode_mask = COLOR_MODE, .capability.led_beads = LED_BEADS_3CH_RGB,
.capability.storage_cb = NULL, .capability.storage_cb = NULL,
.external_limit = NULL, .external_limit = NULL,
.gamma_conf = NULL, .gamma_conf = NULL,

View File

@@ -2,7 +2,7 @@
/* /*
* SPDX-FileCopyrightText: 2017 Intel Corporation * 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 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -34,10 +34,10 @@ static void board_led_init(void)
.type = DRIVER_WS2812, .type = DRIVER_WS2812,
.driver_conf.ws2812.led_num = 3, .driver_conf.ws2812.led_num = 3,
.driver_conf.ws2812.ctrl_io = 8, .driver_conf.ws2812.ctrl_io = 8,
.capability.enable_fades = true, .capability.enable_fade = true,
.capability.fades_ms = 800, .capability.fade_time_ms = 800,
.capability.enable_status_storage = false, .capability.enable_status_storage = false,
.capability.mode_mask = COLOR_MODE, .capability.led_beads = LED_BEADS_3CH_RGB,
.capability.storage_cb = NULL, .capability.storage_cb = NULL,
.external_limit = NULL, .external_limit = NULL,
.gamma_conf = NULL, .gamma_conf = NULL,

View File

@@ -1,4 +1,4 @@
dependencies: dependencies:
espressif/esp_cam_sensor: "^1.1.0" espressif/esp_cam_sensor: "^1.2.1"
idf: idf:
version: ">=5.3.0" version: ">=5.3.0"

View File

@@ -234,7 +234,6 @@ static void example_rgb_ledc_init(void)
ledc_channel_config_t ledc_channel = { ledc_channel_config_t ledc_channel = {
.speed_mode = LEDC_MODE, .speed_mode = LEDC_MODE,
.timer_sel = LEDC_TIMER, .timer_sel = LEDC_TIMER,
.intr_type = LEDC_INTR_DISABLE,
.duty = 0, // Set initial duty to 0% .duty = 0, // Set initial duty to 0%
.hpoint = 0 .hpoint = 0
}; };