Browse Source

Remove redundant definitions of CRITICAL_SECTION_*

Move CRITICAL_SECTION_START/END into fastio.h, where it's needed.
Yuri D'Elia 3 years ago
parent
commit
30262b0a6e
3 changed files with 7 additions and 14 deletions
  1. 0 5
      Firmware/Marlin.h
  2. 7 0
      Firmware/fastio.h
  3. 0 9
      Firmware/tone04.c

+ 0 - 5
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;

+ 7 - 0
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 <avr/interrupt.h>
+#endif //CRITICAL_SECTION_START
+
+
 /*
   magic I/O routines
   now you can simply SET_OUTPUT(STEP); WRITE(STEP, 1); WRITE(STEP, 0);

+ 0 - 9
Firmware/tone04.c

@@ -7,16 +7,7 @@
 
 #ifdef SYSTEM_TIMER_2
 
-#include <avr/io.h>
-#include <avr/interrupt.h>
 #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)