4#include <freertos/FreeRTOS.h>
5#include <freertos/task.h>
10template <
typename T> T
clamp(T value, T min, T max) {
13 }
else if (value > max) {
23inline void delayMs(
int ms) { vTaskDelay(ms / portTICK_PERIOD_MS); }
29inline void delay(std::chrono::duration<uint32_t, std::milli>
delay) {
30 vTaskDelay(
delay.count() / portTICK_PERIOD_MS);
33#define RBCX_ENUM_IMPL_MASK_OPERATORS(T) \
34 inline T operator|(T a, T b) { \
35 return static_cast<T>(static_cast<int>(a) | static_cast<int>(b)); \
38 inline T operator&(T a, T b) { \
39 return static_cast<T>(static_cast<int>(a) & static_cast<int>(b)); \
42 inline T operator^(T a, T b) { \
43 return static_cast<T>(static_cast<int>(a) ^ static_cast<int>(b)); \
46 inline T operator|=(T& a, T b) { \
47 return static_cast<T>( \
48 reinterpret_cast<int&>(a) |= static_cast<int>(b)); \
51 inline T operator&=(T& a, T b) { \
52 return static_cast<T>( \
53 reinterpret_cast<int&>(a) &= static_cast<int>(b)); \
56 inline T operator^=(T& a, T b) { \
57 return static_cast<T>( \
58 reinterpret_cast<int&>(a) ^= static_cast<int>(b)); \
61 inline T operator~(T a) { return static_cast<T>(~static_cast<int>(a)); } \
63 inline T operator<<=(T& a, int b) { \
64 return static_cast<T>( \
65 reinterpret_cast<int&>(a) <<= static_cast<int>(b)); \
68 inline T operator>>=(T& a, int b) { \
69 return static_cast<T>( \
70 reinterpret_cast<int&>(a) >>= static_cast<int>(b)); \
73 inline T operator<<(T a, int b) { \
74 return static_cast<T>(static_cast<int>(a) << static_cast<int>(b)); \
77 inline T operator>>(T a, int b) { \
78 return static_cast<T>(static_cast<int>(a) >> static_cast<int>(b)); \
81 T operator+=(T& a, T b) = delete; \
82 T operator-=(T& a, T b) = delete; \
83 T operator++(T a) = delete; \
84 T operator--(T a) = delete;
Definition: RBCXAngle.cpp:3
T clamp(T value, T min, T max)
Definition: RBCXUtil.h:10
void delayMs(int ms)
Delay for given number of milliseconds. Like Arduino's delay()
Definition: RBCXUtil.h:23
void delay(std::chrono::duration< uint32_t, std::milli > delay)
Delay for given number of microseconds. Like Arduino's delayMicroseconds()
Definition: RBCXUtil.h:29