mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
refactor(ledc): add compatibility for group and speed_mode
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include "hal/ledc_types.h"
|
||||
#include "soc/ledc_struct.h"
|
||||
#include "soc/ledc_reg.h"
|
||||
@@ -19,7 +20,7 @@
|
||||
#include "soc/soc_caps.h"
|
||||
#include "soc/soc_etm_source.h"
|
||||
|
||||
#define LEDC_LL_GET_HW() &LEDC
|
||||
#define LEDC_LL_GET_HW(group_id) ((group_id == 0) ? &LEDC : NULL)
|
||||
|
||||
#define LEDC_LL_CHANNEL_SUPPORT_OVF_CNT 1
|
||||
|
||||
@@ -129,19 +130,25 @@ extern "C" {
|
||||
/**
|
||||
* @brief Enable peripheral register clock
|
||||
*
|
||||
* @param group_id LEDC group ID
|
||||
* @param enable Enable/Disable
|
||||
*/
|
||||
static inline void ledc_ll_enable_bus_clock(bool enable)
|
||||
static inline void ledc_ll_enable_bus_clock(int group_id, bool enable)
|
||||
{
|
||||
(void)group_id;
|
||||
PCR.ledc_conf.ledc_clk_en = enable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reset whole peripheral register to init value defined by HW design
|
||||
*
|
||||
* @param group_id LEDC group ID
|
||||
*/
|
||||
static inline void ledc_ll_enable_reset_reg(bool enable)
|
||||
static inline void ledc_ll_reset_register(int group_id)
|
||||
{
|
||||
PCR.ledc_conf.ledc_rst_en = enable;
|
||||
(void)group_id;
|
||||
PCR.ledc_conf.ledc_rst_en = 1;
|
||||
PCR.ledc_conf.ledc_rst_en = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -155,14 +162,14 @@ static inline void ledc_ll_enable_mem_power(bool enable)
|
||||
/**
|
||||
* @brief Enable LEDC function clock
|
||||
*
|
||||
* @param hw Beginning address of the peripheral registers
|
||||
* @param group_id LEDC group ID
|
||||
* @param en True to enable, false to disable
|
||||
*
|
||||
* @return None
|
||||
*/
|
||||
static inline void ledc_ll_enable_clock(ledc_dev_t *hw, bool en)
|
||||
static inline void ledc_ll_enable_clock(int group_id, bool en)
|
||||
{
|
||||
(void)hw;
|
||||
(void)group_id;
|
||||
PCR.ledc_sclk_conf.ledc_sclk_en = en;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user