From 13163e9fbf3e4e567256a654153f1b6165c8465a Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Sat, 14 May 2022 17:41:17 +0200 Subject: [PATCH] Move millis_nc to system_timer.h --- Firmware/Marlin.h | 21 --------------------- Firmware/system_timer.h | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 3e2d6754..26a89263 100755 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -255,27 +255,6 @@ void prepare_arc_move(bool isclockwise); void clamp_to_software_endstops(float target[3]); void refresh_cmd_timeout(void); -// Timer counter, incremented by the 1ms Arduino timer. -// The standard Arduino timer() function returns this value atomically -// by disabling / enabling interrupts. This is costly, if the interrupts are known -// to be disabled. -#ifdef SYSTEM_TIMER_2 -extern volatile unsigned long timer2_millis; -#else //SYSTEM_TIMER_2 -extern volatile unsigned long timer0_millis; -#endif //SYSTEM_TIMER_2 - -// An unsynchronized equivalent to a standard Arduino _millis() function. -// To be used inside an interrupt routine. - -FORCE_INLINE unsigned long millis_nc() { -#ifdef SYSTEM_TIMER_2 - return timer2_millis; -#else //SYSTEM_TIMER_2 - return timer0_millis; -#endif //SYSTEM_TIMER_2 -} - #ifdef FAST_PWM_FAN void setPwmFrequency(uint8_t pin, int val); #endif diff --git a/Firmware/system_timer.h b/Firmware/system_timer.h index 9906460a..d8ef8a26 100644 --- a/Firmware/system_timer.h +++ b/Firmware/system_timer.h @@ -4,6 +4,7 @@ #define FIRMWARE_SYSTEM_TIMER_H_ #include "Arduino.h" +#include "macros.h" #define SYSTEM_TIMER_2 #ifdef SYSTEM_TIMER_2 @@ -26,4 +27,24 @@ #define timer02_set_pwm0(pwm0) #endif //SYSTEM_TIMER_2 +// Timer counter, incremented by the 1ms Arduino timer. +// The standard Arduino timer() function returns this value atomically +// by disabling / enabling interrupts. This is costly, if the interrupts are known +// to be disabled. +#ifdef SYSTEM_TIMER_2 +extern volatile unsigned long timer2_millis; +#else //SYSTEM_TIMER_2 +extern volatile unsigned long timer0_millis; +#endif //SYSTEM_TIMER_2 + +// An unsynchronized equivalent to a standard Arduino _millis() function. +// To be used inside an interrupt routine. +FORCE_INLINE unsigned long millis_nc() { +#ifdef SYSTEM_TIMER_2 + return timer2_millis; +#else //SYSTEM_TIMER_2 + return timer0_millis; +#endif //SYSTEM_TIMER_2 +} + #endif /* FIRMWARE_SYSTEM_TIMER_H_ */