mirror of
https://github.com/espressif/esp-idf.git
synced 2026-08-18 06:35:35 +03:00
change(esp_hal_rtc_timer): unify lp_timer/rtc_timer naming to RTC_TIMER
This commit is contained in:
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include "soc/soc_caps.h"
|
||||
#include "soc/soc.h"
|
||||
#if SOC_LP_TIMER_SUPPORTED
|
||||
#include "hal/lp_timer_types.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if SOC_LP_TIMER_SUPPORTED
|
||||
/*
|
||||
* @brief set alarm target value
|
||||
*
|
||||
* @param timer_id timer num of lp_timer, 0 or 1 for esp32c6 and esp32h2
|
||||
*
|
||||
* @param value when counter reaches alarm value, alarm event will be triggered
|
||||
*/
|
||||
void lp_timer_hal_set_alarm_target(uint8_t timer_id, uint64_t value);
|
||||
|
||||
/**
|
||||
* @brief get current counter value
|
||||
*/
|
||||
uint64_t lp_timer_hal_get_cycle_count(void);
|
||||
|
||||
/**
|
||||
* @brief clear alarm interrupt status
|
||||
*/
|
||||
void lp_timer_hal_clear_alarm_intr_status(void);
|
||||
|
||||
/**
|
||||
* @brief clear overflow interrupt status
|
||||
*/
|
||||
void lp_timer_hal_clear_overflow_intr_status(void);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include "soc/soc_caps.h"
|
||||
|
||||
/**
|
||||
* @brief The structure of the counter value in lower power timer
|
||||
*/
|
||||
#if SOC_LP_TIMER_SUPPORTED
|
||||
typedef struct {
|
||||
union {
|
||||
struct {
|
||||
uint32_t lo: SOC_LP_TIMER_BIT_WIDTH_LO; /*!< Low part of counter value */
|
||||
uint32_t hi: SOC_LP_TIMER_BIT_WIDTH_HI; /*!< High part of counter value */
|
||||
uint32_t reserved: 16;
|
||||
};
|
||||
uint64_t val; /*!< counter value */
|
||||
};
|
||||
} lp_timer_counter_value_t;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2020-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -8,44 +8,28 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include "soc/soc_caps.h"
|
||||
|
||||
#if SOC_IS(ESP32) || SOC_IS(ESP32C2) || SOC_IS(ESP32C3) || SOC_IS(ESP32S2) || SOC_IS(ESP32S3)
|
||||
#include "hal/rtc_timer_ll.h"
|
||||
#endif
|
||||
|
||||
#if SOC_LP_TIMER_SUPPORTED
|
||||
#include "hal/lp_timer_hal.h"
|
||||
#include "hal/lp_timer_types.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if SOC_RTC_TIMER_SUPPORTED
|
||||
/**
|
||||
* @brief Set wakeup timer value (for legacy chips with RTC_CNTL)
|
||||
* @brief Set wakeup timer value
|
||||
*
|
||||
* @param timer_id Timer ID
|
||||
* @param ticks Timer value in RTC slow clock ticks
|
||||
*/
|
||||
#if SOC_IS(ESP32) || SOC_IS(ESP32C2) || SOC_IS(ESP32C3) || SOC_IS(ESP32S2) || SOC_IS(ESP32S3)
|
||||
#define rtc_timer_hal_set_wakeup_timer(ticks) rtc_timer_ll_set_wakeup_timer(ticks)
|
||||
#elif SOC_LP_TIMER_SUPPORTED
|
||||
#define rtc_timer_hal_set_wakeup_timer(ticks) lp_timer_hal_set_alarm_target(0, ticks)
|
||||
#else
|
||||
#error "RTC timer not supported on this target"
|
||||
#endif
|
||||
#define rtc_timer_hal_set_wakeup_time(timer_id, ticks) rtc_timer_ll_set_wakeup_time(timer_id, ticks)
|
||||
|
||||
/**
|
||||
* @brief Get current RTC time (for legacy chips with RTC_CNTL)
|
||||
* @brief Get current RTC timer cycle count
|
||||
*
|
||||
* @param timer_id Timer ID
|
||||
* @return Current RTC time in RTC slow clock ticks
|
||||
*/
|
||||
#if SOC_IS(ESP32) || SOC_IS(ESP32C2) || SOC_IS(ESP32C3) || SOC_IS(ESP32S2) || SOC_IS(ESP32S3)
|
||||
#define rtc_timer_hal_get_rtc_time() rtc_timer_ll_get_rtc_time()
|
||||
#elif SOC_LP_TIMER_SUPPORTED
|
||||
#define rtc_timer_hal_get_rtc_time() lp_timer_hal_get_cycle_count()
|
||||
#else
|
||||
#error "RTC timer not supported on this target"
|
||||
#define rtc_timer_hal_get_cycle_count(timer_id) rtc_timer_ll_get_cycle_count(timer_id)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user