🩹 Fix delay µs > 32767

Fixes #27753
This commit is contained in:
Scott Lahteine 2025-05-22 13:41:28 -05:00
parent 9c9ed690f7
commit e7662920a6

View file

@ -100,7 +100,7 @@ void calibrate_delay_loop();
// For delay in microseconds, no smart delay selection is required, directly call the delay function
// Teensy compiler is too old and does not accept smart delay compile-time / run-time selection correctly
#define DELAY_US(x) DelayCycleFnc((x) * ((F_CPU) / 1000000UL))
#define DELAY_US(x) DelayCycleFnc((unsigned long)(x) * ((F_CPU) / 1000000UL))
#elif defined(__AVR__)
FORCE_INLINE static void __delay_up_to_3c(uint8_t cycles) {
@ -164,7 +164,7 @@ void calibrate_delay_loop();
}
// Delay in microseconds
#define DELAY_US(x) DELAY_CYCLES((x) * ((F_CPU) / 1000000UL))
#define DELAY_US(x) DELAY_CYCLES((unsigned long)(x) * ((F_CPU) / 1000000UL))
#define DELAY_CYCLES_VAR DELAY_CYCLES
@ -173,7 +173,7 @@ void calibrate_delay_loop();
// DELAY_CYCLES specified inside platform
// Delay in microseconds
#define DELAY_US(x) DELAY_CYCLES((x) * ((F_CPU) / 1000000UL))
#define DELAY_US(x) DELAY_CYCLES((unsigned long)(x) * ((F_CPU) / 1000000UL))
#define DELAY_CYCLES_VAR DELAY_CYCLES