CTRE Phoenix C++
5.33.1
SleepUs.h
Go to the documentation of this file.
1
/* Copyright (C) Cross The Road Electronics 2024 */
2
#pragma once
3
4
#include <chrono>
5
#include <thread>
6
7
#ifdef __FRC_ROBORIO__
8
#include <unistd.h>
9
#endif
10
11
namespace
ctre
{
12
namespace
phoenix {
13
namespace
platform {
14
15
/**
16
* @param timeUs How long to yield current thread in microseconds (us).
17
* If platform cannot honor us resolution, round to nearest
18
* value that platform can honor.
19
*/
20
static
inline
void
SleepUs
(
int
timeUs)
21
{
22
#ifdef __FRC_ROBORIO__
23
usleep(timeUs);
24
#else
25
std::this_thread::sleep_for(std::chrono::microseconds(timeUs));
26
#endif
27
}
28
29
}
// namespace platform
30
}
// namespace phoenix
31
}
// namespace ctre
ctre::phoenix::platform::SleepUs
static void SleepUs(int timeUs)
Definition:
SleepUs.h:20
ctre
namespace ctre
Definition:
paramEnum.h:5
ctre
phoenix
platform
SleepUs.h
Generated on Fri Feb 16 2024 22:57:39 for CTRE Phoenix C++ by
1.9.4