libxr  1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
LibXR::ESP32Timebase Class Reference

ESP32 时间基准实现 / ESP32 timebase implementation. More...

#include <esp_timebase.hpp>

Inheritance diagram for LibXR::ESP32Timebase:
[legend]
Collaboration diagram for LibXR::ESP32Timebase:
[legend]

Public Member Functions

 ESP32Timebase ()
 构造函数 / Constructor
 
- Public Member Functions inherited from LibXR::Timebase
 Timebase ()=default
 默认构造函数。 Default constructor.
 
 Timebase (const Timebase &)=delete
 禁止拷贝构造。 Copy construction is disabled.
 
Timebaseoperator= (const Timebase &)=delete
 禁止拷贝赋值。 Copy assignment is disabled.
 

Additional Inherited Members

- Static Public Member Functions inherited from LibXR::Timebase
static MicrosecondTimestamp GetMicroseconds ()
 获取当前时间的微秒级时间戳。 Gets the current timestamp in microseconds.
 
static MillisecondTimestamp GetMilliseconds ()
 获取当前时间的毫秒级时间戳。 Gets the current timestamp in milliseconds.
 
static bool IsReady () noexcept
 检查时间基是否已经初始化。 Check whether the active timebase backend is initialized.
 
static void DelayMicroseconds (uint32_t us)
 微秒级延时 / Delay in microseconds
 
- Static Protected Member Functions inherited from LibXR::Timebase
static void SetReady (bool ready=true) noexcept
 设置时间基就绪状态。 Set the timebase ready flag.
 
static void ConfigureWrapRange (uint64_t max_valid_us, uint32_t max_valid_ms) noexcept
 配置时间戳回绕上界。 Configure the timestamp wraparound limits.
 
static uint64_t GetConfiguredWrapRangeUs () noexcept
 读取当前配置的微秒回绕上界。 Read the configured microsecond wraparound limit.
 
static uint32_t GetConfiguredWrapRangeMs () noexcept
 读取当前配置的毫秒回绕上界。 Read the configured millisecond wraparound limit.
 

Detailed Description

ESP32 时间基准实现 / ESP32 timebase implementation.

基于 esp_timer 提供微秒和毫秒时间戳。 在支持的平台上使用 systimer HAL 快速路径。 Provides microsecond and millisecond timestamps based on esp_timer. Uses optional systimer HAL fast path when available.

Definition at line 22 of file esp_timebase.hpp.

Constructor & Destructor Documentation

◆ ESP32Timebase()

LibXR::ESP32Timebase::ESP32Timebase ( )

构造函数 / Constructor

初始化 ESP 时间基,并在支持的芯片上启用 systimer 快速路径。 Initializes the ESP timebase and enables the systimer fast path when the target supports it.

Definition at line 19 of file esp_timebase.cpp.

20{
21 ConfigureWrapRange(UINT64_MAX, UINT32_MAX);
22#if SOC_SYSTIMER_SUPPORTED
23 if (!g_systimer_ready)
24 {
25 systimer_hal_init(&g_systimer_hal);
26
27 systimer_hal_tick_rate_ops_t tick_rate_ops = {
28 .ticks_to_us = systimer_ticks_to_us,
29 .us_to_ticks = systimer_us_to_ticks,
30 };
31 systimer_hal_set_tick_rate_ops(&g_systimer_hal, &tick_rate_ops);
32 systimer_hal_enable_counter(&g_systimer_hal, SYSTIMER_COUNTER_ESPTIMER);
33 g_systimer_ready = true;
34 }
35#endif
36 SetReady();
37}
static void ConfigureWrapRange(uint64_t max_valid_us, uint32_t max_valid_ms) noexcept
配置时间戳回绕上界。 Configure the timestamp wraparound limits.
Definition timebase.hpp:95
static void SetReady(bool ready=true) noexcept
设置时间基就绪状态。 Set the timebase ready flag.
Definition timebase.hpp:85

The documentation for this class was generated from the following files: