From 30262b0a6eeecade45186a5d708f0c94d4cff20f Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Fri, 29 Jan 2021 17:30:04 +0100 Subject: [PATCH] Remove redundant definitions of CRITICAL_SECTION_* Move CRITICAL_SECTION_START/END into fastio.h, where it's needed. --- Firmware/Marlin.h | 5 ----- Firmware/fastio.h | 7 +++++++ Firmware/tone04.c | 9 --------- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 697f2f72c..f81abd8f7 100755 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -287,11 +287,6 @@ FORCE_INLINE unsigned long millis_nc() { void setPwmFrequency(uint8_t pin, int val); #endif -#ifndef CRITICAL_SECTION_START - #define CRITICAL_SECTION_START unsigned char _sreg = SREG; cli(); - #define CRITICAL_SECTION_END SREG = _sreg; -#endif //CRITICAL_SECTION_START - extern bool fans_check_enabled; extern float homing_feedrate[]; extern uint8_t axis_relative_modes; diff --git a/Firmware/fastio.h b/Firmware/fastio.h index e4f25ed8b..c4fee1019 100644 --- a/Firmware/fastio.h +++ b/Firmware/fastio.h @@ -17,6 +17,13 @@ #define MASK(PIN) (1 << PIN) #endif +#ifndef CRITICAL_SECTION_START + #define CRITICAL_SECTION_START unsigned char _sreg = SREG; cli(); + #define CRITICAL_SECTION_END SREG = _sreg; + #include +#endif //CRITICAL_SECTION_START + + /* magic I/O routines now you can simply SET_OUTPUT(STEP); WRITE(STEP, 1); WRITE(STEP, 0); diff --git a/Firmware/tone04.c b/Firmware/tone04.c index 41f904a91..5c36a5370 100644 --- a/Firmware/tone04.c +++ b/Firmware/tone04.c @@ -7,16 +7,7 @@ #ifdef SYSTEM_TIMER_2 -#include -#include #include "pins.h" - -#ifndef CRITICAL_SECTION_START - #define CRITICAL_SECTION_START unsigned char _sreg = SREG; cli(); - #define CRITICAL_SECTION_END SREG = _sreg; -#endif //CRITICAL_SECTION_START - - #include "fastio.h" void timer4_init(void)