Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/RepRapFirmware.h')
-rw-r--r--src/RepRapFirmware.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/RepRapFirmware.h b/src/RepRapFirmware.h
index b47a86d6..179b865a 100644
--- a/src/RepRapFirmware.h
+++ b/src/RepRapFirmware.h
@@ -502,6 +502,12 @@ constexpr uint32_t StepClockRate = SystemCoreClockFreq/128; // Duet 2 and Ma
constexpr uint64_t StepClockRateSquared = (uint64_t)StepClockRate * StepClockRate;
constexpr float StepClocksToMillis = 1000.0/(float)StepClockRate;
+// Convert microseconds to step clocks, rounding up to the next step clock
+static inline constexpr uint32_t MicrosecondsToStepClocks(float us) noexcept
+{
+ return (uint32_t)ceilf((float)StepClockRate * 0.000001 * us);
+}
+
// Functions to convert speeds and accelerations between seconds and step clocks
static inline constexpr float ConvertSpeedFromMmPerSec(float speed) noexcept
{