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

Method checkCallbackTimer

tests/HostTests/modules/Timers.cpp:152–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150 }
151
152 template <typename TimerType> static void checkCallbackTimer()
153 {
154 TimerType timer;
155
156 Serial << timer << _F(", maxTicks = ") << TimerType::maxTicks() << _F(", maxTime = ")
157 << TimerType::Micros::MaxClockTime::value() << endl;
158
159 // CpuCycleTimer timer;
160 // Serial.print(timer);
161 // Serial.print(", maxClockTime = ");
162 // Serial.print(NanoTime::TimeValue(timer.unit(), timer.maxClockTime()));
163 // Serial.print(", ticksPerUnit = ");
164 // Serial.print(timer.ticksPerUnit());
165 // Serial.print(", maxInterval = ");
166 // Serial.print(timer.maxInterval());
167 // Serial.print(", margin = ");
168 // Serial.print(timer.margin().ticks());
169 // Serial.print(" ticks");
170 // Serial.println();
171
172 //
173 const auto time = NanoTime::time(NanoTime::Microseconds, 5000); //500020107;
174 auto ticks = timer.usToTicks(time);
175 Serial << _F("time = ") << time.toString() << _F(", ticks = ") << ticks << ", "
176 << TimerType::Micros::ticksToTime(ticks).toString() << endl;
177
178 //
179 auto t1 = timer.micros().template timeConst<5000>();
180 t1.check();
181 Serial << _F("t1 = ") << t1.toString() << ", " << t1.clock().toString()
182 << ", ticksPerUnit = " << t1.ticksPerUnit() << ", ticks = " << t1.ticks() << ", " << t1.clockTime()
183 << ", " << t1.clockValue() << endl;
184
185 // ElapseTimer et;
186 // timer.reset<500000000>();
187 // while(!timer.expired()) {
188 // }
189 // auto elapsed = et.elapsedTime();
190 // Serial.print("Elapsed = ");
191 // Serial.println(NanoTime::time(et.unit(), elapsed));
192
193 // Ratio<uint32_t> ratio(NanoTime::Seconds);
194 // Serial.println(ratio);
195
196 // auto nanos = typename TimerType::template TicksConst<TimerType::maxTicks() + 1>::as<NanoTime::Nanoseconds>();
197 // using Nanos = NanoTime::TimeSource<typename TimerType::Clock, NanoTime::Nanoseconds, uint64_t>;
198
199 typename TimerType::Clock::template TicksConst<timer.maxTicks() + 1> nanos;
200
201 // auto nanos = NanoTime::TicksConst<typename TimerType::Clock, timer.maxTicks() + 1>::as<NanoTime::NanoSeconds>();
202 // auto nanos = Nanos::template ticksConst<timer.maxTicks() + 1>();
203 Serial << _F("nanos = ") << nanos.template as<NanoTime::Nanoseconds>().toString() << endl;
204
205 Serial << _F("interval = ") << timer.getIntervalUs() << _F("us, ticks = ") << timer.getInterval() << endl;
206 }
207
208private:
209 Timer statusTimer;

Callers

nothing calls this directly

Calls 13

usToTicksMethod · 0.80
microsMethod · 0.80
clockTimeMethod · 0.80
clockValueMethod · 0.80
getIntervalUsMethod · 0.80
timeFunction · 0.50
toStringMethod · 0.45
checkMethod · 0.45
clockMethod · 0.45
ticksPerUnitMethod · 0.45
ticksMethod · 0.45
maxTicksMethod · 0.45

Tested by

no test coverage detected