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/FilamentMonitors | |
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/FilamentMonitors')
-rw-r--r-- | src/FilamentMonitors/Duet3DFilamentMonitor.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/FilamentMonitors/Duet3DFilamentMonitor.cpp b/src/FilamentMonitors/Duet3DFilamentMonitor.cpp index 24fcf89b..cbdc58b5 100644 --- a/src/FilamentMonitors/Duet3DFilamentMonitor.cpp +++ b/src/FilamentMonitors/Duet3DFilamentMonitor.cpp @@ -21,14 +21,14 @@ Duet3DFilamentMonitor::Duet3DFilamentMonitor(unsigned int extruder, unsigned int void Duet3DFilamentMonitor::InitReceiveBuffer() { edgeCaptureReadPointer = edgeCaptureWritePointer = 1; - edgeCaptures[0] = StepTimer::GetInterruptClocks(); // pretend we just had a high-to-low transition + edgeCaptures[0] = StepTimer::GetTimerTicks(); // pretend we just had a high-to-low transition state = RxdState::waitingForStartBit; } // ISR for when the pin state changes. It should return true if the ISR wants the commanded extrusion to be fetched. bool Duet3DFilamentMonitor::Interrupt() { - uint32_t now = StepTimer::GetInterruptClocks(); + uint32_t now = StepTimer::GetTimerTicks(); bool wantReading = false; const size_t writePointer = edgeCaptureWritePointer; // capture volatile variable if ((writePointer + 1) % EdgeCaptureBufferSize != edgeCaptureReadPointer) // if buffer is not full @@ -81,7 +81,7 @@ Duet3DFilamentMonitor::PollResult Duet3DFilamentMonitor::PollReceiveBuffer(uint1 { again = false; const size_t writePointer = edgeCaptureWritePointer; // capture volatile variable - const uint32_t now = StepTimer::GetInterruptClocks(); + const uint32_t now = StepTimer::GetTimerTicks(); switch (state) { case RxdState::waitingForStartBit: |