mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
fix(ledc): overflowed integer argument in ledc_hal_clear_left_off_fade_param
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#include "soc/clk_tree_defs.h"
|
||||
#include "hal/assert.h"
|
||||
#include "esp_rom_sys.h" //for sync issue workaround
|
||||
#include "soc/soc_caps.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -440,6 +441,7 @@ static inline void ledc_ll_set_duty_range_wr_addr(ledc_dev_t *hw, ledc_mode_t sp
|
||||
*/
|
||||
static inline void ledc_ll_set_fade_param_range(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_channel_t channel_num, uint8_t range, uint32_t dir, uint32_t cycle, uint32_t scale, uint32_t step)
|
||||
{
|
||||
HAL_ASSERT(range < SOC_LEDC_GAMMA_CURVE_FADE_RANGE_MAX);
|
||||
// To workaround sync issue
|
||||
// This is to ensure the fade param write to the gamma_wr register would not mess up the last wr_addr
|
||||
ledc_ll_set_duty_range_wr_addr(hw, speed_mode, channel_num, range);
|
||||
@@ -537,7 +539,7 @@ static inline void ledc_ll_get_fade_param(ledc_dev_t *hw, ledc_mode_t speed_mode
|
||||
static inline void ledc_ll_get_fade_param_range(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_channel_t channel_num, uint8_t range, uint32_t *dir, uint32_t *cycle, uint32_t *scale, uint32_t *step)
|
||||
{
|
||||
// On ESP32C6/H2, gamma ram read/write has the APB and LEDC clock domain sync issue
|
||||
// To make sure the parameter read is from the correct gamma ram addr, add a delay in between to ensure syncronization
|
||||
// To make sure the parameter read is from the correct gamma ram addr, add a delay in between to ensure synchronization
|
||||
ledc_ll_set_duty_range_rd_addr(hw, speed_mode, channel_num, range);
|
||||
esp_rom_delay_us(5);
|
||||
ledc_ll_get_fade_param(hw, speed_mode, channel_num, dir, cycle, scale, step);
|
||||
|
||||
Reference in New Issue
Block a user