mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-23 01:10:46 +00:00
refactor(gptimer): use group_id in clock ctrl functions
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -72,12 +72,13 @@ static inline void _timer_ll_reset_register(int group_id)
|
||||
/**
|
||||
* @brief Set clock source for timer
|
||||
*
|
||||
* @param hw Timer Group register base address
|
||||
* @param group_id Group ID
|
||||
* @param timer_num Timer number in the group
|
||||
* @param clk_src Clock source
|
||||
*/
|
||||
static inline void timer_ll_set_clock_source(timg_dev_t *hw, uint32_t timer_num, gptimer_clock_source_t clk_src)
|
||||
static inline void timer_ll_set_clock_source(int group_id, uint32_t timer_num, gptimer_clock_source_t clk_src)
|
||||
{
|
||||
timg_dev_t *hw = TIMER_LL_GET_HW(group_id);
|
||||
switch (clk_src) {
|
||||
case GPTIMER_CLK_SRC_APB:
|
||||
hw->hw_timer[timer_num].config.tx_use_xtal = 0;
|
||||
@@ -94,13 +95,14 @@ static inline void timer_ll_set_clock_source(timg_dev_t *hw, uint32_t timer_num,
|
||||
/**
|
||||
* @brief Enable Timer Group (GPTimer) module clock
|
||||
*
|
||||
* @param hw Timer Group register base address
|
||||
* @param group_id Group ID
|
||||
* @param timer_num Timer index in the group
|
||||
* @param en true to enable, false to disable
|
||||
*/
|
||||
static inline void timer_ll_enable_clock(timg_dev_t *hw, uint32_t timer_num, bool en)
|
||||
static inline void timer_ll_enable_clock(int group_id, uint32_t timer_num, bool en)
|
||||
{
|
||||
(void)timer_num; // only one timer in the group
|
||||
timg_dev_t *hw = TIMER_LL_GET_HW(group_id);
|
||||
hw->regclk.timer_clk_is_active = en;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user