NanoTime::Clock< ClockDef, frequency_, TickType_, maxTicks_ > Struct Template Reference
Class template representing a physical Clock with fixed timing characteristics. More...
#include <NanoTime.h>
Inheritance diagram for NanoTime::Clock< ClockDef, frequency_, TickType_, maxTicks_ >:
Public Types | |
using | TickType = TickType_ |
template<uint64_t ticks> | |
using | TicksConst = TicksConst< Clock, ticks > |
template<Unit unit, uint64_t time> | |
using | TimeConst = TimeConst< Clock, unit, time > |
template<Unit unit> | |
using | TicksPerUnit = std::ratio_divide< std::ratio< frequency_ >, UnitTickRatio< unit > > |
template<Unit unit, typename TimeType > | |
using | TimeSource = TimeSource< Clock, unit, TimeType > |
template<typename T > | |
using | Ticks = Ticks< Clock, T > |
using | MaxTicks = TicksConst< maxTicks_ > |
template<Unit unit> | |
using | MaxTime = typename MaxTicks::template TimeConst< unit > |
Static Public Member Functions | |
static constexpr const char * | typeName () |
static constexpr uint32_t | frequency () |
static constexpr MaxTicks | maxTicks () |
template<Unit unit> | |
static constexpr MaxTime< unit > | maxTime () |
static Ratio32 | ticksPerUnit (Unit unit) |
Get ticks per unit as a Ratio object. More... | |
template<Unit unit, uint64_t time> | |
static constexpr TimeConst< unit, time > | timeConst () |
Class template defining a fixed time quantity. More... | |
template<uint64_t ticks> | |
static constexpr TicksConst< ticks > | ticksConst () |
Class template defining a fixed tick quantity. More... | |
template<Unit unit, typename TimeType > | |
static constexpr TimeSource< unit, TimeType > | timeSource () |
Create a Time Source for this Clock. More... | |
template<Unit unit, typename TimeType > | |
static Ticks< TimeType > | timeToTicks (TimeType time) |
Get the number of ticks for a given time. More... | |
template<Unit unit, typename TimeType > | |
static Time< TimeType > | ticksToTime (TimeType ticks) |
Get the time for a given number of clock ticks. More... | |
static String | toString () |
Detailed Description
template<typename ClockDef, uint32_t frequency_, typename TickType_, TickType_ maxTicks_>
struct NanoTime::Clock< ClockDef, frequency_, TickType_, maxTicks_ >
Class template representing a physical Clock with fixed timing characteristics.
- Template Parameters
-
ClockDef The actual Clock being constructed (so we can query its properties) frequency_ Clock frequency in Hz TickType_ Variable type representing the clock's tick value maxTicks_ Maximum count value for the clock
- Note
- Physical clocks are implemented using this as a base. The provided frequency accounts for any prescaler setting in force. Fixing this at compile time helps to avoid expensive runtime calculations and permits static range checks.
- See also
- Use
TimeSource
to work with a Clock in specific time units
Member Typedef Documentation
◆ MaxTicks
template<typename ClockDef , uint32_t frequency_, typename TickType_ , TickType_ maxTicks_>
using NanoTime::Clock< ClockDef, frequency_, TickType_, maxTicks_ >::MaxTicks = TicksConst<maxTicks_> |
◆ MaxTime
template<typename ClockDef , uint32_t frequency_, typename TickType_ , TickType_ maxTicks_>
template<Unit unit>
using NanoTime::Clock< ClockDef, frequency_, TickType_, maxTicks_ >::MaxTime = typename MaxTicks::template TimeConst<unit> |
◆ Ticks
template<typename ClockDef , uint32_t frequency_, typename TickType_ , TickType_ maxTicks_>
template<typename T >
using NanoTime::Clock< ClockDef, frequency_, TickType_, maxTicks_ >::Ticks = Ticks<Clock, T> |
◆ TicksConst
template<typename ClockDef , uint32_t frequency_, typename TickType_ , TickType_ maxTicks_>
template<uint64_t ticks>
using NanoTime::Clock< ClockDef, frequency_, TickType_, maxTicks_ >::TicksConst = TicksConst<Clock, ticks> |
◆ TicksPerUnit
template<typename ClockDef , uint32_t frequency_, typename TickType_ , TickType_ maxTicks_>
template<Unit unit>
using NanoTime::Clock< ClockDef, frequency_, TickType_, maxTicks_ >::TicksPerUnit = std::ratio_divide<std::ratio<frequency_>, UnitTickRatio<unit> > |
◆ TickType
template<typename ClockDef , uint32_t frequency_, typename TickType_ , TickType_ maxTicks_>
using NanoTime::Clock< ClockDef, frequency_, TickType_, maxTicks_ >::TickType = TickType_ |
◆ TimeConst
template<typename ClockDef , uint32_t frequency_, typename TickType_ , TickType_ maxTicks_>
template<Unit unit, uint64_t time>
using NanoTime::Clock< ClockDef, frequency_, TickType_, maxTicks_ >::TimeConst = TimeConst<Clock, unit, time> |
◆ TimeSource
template<typename ClockDef , uint32_t frequency_, typename TickType_ , TickType_ maxTicks_>
template<Unit unit, typename TimeType >
using NanoTime::Clock< ClockDef, frequency_, TickType_, maxTicks_ >::TimeSource = TimeSource<Clock, unit, TimeType> |
Member Function Documentation
◆ frequency()
template<typename ClockDef , uint32_t frequency_, typename TickType_ , TickType_ maxTicks_>
|
inlinestaticconstexpr |
◆ maxTicks()
template<typename ClockDef , uint32_t frequency_, typename TickType_ , TickType_ maxTicks_>
|
inlinestaticconstexpr |
◆ maxTime()
template<typename ClockDef , uint32_t frequency_, typename TickType_ , TickType_ maxTicks_>
template<Unit unit>
|
inlinestaticconstexpr |
◆ ticksConst()
template<typename ClockDef , uint32_t frequency_, typename TickType_ , TickType_ maxTicks_>
template<uint64_t ticks>
|
inlinestaticconstexpr |
Class template defining a fixed tick quantity.
- Template Parameters
-
ticks
- Return values
-
TicksConst<Clock,ticks>
◆ ticksPerUnit()
template<typename ClockDef , uint32_t frequency_, typename TickType_ , TickType_ maxTicks_>
|
inlinestatic |
Get ticks per unit as a Ratio object.
- Return values
-
BasicRatio32
◆ ticksToTime()
template<typename ClockDef , uint32_t frequency_, typename TickType_ , TickType_ maxTicks_>
template<Unit unit, typename TimeType >
|
inlinestatic |
Get the time for a given number of clock ticks.
- Parameters
-
ticks
- Return values
-
TimeType Time count, rounded to the nearest unit
◆ timeConst()
template<typename ClockDef , uint32_t frequency_, typename TickType_ , TickType_ maxTicks_>
template<Unit unit, uint64_t time>
|
inlinestaticconstexpr |
◆ timeSource()
template<typename ClockDef , uint32_t frequency_, typename TickType_ , TickType_ maxTicks_>
template<Unit unit, typename TimeType >
|
inlinestaticconstexpr |
◆ timeToTicks()
template<typename ClockDef , uint32_t frequency_, typename TickType_ , TickType_ maxTicks_>
template<Unit unit, typename TimeType >
|
inlinestatic |
Get the number of ticks for a given time.
- Parameters
-
time
- Return values
-
TimeType Tick count, rounded to the nearest tick
◆ toString()
template<typename ClockDef , uint32_t frequency_, typename TickType_ , TickType_ maxTicks_>
|
inlinestatic |
◆ typeName()
template<typename ClockDef , uint32_t frequency_, typename TickType_ , TickType_ maxTicks_>
|
inlinestaticconstexpr |
The documentation for this struct was generated from the following file: