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
 
MicrosecondTimestamp _get_microseconds () override
 获取当前微秒计数 / Get current timestamp in microseconds
 
MillisecondTimestamp _get_milliseconds () override
 获取当前毫秒计数 / Get current timestamp in milliseconds
 
- Public Member Functions inherited from LibXR::Timebase
 Timebase (uint64_t max_valid_us=UINT64_MAX, uint32_t max_valid_ms=UINT32_MAX)
 默认构造函数,初始化全局时间基指针。 Default constructor, initializing the global timebase pointer.
 

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 void DelayMicroseconds (uint32_t us)
 微秒级延时 / Delay in microseconds
 
- Static Public Attributes inherited from LibXR::Timebase
static Timebasetimebase = nullptr
 静态指针,用于存储全局时间基对象。 Static pointer storing the global timebase instance.
 

Detailed Description

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

基于 esp_timer 提供微秒和毫秒时间戳。 Provides microsecond and millisecond timestamps based on esp_timer.

Definition at line 15 of file esp_timebase.hpp.

Constructor & Destructor Documentation

◆ ESP32Timebase()

LibXR::ESP32Timebase::ESP32Timebase ( )
inline

构造函数 / Constructor

Definition at line 21 of file esp_timebase.hpp.

22 : Timebase(static_cast<uint64_t>(UINT64_MAX), UINT32_MAX)
23 {
24 }
Timebase(uint64_t max_valid_us=UINT64_MAX, uint32_t max_valid_ms=UINT32_MAX)
默认构造函数,初始化全局时间基指针。 Default constructor, initializing the global timebase pointer.
Definition timebase.hpp:30

Member Function Documentation

◆ _get_microseconds()

MicrosecondTimestamp LibXR::ESP32Timebase::_get_microseconds ( )
inlineoverridevirtual

获取当前微秒计数 / Get current timestamp in microseconds

Returns
MicrosecondTimestamp 微秒时间戳 / Microsecond timestamp

Implements LibXR::Timebase.

Definition at line 30 of file esp_timebase.hpp.

31 {
32 return esp_timer_get_time();
33 }

◆ _get_milliseconds()

MillisecondTimestamp LibXR::ESP32Timebase::_get_milliseconds ( )
inlineoverridevirtual

获取当前毫秒计数 / Get current timestamp in milliseconds

Returns
MillisecondTimestamp 毫秒时间戳 / Millisecond timestamp

Implements LibXR::Timebase.

Definition at line 39 of file esp_timebase.hpp.

40 {
41 return static_cast<MillisecondTimestamp>(esp_timer_get_time() / 1000) % UINT32_MAX;
42 }

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