libxr 1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
esp_timebase.hpp
1#pragma once
2
3#include "timebase.hpp"
4#include "esp_timer.h"
5
6namespace LibXR
7{
8
14class ESP32Timebase : public Timebase
15{
16 public:
21 : Timebase(static_cast<uint64_t>(UINT64_MAX), UINT32_MAX) // 最大值可根据需要修改
22 {
23 }
24
30 {
31 return esp_timer_get_time(); // 返回自启动以来的微秒数
32 }
33
39 {
40 return static_cast<TimestampMS>(esp_timer_get_time() / 1000) % UINT32_MAX;
41 }
42};
43
44} // namespace LibXR
基于 esp_timer 的时间基准实现(微秒与毫秒) Timebase implementation using esp_timer (microseconds and milliseconds)
ESP32Timebase()
构造函数
TimestampMS _get_milliseconds() override
获取当前时间(毫秒)
TimestampUS _get_microseconds() override
获取当前时间(微秒)
时间基类,用于提供高精度时间戳。 Timebase class for providing high-precision timestamps.
Definition timebase.hpp:18
表示毫秒级时间戳的类。Class representing a timestamp in milliseconds.
表示微秒级时间戳的类。Class representing a timestamp in microseconds.
LibXR Color Control Library / LibXR终端颜色控制库
Definition esp_gpio.hpp:8