MCPcopy Create free account
hub / github.com/SmingHub/Sming / check

Method check

tests/HostTests/modules/Clocks.cpp:80–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78 }
79
80 template <NanoTime::Unit unit> void check(TimeType value)
81 {
82 using TimeSource = NanoTime::TimeSource<Clock, unit, TimeType>;
83
84 // Serial.print("HwTimer::maxTime = ");
85 // Serial.println(HwTimer::maxTime());
86
87 this->timeunit = unit;
88
89 //
90 valueIsTime = true;
91 this->value = value % TimeSource::maxCalcTime();
92
93 noInterrupts();
94 refCycles.start();
95 ref = timeToTicksRef();
96 refCycles.update();
97
98 calcCycles.start();
99 calc = TimeSource::timeToTicks(this->value);
100 calcCycles.update();
101 interrupts();
102
103 if(calc != ref) {
104 calc = TimeSource::timeToTicks(this->value);
105 }
106
107 compare();
108
109 //
110 valueIsTime = false;
111 this->value = value % TimeSource::maxCalcTicks();
112
113 noInterrupts();
114 refCycles.start();
115 ref = ticksToTimeRef();
116 refCycles.update();
117
118 calcCycles.start();
119 calc = TimeSource::ticksToTime(this->value);
120 calcCycles.update();
121 interrupts();
122 compare();
123 }
124
125 void printStats()
126 {

Callers

nothing calls this directly

Calls 5

compareFunction · 0.85
noInterruptsFunction · 0.50
interruptsFunction · 0.50
startMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected