libxr 1.0
Want to be the best embedded framework
|
基于硬件定时器的时间基准类 / Provides a timebase using hardware timer (TIM) More...
#include <stm32_timebase.hpp>
Public Member Functions | |
STM32TimerTimebase (TIM_HandleTypeDef *timer) | |
构造函数 / Constructor | |
TimestampUS | _get_microseconds () |
获取当前时间(微秒级) / Get current time in microseconds | |
TimestampMS | _get_milliseconds () |
获取当前时间(毫秒级) / Get current time in milliseconds | |
![]() | |
Timebase (uint64_t max_valid_us=UINT64_MAX, uint32_t max_valid_ms=UINT32_MAX) | |
默认构造函数,初始化全局时间基指针。 Default constructor, initializing the global timebase pointer. | |
Static Public Attributes | |
static TIM_HandleTypeDef * | htim = nullptr |
硬件定时器句柄指针 / Static pointer to hardware timer handle | |
![]() | |
static Timebase * | timebase = nullptr |
静态指针,用于存储全局时间基对象。 Static pointer storing the global timebase instance. | |
Additional Inherited Members | |
![]() | |
static TimestampUS | GetMicroseconds () |
获取当前时间的微秒级时间戳。 Gets the current timestamp in microseconds. | |
static TimestampMS | GetMilliseconds () |
获取当前时间的毫秒级时间戳。 Gets the current timestamp in milliseconds. | |
基于硬件定时器的时间基准类 / Provides a timebase using hardware timer (TIM)
Definition at line 73 of file stm32_timebase.hpp.
|
inline |
构造函数 / Constructor
timer | 定时器句柄指针 / Pointer to hardware timer handle |
Definition at line 80 of file stm32_timebase.hpp.
|
inlinevirtual |
获取当前时间(微秒级) / Get current time in microseconds
该函数通过读取硬件定时器计数值和系统滴答定时器毫秒数来计算当前的微秒级时间戳。 It calculates current microsecond timestamp based on hardware timer counter and system tick value.
Implements LibXR::Timebase.
Definition at line 95 of file stm32_timebase.hpp.
|
inlinevirtual |
获取当前时间(毫秒级) / Get current time in milliseconds
Implements LibXR::Timebase.
Definition at line 128 of file stm32_timebase.hpp.
|
static |
硬件定时器句柄指针 / Static pointer to hardware timer handle
Definition at line 133 of file stm32_timebase.hpp.