diff options
author | David Crocker <dcrocker@eschertech.com> | 2019-11-14 00:33:15 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2019-11-14 00:33:15 +0300 |
commit | 0bd7e4618f0df71f271cc031604eb4d33f69cd8b (patch) | |
tree | ba5a3b233fb6dc0f0c74d231ef4f3d71807d5da1 /src/Endstops/LocalZProbe.cpp | |
parent | 54259da8a68b184f8c1bd5b91338aa71fa5492f4 (diff) |
Refactor StepTimer and step interrupts
SoftTimer class renamed StepTimer. We now use instances of StepTimer to schedule step interrupts. This means we only need a single compare match interrupt from the step timer TC. In turn this allows us to chain two 16-bit timers together on the SAM4S and SAME70 so we no longer need to keep the upper 16 bits in software or use the overflow interrupt.
Diffstat (limited to 'src/Endstops/LocalZProbe.cpp')
-rw-r--r-- | src/Endstops/LocalZProbe.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Endstops/LocalZProbe.cpp b/src/Endstops/LocalZProbe.cpp index 7af2c88d..852c4b88 100644 --- a/src/Endstops/LocalZProbe.cpp +++ b/src/Endstops/LocalZProbe.cpp @@ -126,9 +126,9 @@ GCodeResult LocalZProbe::AppendPinNames(const StringRef& str) const return GCodeResult::ok; } -// programming functions +// Z probe programming functions -/*static*/ bool LocalZProbe::TimerInterrupt(CallbackParameter param, uint32_t& when) +/*static*/ bool LocalZProbe::TimerInterrupt(CallbackParameter param, StepTimer::Ticks& when) { return static_cast<LocalZProbe*>(param.vp)->Interrupt(when); } @@ -145,11 +145,12 @@ GCodeResult LocalZProbe::SendProgram(const uint32_t zProbeProgram[], size_t len, numBytes = len; bytesSent = 0; bitsSent = 0; - bitTime = SoftTimer::GetTickRate()/bitsPerSecond; + bitTime = StepTimer::GetTickRate()/bitsPerSecond; modulationPort.WriteDigital(false); // start with 2 bits of zero - startTime = SoftTimer::GetTimerTicksNow(); - timer.ScheduleCallback(startTime + 2 * bitTime, LocalZProbe::TimerInterrupt, static_cast<void*>(this)); + startTime = StepTimer::GetTimerTicks(); + timer.SetCallback(LocalZProbe::TimerInterrupt, static_cast<void*>(this)); + timer.ScheduleCallback(startTime + 2 * bitTime); // TODO wait until all bytes sent or some error occurs, but for now we return immediately return GCodeResult::ok; |