Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
clock.hpp
Go to the documentation of this file.
1
/*****************************************************************************/
2
/********** !!! WARNING: CODE GENERATED BY TAPROOT. DO NOT EDIT !!! **********/
3
/*****************************************************************************/
4
5
/*
6
* Copyright (c) 2020-2021 Advanced Robotics at the University of Washington <robomstr@uw.edu>
7
*
8
* This file is part of Taproot.
9
*
10
* Taproot is free software: you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation, either version 3 of the License, or
13
* (at your option) any later version.
14
*
15
* Taproot is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
19
*
20
* You should have received a copy of the GNU General Public License
21
* along with Taproot. If not, see <https://www.gnu.org/licenses/>.
22
*/
23
24
#ifndef TAPROOT_CLOCK_HPP_
25
#define TAPROOT_CLOCK_HPP_
26
27
#include <cstdint>
28
29
#ifndef PLATFORM_HOSTED
30
#include "modm/platform.hpp"
31
#else
32
#include "modm/architecture/interface/clock.hpp"
33
#endif
34
35
namespace
tap::arch::clock
36
{
37
#if defined(PLATFORM_HOSTED) && defined(ENV_UNIT_TESTS)
50
class
ClockStub final
51
{
52
public
:
53
ClockStub();
54
~ClockStub();
55
uint32_t time = 0;
56
};
57
58
uint32_t
getTimeMilliseconds
();
59
uint32_t
getTimeMicroseconds
();
60
#else
61
inline
uint32_t
getTimeMilliseconds
() {
return
modm::Clock().now().time_since_epoch().count(); }
62
66
inline
uint32_t
getTimeMicroseconds
()
67
{
68
return
modm::PreciseClock().now().time_since_epoch().count();
69
}
70
#endif
71
}
// namespace tap::arch::clock
72
73
#endif
// TAPROOT_CLOCK_HPP_
tap::arch::clock
Definition
clock.hpp:36
tap::arch::clock::getTimeMilliseconds
uint32_t getTimeMilliseconds()
Definition
clock.hpp:61
tap::arch::clock::getTimeMicroseconds
uint32_t getTimeMicroseconds()
Definition
clock.hpp:66
fang-mcb-project
taproot
src
tap
architecture
clock.hpp
Generated by
1.9.8