diff --git a/Marlin/src/HAL/HAL.h b/Marlin/src/HAL/HAL.h
deleted file mode 100644
index ccd0d9888f..0000000000
--- a/Marlin/src/HAL/HAL.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* **************************************************************************
-
- Marlin 3D Printer Firmware
- Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
- Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-****************************************************************************/
-
-/**
- * Description: HAL wrapper
- *
- * Supports platforms :
- * ARDUINO_ARCH_SAM : For Arduino Due and other boards based on Atmel SAM3X8E
- * __AVR__ : For all Atmel AVR boards
- */
-
-#ifndef _HAL_H
-#define _HAL_H
-
-#include "HAL_SPI.h"
-
-#define CPU_32_BIT
-
-#ifdef __AVR__
- #undef CPU_32_BIT
- #include "HAL_AVR/HAL_AVR.h"
-#elif defined(ARDUINO_ARCH_SAM)
- #include "HAL_DUE/HAL_Due.h"
- #include "math_32bit.h"
-#elif defined(__MK64FX512__) || defined(__MK66FX1M0__)
- #include "HAL_TEENSY35_36/HAL_Teensy.h"
- #include "math_32bit.h"
-#elif defined(TARGET_LPC1768)
- #include "math_32bit.h"
- #include "HAL_LPC1768/HAL.h"
-#elif defined(__STM32F1__) || defined(TARGET_STM32F1)
- #include "math_32bit.h"
- #include "HAL_STM32F1/HAL_Stm32f1.h"
-#elif defined(STM32F7)
- #define CPU_32_BIT
- #include "math_32bit.h"
- #include "HAL_STM32F7/HAL_STM32F7.h"
-#else
- #error "Unsupported Platform!"
-#endif
-
-#endif // _HAL_H
diff --git a/Marlin/src/HAL/HAL_AVR/HAL_AVR.cpp b/Marlin/src/HAL/HAL_AVR/HAL.cpp
similarity index 100%
rename from Marlin/src/HAL/HAL_AVR/HAL_AVR.cpp
rename to Marlin/src/HAL/HAL_AVR/HAL.cpp
diff --git a/Marlin/src/HAL/HAL_AVR/HAL_AVR.h b/Marlin/src/HAL/HAL_AVR/HAL.h
similarity index 99%
rename from Marlin/src/HAL/HAL_AVR/HAL_AVR.h
rename to Marlin/src/HAL/HAL_AVR/HAL.h
index 1a5d02682a..767bc1be39 100644
--- a/Marlin/src/HAL/HAL_AVR/HAL_AVR.h
+++ b/Marlin/src/HAL/HAL_AVR/HAL.h
@@ -43,6 +43,7 @@
#include
#include
+#include "../HAL_SPI.h"
#include "fastio_AVR.h"
#include "watchdog_AVR.h"
#include "math_AVR.h"
diff --git a/Marlin/src/HAL/HAL_AVR/SanityCheck_AVR_8_bit.h b/Marlin/src/HAL/HAL_AVR/SanityCheck.h
similarity index 100%
rename from Marlin/src/HAL/HAL_AVR/SanityCheck_AVR_8_bit.h
rename to Marlin/src/HAL/HAL_AVR/SanityCheck.h
diff --git a/Marlin/src/HAL/HAL_AVR/endstop_interrupts.h b/Marlin/src/HAL/HAL_AVR/endstop_interrupts.h
index 8bd6f0081d..052f61fcfe 100644
--- a/Marlin/src/HAL/HAL_AVR/endstop_interrupts.h
+++ b/Marlin/src/HAL/HAL_AVR/endstop_interrupts.h
@@ -41,6 +41,17 @@
#include "../../core/macros.h"
#include
+volatile uint8_t e_hit = 0; // Different from 0 when the endstops should be tested in detail.
+ // Must be reset to 0 by the test function when finished.
+
+// This is what is really done inside the interrupts.
+FORCE_INLINE void endstop_ISR_worker( void ) {
+ e_hit = 2; // Because the detection of a e-stop hit has a 1 step debouncer it has to be called at least twice.
+}
+
+// One ISR for all EXT-Interrupts
+void endstop_ISR(void) { endstop_ISR_worker(); }
+
/**
* Patch for pins_arduino.h (...\Arduino\hardware\arduino\avr\variants\mega\pins_arduino.h)
*
diff --git a/Marlin/src/HAL/HAL_AVR/pinsDebug_AVR_8_bit.h b/Marlin/src/HAL/HAL_AVR/pinsDebug.h
similarity index 100%
rename from Marlin/src/HAL/HAL_AVR/pinsDebug_AVR_8_bit.h
rename to Marlin/src/HAL/HAL_AVR/pinsDebug.h
diff --git a/Marlin/src/HAL/HAL_DUE/HAL_Due.cpp b/Marlin/src/HAL/HAL_DUE/HAL.cpp
similarity index 99%
rename from Marlin/src/HAL/HAL_DUE/HAL_Due.cpp
rename to Marlin/src/HAL/HAL_DUE/HAL.cpp
index f53e7a122e..9d932d94db 100644
--- a/Marlin/src/HAL/HAL_DUE/HAL_Due.cpp
+++ b/Marlin/src/HAL/HAL_DUE/HAL.cpp
@@ -29,7 +29,7 @@
// Includes
// --------------------------------------------------------------------------
-#include "../HAL.h"
+#include "HAL.h"
#include
#include "usb/usb_task.h"
diff --git a/Marlin/src/HAL/HAL_DUE/HAL_Due.h b/Marlin/src/HAL/HAL_DUE/HAL.h
similarity index 98%
rename from Marlin/src/HAL/HAL_DUE/HAL_Due.h
rename to Marlin/src/HAL/HAL_DUE/HAL.h
index 4f574ecbd2..efac5ee8cd 100644
--- a/Marlin/src/HAL/HAL_DUE/HAL_Due.h
+++ b/Marlin/src/HAL/HAL_DUE/HAL.h
@@ -29,10 +29,14 @@
#ifndef _HAL_DUE_H
#define _HAL_DUE_H
+#define CPU_32_BIT
+
#include
#include
+#include "../math_32bit.h"
+#include "../HAL_SPI.h"
#include "fastio_Due.h"
#include "watchdog_Due.h"
#include "HAL_timers_Due.h"
diff --git a/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.cpp b/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.cpp
index 131318c159..c5121f62e8 100644
--- a/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.cpp
+++ b/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.cpp
@@ -32,7 +32,7 @@
// Includes
// --------------------------------------------------------------------------
-#include "../HAL.h"
+#include "HAL.h"
#include "HAL_timers_Due.h"
diff --git a/Marlin/src/HAL/HAL_DUE/InterruptVectors_Due.cpp b/Marlin/src/HAL/HAL_DUE/InterruptVectors_Due.cpp
index b10f06becc..9b226a60da 100644
--- a/Marlin/src/HAL/HAL_DUE/InterruptVectors_Due.cpp
+++ b/Marlin/src/HAL/HAL_DUE/InterruptVectors_Due.cpp
@@ -32,7 +32,7 @@
*/
#ifdef ARDUINO_ARCH_SAM
-#include "HAL_Due.h"
+#include "HAL.h"
#include "InterruptVectors_Due.h"
/* The relocated Exception/Interrupt Table - According to the ARM
diff --git a/Marlin/src/HAL/HAL_DUE/SanityCheck_Due.h b/Marlin/src/HAL/HAL_DUE/SanityCheck.h
similarity index 100%
rename from Marlin/src/HAL/HAL_DUE/SanityCheck_Due.h
rename to Marlin/src/HAL/HAL_DUE/SanityCheck.h
diff --git a/Marlin/src/HAL/HAL_DUE/Tone.cpp b/Marlin/src/HAL/HAL_DUE/Tone.cpp
index c097e1e4ca..55c03f5e58 100644
--- a/Marlin/src/HAL/HAL_DUE/Tone.cpp
+++ b/Marlin/src/HAL/HAL_DUE/Tone.cpp
@@ -27,7 +27,7 @@
#ifdef ARDUINO_ARCH_SAM
-#include "HAL_Due.h"
+#include "HAL.h"
#include "HAL_timers_Due.h"
static pin_t tone_pin;
diff --git a/Marlin/src/HAL/HAL_DUE/endstop_interrupts.h b/Marlin/src/HAL/HAL_DUE/endstop_interrupts.h
index 123519642a..1a1d8fe82b 100644
--- a/Marlin/src/HAL/HAL_DUE/endstop_interrupts.h
+++ b/Marlin/src/HAL/HAL_DUE/endstop_interrupts.h
@@ -34,8 +34,19 @@
* (Located in Marlin/buildroot/share/pin_interrupt_test/pin_interrupt_test.ino)
*/
- #ifndef _ENDSTOP_INTERRUPTS_H_
- #define _ENDSTOP_INTERRUPTS_H_
+#ifndef _ENDSTOP_INTERRUPTS_H_
+#define _ENDSTOP_INTERRUPTS_H_
+
+volatile uint8_t e_hit = 0; // Different from 0 when the endstops should be tested in detail.
+ // Must be reset to 0 by the test function when finished.
+
+// This is what is really done inside the interrupts.
+FORCE_INLINE void endstop_ISR_worker( void ) {
+ e_hit = 2; // Because the detection of a e-stop hit has a 1 step debouncer it has to be called at least twice.
+}
+
+// One ISR for all EXT-Interrupts
+void endstop_ISR(void) { endstop_ISR_worker(); }
/**
* Endstop interrupts for Due based targets.
diff --git a/Marlin/src/HAL/HAL_DUE/HAL_pinsDebug_Due.h b/Marlin/src/HAL/HAL_DUE/pinsDebug.h
similarity index 100%
rename from Marlin/src/HAL/HAL_DUE/HAL_pinsDebug_Due.h
rename to Marlin/src/HAL/HAL_DUE/pinsDebug.h
diff --git a/Marlin/src/HAL/HAL_DUE/watchdog_Due.h b/Marlin/src/HAL/HAL_DUE/watchdog_Due.h
index be8afd2e81..57120309a3 100644
--- a/Marlin/src/HAL/HAL_DUE/watchdog_Due.h
+++ b/Marlin/src/HAL/HAL_DUE/watchdog_Due.h
@@ -25,7 +25,7 @@
// Arduino Due core now has watchdog support
-#include "../HAL.h"
+#include "HAL.h"
// Initialize watchdog with a 4 second interrupt time
void watchdog_init();
diff --git a/Marlin/src/HAL/HAL_LPC1768/HAL.h b/Marlin/src/HAL/HAL_LPC1768/HAL.h
index 40f3a8e905..6aeafedf22 100644
--- a/Marlin/src/HAL/HAL_LPC1768/HAL.h
+++ b/Marlin/src/HAL/HAL_LPC1768/HAL.h
@@ -28,6 +28,8 @@
#ifndef _HAL_LPC1768_H_
#define _HAL_LPC1768_H_
+#define CPU_32_BIT
+
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
@@ -58,6 +60,8 @@ extern "C" volatile uint32_t _millis;
#include
#include
+#include "../math_32bit.h"
+#include "../HAL_SPI.h"
#include "fastio.h"
#include "watchdog.h"
#include "serial.h"
diff --git a/Marlin/src/HAL/HAL_LPC1768/endstop_interrupts.h b/Marlin/src/HAL/HAL_LPC1768/endstop_interrupts.h
index 1bb8586a28..cb0449629a 100644
--- a/Marlin/src/HAL/HAL_LPC1768/endstop_interrupts.h
+++ b/Marlin/src/HAL/HAL_LPC1768/endstop_interrupts.h
@@ -34,8 +34,22 @@
* (Located in Marlin/buildroot/share/pin_interrupt_test/pin_interrupt_test.ino)
*/
- #ifndef _ENDSTOP_INTERRUPTS_H_
- #define _ENDSTOP_INTERRUPTS_H_
+#ifndef _ENDSTOP_INTERRUPTS_H_
+#define _ENDSTOP_INTERRUPTS_H_
+
+//Currently this is untested and broken
+#error "Please disable Endstop Interrupts LPC176x is currently an unsupported platform"
+
+volatile uint8_t e_hit = 0; // Different from 0 when the endstops should be tested in detail.
+ // Must be reset to 0 by the test function when finished.
+
+// This is what is really done inside the interrupts.
+FORCE_INLINE void endstop_ISR_worker( void ) {
+ e_hit = 2; // Because the detection of a e-stop hit has a 1 step debouncer it has to be called at least twice.
+}
+
+// One ISR for all EXT-Interrupts
+void endstop_ISR(void) { endstop_ISR_worker(); }
void setup_endstop_interrupts(void) {
#if HAS_X_MAX
diff --git a/Marlin/src/HAL/HAL_LPC1768/pinsDebug_LPC1768.h b/Marlin/src/HAL/HAL_LPC1768/pinsDebug.h
similarity index 100%
rename from Marlin/src/HAL/HAL_LPC1768/pinsDebug_LPC1768.h
rename to Marlin/src/HAL/HAL_LPC1768/pinsDebug.h
diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL_Stm32f1.cpp b/Marlin/src/HAL/HAL_STM32F1/HAL.cpp
similarity index 99%
rename from Marlin/src/HAL/HAL_STM32F1/HAL_Stm32f1.cpp
rename to Marlin/src/HAL/HAL_STM32F1/HAL.cpp
index d47b960ab5..d1ec010ea8 100644
--- a/Marlin/src/HAL/HAL_STM32F1/HAL_Stm32f1.cpp
+++ b/Marlin/src/HAL/HAL_STM32F1/HAL.cpp
@@ -31,7 +31,7 @@
// Includes
// --------------------------------------------------------------------------
-#include "../HAL.h"
+#include "HAL.h"
#include
//#include
diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL_Stm32f1.h b/Marlin/src/HAL/HAL_STM32F1/HAL.h
similarity index 98%
rename from Marlin/src/HAL/HAL_STM32F1/HAL_Stm32f1.h
rename to Marlin/src/HAL/HAL_STM32F1/HAL.h
index fdbb5a53c0..3474ae5e11 100644
--- a/Marlin/src/HAL/HAL_STM32F1/HAL_Stm32f1.h
+++ b/Marlin/src/HAL/HAL_STM32F1/HAL.h
@@ -28,6 +28,7 @@
#ifndef _HAL_STM32F1_H
#define _HAL_STM32F1_H
+#define CPU_32_BIT
#undef DEBUG_NONE
#ifndef vsnprintf_P
@@ -55,6 +56,9 @@
// Includes
// --------------------------------------------------------------------------
+#include "../math_32bit.h"
+#include "../HAL_SPI.h"
+
#include "fastio_Stm32f1.h"
#include "watchdog_Stm32f1.h"
diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL_spi_Stm32f1.cpp b/Marlin/src/HAL/HAL_STM32F1/HAL_spi_Stm32f1.cpp
index d0985eb23d..488773d9a4 100644
--- a/Marlin/src/HAL/HAL_STM32F1/HAL_spi_Stm32f1.cpp
+++ b/Marlin/src/HAL/HAL_STM32F1/HAL_spi_Stm32f1.cpp
@@ -36,7 +36,7 @@
// Includes
// --------------------------------------------------------------------------
-#include "../HAL.h"
+#include "HAL.h"
#include "../HAL_SPI.h"
#include "pins_arduino.h"
#include "spi_pins.h"
diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.cpp b/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.cpp
index 21b7033671..d3de91ac12 100644
--- a/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.cpp
+++ b/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.cpp
@@ -30,7 +30,7 @@
// Includes
// --------------------------------------------------------------------------
-#include "../HAL.h"
+#include "HAL.h"
#include "HAL_timers_Stm32f1.h"
diff --git a/Marlin/src/HAL/HAL_STM32F1/SanityCheck_Stm32f1.h b/Marlin/src/HAL/HAL_STM32F1/SanityCheck.h
similarity index 100%
rename from Marlin/src/HAL/HAL_STM32F1/SanityCheck_Stm32f1.h
rename to Marlin/src/HAL/HAL_STM32F1/SanityCheck.h
diff --git a/Marlin/src/HAL/HAL_STM32F1/endstop_interrupts.h b/Marlin/src/HAL/HAL_STM32F1/endstop_interrupts.h
index df68cf0817..21cecad63e 100644
--- a/Marlin/src/HAL/HAL_STM32F1/endstop_interrupts.h
+++ b/Marlin/src/HAL/HAL_STM32F1/endstop_interrupts.h
@@ -49,6 +49,17 @@
#ifndef _ENDSTOP_INTERRUPTS_H_
#define _ENDSTOP_INTERRUPTS_H_
+volatile uint8_t e_hit = 0; // Different from 0 when the endstops should be tested in detail.
+ // Must be reset to 0 by the test function when finished.
+
+// This is what is really done inside the interrupts.
+FORCE_INLINE void endstop_ISR_worker( void ) {
+ e_hit = 2; // Because the detection of a e-stop hit has a 1 step debouncer it has to be called at least twice.
+}
+
+// One ISR for all EXT-Interrupts
+void endstop_ISR(void) { endstop_ISR_worker(); }
+
void setup_endstop_interrupts(void) {
#if HAS_X_MAX
SET_INPUT(X_MAX_PIN);
diff --git a/Marlin/src/HAL/HAL_STM32F1/pinsDebug.h b/Marlin/src/HAL/HAL_STM32F1/pinsDebug.h
new file mode 100644
index 0000000000..e5022f79a4
--- /dev/null
+++ b/Marlin/src/HAL/HAL_STM32F1/pinsDebug.h
@@ -0,0 +1 @@
+#error Debug pins is not supported on this Platform!
diff --git a/Marlin/src/HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.h b/Marlin/src/HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.h
index 93d3322f15..d5c54985f5 100644
--- a/Marlin/src/HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.h
+++ b/Marlin/src/HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.h
@@ -9,7 +9,7 @@
******************************************************************************
* @attention
*
- * © Copyright © 2016 STMicroelectronics International N.V.
+ * © Copyright © 2016 STMicroelectronics International N.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -54,7 +54,7 @@
// Includes
// --------------------------------------------------------------------------
#include "../../../inc/MarlinConfig.h"
-#include "../../HAL.h"
+#include "../HAL.h"
/* Exported constants --------------------------------------------------------*/
/* EEPROM emulation firmware error codes */
diff --git a/Marlin/src/HAL/HAL_STM32F7/EmulatedEeprom.cpp b/Marlin/src/HAL/HAL_STM32F7/EmulatedEeprom.cpp
index c3cf6ee7ca..390ff35de5 100644
--- a/Marlin/src/HAL/HAL_STM32F7/EmulatedEeprom.cpp
+++ b/Marlin/src/HAL/HAL_STM32F7/EmulatedEeprom.cpp
@@ -30,7 +30,7 @@
// Includes
// --------------------------------------------------------------------------
-#include "../HAL.h"
+#include "HAL.h"
#include "EEPROM_Emul/eeprom_emul.h"
diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL_STM32F7.cpp b/Marlin/src/HAL/HAL_STM32F7/HAL.cpp
similarity index 99%
rename from Marlin/src/HAL/HAL_STM32F7/HAL_STM32F7.cpp
rename to Marlin/src/HAL/HAL_STM32F7/HAL.cpp
index 04d0192dfd..a5c4f39429 100644
--- a/Marlin/src/HAL/HAL_STM32F7/HAL_STM32F7.cpp
+++ b/Marlin/src/HAL/HAL_STM32F7/HAL.cpp
@@ -28,7 +28,7 @@
// Includes
// --------------------------------------------------------------------------
-#include "../HAL.h"
+#include "HAL.h"
//#include
diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL_STM32F7.h b/Marlin/src/HAL/HAL_STM32F7/HAL.h
similarity index 98%
rename from Marlin/src/HAL/HAL_STM32F7/HAL_STM32F7.h
rename to Marlin/src/HAL/HAL_STM32F7/HAL.h
index 814c21096f..9481fe3a63 100644
--- a/Marlin/src/HAL/HAL_STM32F7/HAL_STM32F7.h
+++ b/Marlin/src/HAL/HAL_STM32F7/HAL.h
@@ -26,6 +26,7 @@
#ifndef _HAL_STM32F7_H
#define _HAL_STM32F7_H
+#define CPU_32_BIT
#undef DEBUG_NONE
#ifndef vsnprintf_P
@@ -40,6 +41,9 @@
#include "Arduino.h"
+#include "../math_32bit.h"
+#include "../HAL_SPI.h"
+
#include "fastio_STM32F7.h"
#include "watchdog_STM32F7.h"
diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL_spi_STM32F7.cpp b/Marlin/src/HAL/HAL_STM32F7/HAL_spi_STM32F7.cpp
index 623cfb9fa3..db595eeeb2 100644
--- a/Marlin/src/HAL/HAL_STM32F7/HAL_spi_STM32F7.cpp
+++ b/Marlin/src/HAL/HAL_STM32F7/HAL_spi_STM32F7.cpp
@@ -36,7 +36,7 @@
// Includes
// --------------------------------------------------------------------------
-#include "../HAL.h"
+#include "HAL.h"
#include "../HAL_SPI.h"
#include "pins_arduino.h"
#include "spi_pins.h"
diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp b/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp
index 3678d33de0..d5bde97b13 100644
--- a/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp
+++ b/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp
@@ -26,7 +26,7 @@
// Includes
// --------------------------------------------------------------------------
-#include "../HAL.h"
+#include "HAL.h"
#include "HAL_timers_STM32F7.h"
diff --git a/Marlin/src/HAL/HAL_STM32F7/SanityCheck_STM32F7.h b/Marlin/src/HAL/HAL_STM32F7/SanityCheck.h
similarity index 100%
rename from Marlin/src/HAL/HAL_STM32F7/SanityCheck_STM32F7.h
rename to Marlin/src/HAL/HAL_STM32F7/SanityCheck.h
diff --git a/Marlin/src/HAL/HAL_STM32F7/endstop_interrupts.h b/Marlin/src/HAL/HAL_STM32F7/endstop_interrupts.h
index 9317ae4385..0908140fdb 100644
--- a/Marlin/src/HAL/HAL_STM32F7/endstop_interrupts.h
+++ b/Marlin/src/HAL/HAL_STM32F7/endstop_interrupts.h
@@ -26,6 +26,17 @@
#ifndef _ENDSTOP_INTERRUPTS_H_
#define _ENDSTOP_INTERRUPTS_H_
+volatile uint8_t e_hit = 0; // Different from 0 when the endstops should be tested in detail.
+ // Must be reset to 0 by the test function when finished.
+
+// This is what is really done inside the interrupts.
+FORCE_INLINE void endstop_ISR_worker( void ) {
+ e_hit = 2; // Because the detection of a e-stop hit has a 1 step debouncer it has to be called at least twice.
+}
+
+// One ISR for all EXT-Interrupts
+void endstop_ISR(void) { endstop_ISR_worker(); }
+
void setup_endstop_interrupts(void) {
#if HAS_X_MAX
pinMode(X_MAX_PIN, INPUT);
diff --git a/Marlin/src/HAL/HAL_STM32F7/pinsDebug.h b/Marlin/src/HAL/HAL_STM32F7/pinsDebug.h
new file mode 100644
index 0000000000..e5022f79a4
--- /dev/null
+++ b/Marlin/src/HAL/HAL_STM32F7/pinsDebug.h
@@ -0,0 +1 @@
+#error Debug pins is not supported on this Platform!
diff --git a/Marlin/src/HAL/HAL_SanityCheck.h b/Marlin/src/HAL/HAL_SanityCheck.h
deleted file mode 100644
index 7f5400d426..0000000000
--- a/Marlin/src/HAL/HAL_SanityCheck.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Marlin 3D Printer Firmware
- * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
- *
- * Based on Sprinter and grbl.
- * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- */
-
-#ifndef HAL_SANITYCHECK_H
-
-#ifdef __AVR__
- #include "HAL_AVR/SanityCheck_AVR_8_bit.h"
-
- #elif defined(ARDUINO_ARCH_SAM)
- #include "HAL_DUE/SanityCheck_Due.h"
-
- #elif IS_32BIT_TEENSY
- #include "HAL_TEENSY35_36/SanityCheck_Teensy_35_36.h"
-
- #elif defined(TARGET_LPC1768)
- #include "HAL_LPC1768/SanityCheck.h"
-
- #elif defined(__STM32F1__)
- #include "HAL_STM32F1/SanityCheck_Stm32f1.h"
-
- #elif defined(STM32F7)
- #include "HAL_STM32F7/SanityCheck_STM32F7.h"
-
-#else
- #error Unsupported Platform!
-#endif
-
-#endif
diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_Teensy.cpp b/Marlin/src/HAL/HAL_TEENSY35_36/HAL.cpp
similarity index 99%
rename from Marlin/src/HAL/HAL_TEENSY35_36/HAL_Teensy.cpp
rename to Marlin/src/HAL/HAL_TEENSY35_36/HAL.cpp
index 2a94a19099..bdd6f461fb 100644
--- a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_Teensy.cpp
+++ b/Marlin/src/HAL/HAL_TEENSY35_36/HAL.cpp
@@ -25,7 +25,7 @@
#if defined(__MK64FX512__) || defined(__MK66FX1M0__)
-#include "../HAL.h"
+#include "HAL.h"
#include
diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_Teensy.h b/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h
similarity index 98%
rename from Marlin/src/HAL/HAL_TEENSY35_36/HAL_Teensy.h
rename to Marlin/src/HAL/HAL_TEENSY35_36/HAL.h
index ff98147100..0b2646abae 100644
--- a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_Teensy.h
+++ b/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h
@@ -26,6 +26,8 @@
#ifndef _HAL_TEENSY_H
#define _HAL_TEENSY_H
+#define CPU_32_BIT
+
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
@@ -39,6 +41,9 @@
#undef sq
#define sq(x) ((x)*(x))
+#include "../math_32bit.h"
+#include "../HAL_SPI.h"
+
#include "fastio_Teensy.h"
#include "watchdog_Teensy.h"
diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_spi_Teensy.cpp b/Marlin/src/HAL/HAL_TEENSY35_36/HAL_spi_Teensy.cpp
index 3d52302fb5..3be0fdd3af 100644
--- a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_spi_Teensy.cpp
+++ b/Marlin/src/HAL/HAL_TEENSY35_36/HAL_spi_Teensy.cpp
@@ -1,6 +1,6 @@
#if defined(__MK64FX512__) || defined(__MK66FX1M0__)
-#include "../HAL.h"
+#include "HAL.h"
#include
#include
#include "spi_pins.h"
diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.cpp b/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.cpp
index 03bf9dadd6..19a8dfc674 100644
--- a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.cpp
+++ b/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.cpp
@@ -26,7 +26,7 @@
#if defined(__MK64FX512__) || defined(__MK66FX1M0__)
-#include "../HAL.h"
+#include "HAL.h"
#include "HAL_timers_Teensy.h"
diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/SanityCheck_Teensy_35_36.h b/Marlin/src/HAL/HAL_TEENSY35_36/SanityCheck.h
similarity index 100%
rename from Marlin/src/HAL/HAL_TEENSY35_36/SanityCheck_Teensy_35_36.h
rename to Marlin/src/HAL/HAL_TEENSY35_36/SanityCheck.h
diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/endstop_interrupts.h b/Marlin/src/HAL/HAL_TEENSY35_36/endstop_interrupts.h
index 0652c2997a..12c45db49f 100644
--- a/Marlin/src/HAL/HAL_TEENSY35_36/endstop_interrupts.h
+++ b/Marlin/src/HAL/HAL_TEENSY35_36/endstop_interrupts.h
@@ -34,8 +34,19 @@
* (Located in Marlin/buildroot/share/pin_interrupt_test/pin_interrupt_test.ino)
*/
- #ifndef _ENDSTOP_INTERRUPTS_H_
- #define _ENDSTOP_INTERRUPTS_H_
+#ifndef _ENDSTOP_INTERRUPTS_H_
+#define _ENDSTOP_INTERRUPTS_H_
+
+volatile uint8_t e_hit = 0; // Different from 0 when the endstops should be tested in detail.
+ // Must be reset to 0 by the test function when finished.
+
+// This is what is really done inside the interrupts.
+FORCE_INLINE void endstop_ISR_worker( void ) {
+ e_hit = 2; // Because the detection of a e-stop hit has a 1 step debouncer it has to be called at least twice.
+}
+
+// One ISR for all EXT-Interrupts
+void endstop_ISR(void) { endstop_ISR_worker(); }
/**
* Endstop interrupts for Due based targets.
diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_pinsDebug_Teensy.h b/Marlin/src/HAL/HAL_TEENSY35_36/pinsDebug.h
similarity index 100%
rename from Marlin/src/HAL/HAL_TEENSY35_36/HAL_pinsDebug_Teensy.h
rename to Marlin/src/HAL/HAL_TEENSY35_36/pinsDebug.h
diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/watchdog_Teensy.h b/Marlin/src/HAL/HAL_TEENSY35_36/watchdog_Teensy.h
index a286f4fc98..ca05dd225a 100644
--- a/Marlin/src/HAL/HAL_TEENSY35_36/watchdog_Teensy.h
+++ b/Marlin/src/HAL/HAL_TEENSY35_36/watchdog_Teensy.h
@@ -23,7 +23,7 @@
#ifndef WATCHDOG_TEENSY_H
#define WATCHDOG_TEENSY_H
-#include "../HAL.h"
+#include "HAL.h"
// Arduino Due core now has watchdog support
diff --git a/Marlin/src/HAL/HAL_endstop_interrupts.h b/Marlin/src/HAL/HAL_endstop_interrupts.h
deleted file mode 100644
index 6a13090ca0..0000000000
--- a/Marlin/src/HAL/HAL_endstop_interrupts.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * Marlin 3D Printer Firmware
- * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
- *
- * Based on Sprinter and grbl.
- * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- */
-
-#ifndef HAL_ENDSTOP_INTERRUPTS_H_
-#define HAL_ENDSTOP_INTERRUPTS_H_
-
-volatile uint8_t e_hit = 0; // Different from 0 when the endstops should be tested in detail.
- // Must be reset to 0 by the test function when finished.
-
-// This is what is really done inside the interrupts.
-FORCE_INLINE void endstop_ISR_worker( void ) {
- e_hit = 2; // Because the detection of a e-stop hit has a 1 step debouncer it has to be called at least twice.
-}
-
-// One ISR for all EXT-Interrupts
-void endstop_ISR(void) { endstop_ISR_worker(); }
-
-#ifdef __AVR__
-
- #include "HAL_AVR/endstop_interrupts.h"
-
-#elif defined(ARDUINO_ARCH_SAM)
-
- #include "HAL_DUE/endstop_interrupts.h"
-
-#elif IS_32BIT_TEENSY
-
- #include "HAL_TEENSY35_36/endstop_interrupts.h"
-
-#elif defined(__STM32F1__)
-
- #include "HAL_STM32F1/endstop_interrupts.h"
-
-#elif defined(STM32F7)
-
- #include "HAL_STM32F7/endstop_interrupts.h"
-
-#else
-
- #error Unsupported Platform!
-
-#endif
-
-#endif /* HAL_ENDSTOP_INTERRUPTS_H_ */
diff --git a/Marlin/src/HAL/HAL_pinsDebug.h b/Marlin/src/HAL/HAL_pinsDebug.h
deleted file mode 100644
index 17c2c8eeb3..0000000000
--- a/Marlin/src/HAL/HAL_pinsDebug.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Marlin 3D Printer Firmware
- * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
- *
- * Based on Sprinter and grbl.
- * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- */
-
-#ifndef HAL_PINSDEBUG_H
-#define HAL_PINSDEBUG_H
-
-#ifdef __AVR__
- #include "HAL_AVR/pinsDebug_AVR_8_bit.h"
-#elif defined(ARDUINO_ARCH_SAM)
- #include "HAL_DUE/HAL_pinsDebug_Due.h"
-#elif IS_32BIT_TEENSY
- #include "HAL_TEENSY35_36/HAL_pinsDebug_Teensy.h"
-#elif defined(TARGET_LPC1768)
- #include "HAL_LPC1768/pinsDebug_LPC1768.h"
-#else
- #error Unsupported Platform!
-#endif
-
-#endif // HAL_PINSDEBUG_H
diff --git a/Marlin/src/HAL/HAL_spi_pins.h b/Marlin/src/HAL/HAL_spi_pins.h
deleted file mode 100644
index 495d039872..0000000000
--- a/Marlin/src/HAL/HAL_spi_pins.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Marlin 3D Printer Firmware
- * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
- *
- * Based on Sprinter and grbl.
- * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- */
-
-#ifndef HAL_SPI_PINS_H_
-#define HAL_SPI_PINS_H_
-
-#ifdef ARDUINO_ARCH_SAM
- #include "HAL_DUE/spi_pins.h"
-
-#elif defined(IS_32BIT_TEENSY)
- #include "HAL_TEENSY35_36/spi_pins.h"
-
-#elif defined(__AVR__)
- #include "HAL_AVR/spi_pins.h"
-
-#elif defined(TARGET_LPC1768)
- #include "HAL_LPC1768/spi_pins.h"
-
-#elif defined(__STM32F1__)
- #include "HAL_STM32F1/spi_pins.h"
-
-#elif defined(STM32F7)
- #include "HAL_STM32F7/spi_pins.h"
-
-#else
- #error "Unsupported Platform!"
-#endif
-
-#endif // HAL_SPI_PINS_H_
diff --git a/Marlin/src/HAL/platforms.h b/Marlin/src/HAL/platforms.h
new file mode 100644
index 0000000000..0045e44399
--- /dev/null
+++ b/Marlin/src/HAL/platforms.h
@@ -0,0 +1,28 @@
+#ifndef _HAL_PLATFORMS_H_
+#define _HAL_PLATFORMS_H_
+
+#ifndef HAL_PLATFORM
+
+#ifdef __AVR__
+ #define HAL_PLATFORM HAL_AVR
+#elif defined(ARDUINO_ARCH_SAM)
+ #define HAL_PLATFORM HAL_DUE
+#elif defined(__MK64FX512__) || defined(__MK66FX1M0__)
+ #define HAL_PLATFORM HAL_TEENSY35_36
+#elif defined(TARGET_LPC1768)
+ #define HAL_PLATFORM HAL_LPC1768
+#elif defined(__STM32F1__) || defined(TARGET_STM32F1)
+ #define HAL_PLATFORM HAL_STM32F1
+#elif defined(STM32F7)
+ #define HAL_PLATFORM HAL_STM32F7
+#else
+ #error "Unsupported Platform!"
+#endif
+
+#endif // HAL_PLATFORM
+
+#define XSTR_(M) #M
+#define XSTR(M) XSTR_(M)
+#define HAL_PATH(PATH, NAME) XSTR(PATH/HAL_PLATFORM/NAME)
+
+#endif // _HAL_PLATFORMS_H_
diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp
index 7648a1a7b3..893a8d968b 100644
--- a/Marlin/src/Marlin.cpp
+++ b/Marlin/src/Marlin.cpp
@@ -96,7 +96,7 @@
#endif
#if ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
- #include "HAL/HAL_endstop_interrupts.h"
+ #include HAL_PATH(HAL, endstop_interrupts.h)
#endif
#if HAS_TRINAMIC
diff --git a/Marlin/src/inc/MarlinConfig.h b/Marlin/src/inc/MarlinConfig.h
index 1e4a96e514..26dbfda4d0 100644
--- a/Marlin/src/inc/MarlinConfig.h
+++ b/Marlin/src/inc/MarlinConfig.h
@@ -25,14 +25,16 @@
#include "MarlinConfigPre.h"
-#include "../HAL/HAL.h"
+#include "../HAL/platforms.h"
+#include HAL_PATH(../HAL, HAL.h)
+
#include "../pins/pins.h"
#if defined(__AVR__) && !defined(USBCON)
#define HardwareSerial_h // trick to disable the standard HWserial
#endif
#include "Conditionals_post.h"
#include "SanityCheck.h"
-#include "../HAL/HAL_SanityCheck.h"
+#include HAL_PATH(../HAL, SanityCheck.h)
// Include all core headers
#include "../core/enum.h"
diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h
index 8d4ea5e1c4..6acf915b27 100644
--- a/Marlin/src/pins/pins.h
+++ b/Marlin/src/pins/pins.h
@@ -886,6 +886,6 @@
// Note: default SPI pins are defined in the HAL
-#include "../HAL/HAL_spi_pins.h"
+#include HAL_PATH(../HAL, spi_pins.h)
#endif // __PINS_H__
diff --git a/Marlin/src/pins/pinsDebug.h b/Marlin/src/pins/pinsDebug.h
index 394de46161..2ec747cd44 100644
--- a/Marlin/src/pins/pinsDebug.h
+++ b/Marlin/src/pins/pinsDebug.h
@@ -100,14 +100,13 @@ const PinInfo pin_array[] PROGMEM = {
};
-#include "../HAL/HAL_pinsDebug.h" // get the correct support file for this CPU
+#include HAL_PATH(../HAL, pinsDebug.h) // get the correct support file for this CPU
static void print_input_or_output(const bool isout) {
serialprintPGM(isout ? PSTR("Output = ") : PSTR("Input = "));
}
-
// pretty report with PWM info
inline void report_pin_state_extended(pin_t pin, bool ignore, bool extended = false, const char *start_string = "") {
char buffer[MAX_NAME_LENGTH + 1]; // for the sprintf statements