| 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 | |
| 208 | private: |
| 209 | Timer statusTimer; |
nothing calls this directly
no test coverage detected