fix(ledc): left-off gamma ram registers should be cleared

Hardware reads in (range_number+1) fade parameter registers, which could
cause output waveform error.
This commit is contained in:
Song Ruo Jing
2024-12-31 21:28:20 +08:00
parent a1bd7abd1d
commit d173affef0
3 changed files with 31 additions and 8 deletions

View File

@@ -1,11 +1,11 @@
/*
* SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2019-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
// The HAL layer for LEDC (common part, in iram)
// make these functions in a seperate file to make sure all LL functions are in the IRAM.
// make these functions in a separate file to make sure all LL functions are in the IRAM.
#include "hal/ledc_hal.h"
#include "hal/assert.h"
@@ -58,6 +58,13 @@ void ledc_hal_get_range_number(ledc_hal_context_t *hal, ledc_channel_t channel_n
{
ledc_ll_get_range_number(hal->dev, hal->speed_mode, channel_num, range_num);
}
void ledc_hal_clear_left_off_fade_param(ledc_hal_context_t *hal, ledc_channel_t channel_num, uint32_t start_range)
{
for (int i = start_range; i < SOC_LEDC_GAMMA_CURVE_FADE_RANGE_MAX; i++) {
ledc_ll_set_fade_param_range(hal->dev, hal->speed_mode, channel_num, i, 0, 0, 0, 0);
}
}
#endif //SOC_LEDC_GAMMA_CURVE_FADE_SUPPORTED
void ledc_hal_get_fade_end_intr_status(ledc_hal_context_t *hal, uint32_t *intr_status)