refactor(ledc): refactored some LEDC LL functions

This commit is contained in:
Song Ruo Jing
2026-04-01 21:34:52 +08:00
parent 32d31d72a3
commit 88b62b19fd
41 changed files with 890 additions and 846 deletions
@@ -219,18 +219,6 @@ typedef struct {
*/
#define ledc_hal_set_idle_level(hal, speed_mode, channel_num, idle_level) ledc_ll_set_idle_level((hal)->dev, speed_mode, channel_num, idle_level)
/**
* @brief Set fade end interrupt enable
*
* @param hal Context of the HAL layer
* @param speed_mode LEDC speed_mode
* @param channel_num LEDC channel index, select from ledc_channel_t
* @param fade_end_intr_en The fade end interrupt enable status
*
* @return None
*/
#define ledc_hal_set_fade_end_intr(hal, speed_mode, channel_num, fade_end_intr_en) ledc_ll_set_fade_end_intr((hal)->dev, speed_mode, channel_num, fade_end_intr_en)
/**
* @brief Set timer index of the specified channel
*
@@ -405,29 +393,6 @@ void ledc_hal_get_fade_param(ledc_hal_context_t *hal, ledc_mode_t speed_mode, le
void ledc_hal_clear_left_off_fade_param(ledc_hal_context_t *hal, ledc_mode_t speed_mode, ledc_channel_t channel_num, uint32_t start_range);
#endif //SOC_LEDC_GAMMA_CURVE_FADE_SUPPORTED
/**
* @brief Get interrupt status of the specified channel
*
* @param hal Context of the HAL layer
* @param speed_mode LEDC speed_mode
* @param channel_num LEDC channel index, select from ledc_channel_t
* @param intr_status Pointer to accept the interrupt status
*
* @return None
*/
void ledc_hal_get_fade_end_intr_status(ledc_hal_context_t *hal, ledc_mode_t speed_mode, uint32_t *intr_status);
/**
* @brief Clear interrupt status of the specified channel
*
* @param hal Context of the HAL layer
* @param speed_mode LEDC speed_mode
* @param channel_num LEDC channel index, select from ledc_channel_t
*
* @return None
*/
void ledc_hal_clear_fade_end_intr_status(ledc_hal_context_t *hal, ledc_mode_t speed_mode, ledc_channel_t channel_num);
/**
* @brief Get clock config of LEDC timer
*
@@ -440,17 +405,6 @@ void ledc_hal_clear_fade_end_intr_status(ledc_hal_context_t *hal, ledc_mode_t sp
*/
void ledc_hal_get_clk_cfg(ledc_hal_context_t *hal, ledc_mode_t speed_mode, ledc_timer_t timer_sel, ledc_clk_cfg_t *clk_cfg);
/**
* @brief Get the address of the fade end interrupt status register.
*
* @param hal Context of the HAL layer
* @return Pointer to the fade end interrupt status register.
*/
static inline volatile void* ledc_hal_get_fade_end_intr_addr(ledc_hal_context_t *hal)
{
return ledc_ll_get_fade_end_intr_addr(hal->dev);
}
#endif //#if SOC_LEDC_SUPPORTED
#ifdef __cplusplus
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2019-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -7,6 +7,11 @@
#pragma once
#include "soc/soc_caps.h"
#include "soc/interrupts.h"
#if SOC_LEDC_SUPPORTED
#include "hal/ledc_ll.h"
#include "hal/ledc_types.h"
#endif
#if SOC_PAU_SUPPORTED
#include "soc/regdma.h"
#include "soc/retention_periph_defs.h"
@@ -16,18 +21,18 @@
extern "C" {
#endif
#if SOC_LEDC_SUPPORTED
/*
Stores a bunch of per-ledc-peripheral data.
*/
typedef struct {
const int sig_out0_idx;
const int irq_id;
struct {
const int sig_out0_idx;
} speed_mode[LEDC_SPEED_MODE_MAX];
} ledc_signal_conn_t;
#if SOC_LEDC_SUPPORT_HS_MODE
extern const ledc_signal_conn_t ledc_periph_signal[2];
#else
extern const ledc_signal_conn_t ledc_periph_signal[1];
#endif
extern const ledc_signal_conn_t ledc_periph_signal[LEDC_LL_GET(GROUP_NUM)];
#if SOC_PAU_SUPPORTED && SOC_LEDC_SUPPORT_SLEEP_RETENTION
@@ -53,8 +58,10 @@ typedef struct {
const periph_retention_module_t module_id;
} ledc_reg_retention_info_t;
extern const ledc_reg_retention_info_t ledc_reg_retention_info;
#endif
extern const ledc_reg_retention_info_t ledc_reg_retention_info[LEDC_LL_GET(GROUP_NUM)];
#endif // SOC_PAU_SUPPORTED && SOC_LEDC_SUPPORT_SLEEP_RETENTION
#endif // SOC_LEDC_SUPPORTED
#ifdef __cplusplus
}