18 #include <type_traits>
21 #define TSM_TICK_REP std::uint32_t
24 #ifndef TSM_TICK_PERIOD
25 #define TSM_TICK_PERIOD std::ratio<1>
44 static_assert(std::is_integral_v<tick_rep> && std::is_unsigned_v<tick_rep>,
45 "tsm: TSM_TICK_REP must name an unsigned integral type");
46 static_assert(tick_period::num > 0 && tick_period::den > 0,
47 "tsm: TSM_TICK_PERIOD must name a positive std::ratio");
79 [[nodiscard]] consteval
tick_count operator""_ticks(
unsigned long long value)
84 [[nodiscard]] constexpr tick_count
90 template<
typename Rep,
typename Period>
91 [[nodiscard]] constexpr tick_count
92 ticks(std::chrono::duration<Rep, Period> value) noexcept
94 return tick_count{ std::chrono::duration_cast<tick_duration>(value) };
Definition: bare_metal.h:20
constexpr tick_count ticks(tick_rep value) noexcept
Definition: ticks.h:85
TSM_TICK_PERIOD tick_period
Definition: ticks.h:42
std::chrono::duration< tick_rep, tick_period > tick_duration
Chrono duration type used for semantic scheduler ticks.
Definition: ticks.h:50
TSM_TICK_REP tick_rep
Definition: ticks.h:35
Strong value type for semantic scheduler ticks.
Definition: ticks.h:54
constexpr tick_count() noexcept=default
constexpr tick_rep count() const noexcept
Definition: ticks.h:73
tick_duration value
Definition: ticks.h:59
constexpr tick_count(tick_rep count) noexcept
Definition: ticks.h:68
tick_period period
Definition: ticks.h:56
tick_duration value_type
Definition: ticks.h:57
tick_rep rep
Definition: ticks.h:55
#define TSM_TICK_REP
Definition: ticks.h:21
#define TSM_TICK_PERIOD
Definition: ticks.h:25