One Motor
0.6.0
RoboMaster全平台一站式电机驱动库
载入中...
搜索中...
未找到
DeltaT.hpp
浏览该文件的文档.
1
7
#ifndef DELTAT_HPP
8
#define DELTAT_HPP
9
10
#ifdef ONE_MOTOR_LINUX
11
#include <chrono>
12
#endif
13
14
#include <cstdint>
15
16
#include "
Arithmetic.hpp
"
17
18
namespace
OneMotor
19
{
28
template
<Arithmetic T =
float
>
29
class
DeltaT
30
{
31
public
:
35
DeltaT
();
36
41
T
getDeltaMS
();
42
47
void
reset
();
48
49
private
:
50
#ifdef ONE_MOTOR_LINUX
51
std::chrono::time_point<std::chrono::steady_clock> last_time;
52
#else
53
#ifdef CONFIG_TIMER_HAS_64BIT_CYCLE_COUNTER
54
uint64_t last_time_cycles;
55
#else
56
uint32_t last_time_cycles;
57
#endif
58
#endif
59
};
60
}
61
62
#endif
//DELTAT_HPP
Arithmetic.hpp
定义了一个C++20概念,用于约束模板参数必须为算术类型。
OneMotor::DeltaT::getDeltaMS
T getDeltaMS()
获取自上次调用以来经过的时间。
定义
L_DeltaT.cpp:12
OneMotor::DeltaT::reset
void reset()
重置计时器。
定义
L_DeltaT.cpp:21
OneMotor::DeltaT::DeltaT
DeltaT()
构造函数,初始化计时器。
定义
L_DeltaT.cpp:6
include
OneMotor
Util
DeltaT.hpp
制作者
1.13.2