Browse Source

Use a macro for HAL header redirection (#10380)

Chris Pepper 6 years ago
parent
commit
cc6d41e1d3
51 changed files with 152 additions and 285 deletions
  1. 0
    59
      Marlin/src/HAL/HAL.h
  2. 0
    0
      Marlin/src/HAL/HAL_AVR/HAL.cpp
  3. 1
    0
      Marlin/src/HAL/HAL_AVR/HAL.h
  4. 0
    0
      Marlin/src/HAL/HAL_AVR/SanityCheck.h
  5. 11
    0
      Marlin/src/HAL/HAL_AVR/endstop_interrupts.h
  6. 0
    0
      Marlin/src/HAL/HAL_AVR/pinsDebug.h
  7. 1
    1
      Marlin/src/HAL/HAL_DUE/HAL.cpp
  8. 4
    0
      Marlin/src/HAL/HAL_DUE/HAL.h
  9. 1
    1
      Marlin/src/HAL/HAL_DUE/HAL_timers_Due.cpp
  10. 1
    1
      Marlin/src/HAL/HAL_DUE/InterruptVectors_Due.cpp
  11. 0
    0
      Marlin/src/HAL/HAL_DUE/SanityCheck.h
  12. 1
    1
      Marlin/src/HAL/HAL_DUE/Tone.cpp
  13. 13
    2
      Marlin/src/HAL/HAL_DUE/endstop_interrupts.h
  14. 0
    0
      Marlin/src/HAL/HAL_DUE/pinsDebug.h
  15. 1
    1
      Marlin/src/HAL/HAL_DUE/watchdog_Due.h
  16. 4
    0
      Marlin/src/HAL/HAL_LPC1768/HAL.h
  17. 16
    2
      Marlin/src/HAL/HAL_LPC1768/endstop_interrupts.h
  18. 0
    0
      Marlin/src/HAL/HAL_LPC1768/pinsDebug.h
  19. 1
    1
      Marlin/src/HAL/HAL_STM32F1/HAL.cpp
  20. 4
    0
      Marlin/src/HAL/HAL_STM32F1/HAL.h
  21. 1
    1
      Marlin/src/HAL/HAL_STM32F1/HAL_spi_Stm32f1.cpp
  22. 1
    1
      Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.cpp
  23. 0
    0
      Marlin/src/HAL/HAL_STM32F1/SanityCheck.h
  24. 11
    0
      Marlin/src/HAL/HAL_STM32F1/endstop_interrupts.h
  25. 1
    0
      Marlin/src/HAL/HAL_STM32F1/pinsDebug.h
  26. 2
    2
      Marlin/src/HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.h
  27. 1
    1
      Marlin/src/HAL/HAL_STM32F7/EmulatedEeprom.cpp
  28. 1
    1
      Marlin/src/HAL/HAL_STM32F7/HAL.cpp
  29. 4
    0
      Marlin/src/HAL/HAL_STM32F7/HAL.h
  30. 1
    1
      Marlin/src/HAL/HAL_STM32F7/HAL_spi_STM32F7.cpp
  31. 1
    1
      Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp
  32. 0
    0
      Marlin/src/HAL/HAL_STM32F7/SanityCheck.h
  33. 11
    0
      Marlin/src/HAL/HAL_STM32F7/endstop_interrupts.h
  34. 1
    0
      Marlin/src/HAL/HAL_STM32F7/pinsDebug.h
  35. 0
    47
      Marlin/src/HAL/HAL_SanityCheck.h
  36. 1
    1
      Marlin/src/HAL/HAL_TEENSY35_36/HAL.cpp
  37. 5
    0
      Marlin/src/HAL/HAL_TEENSY35_36/HAL.h
  38. 1
    1
      Marlin/src/HAL/HAL_TEENSY35_36/HAL_spi_Teensy.cpp
  39. 1
    1
      Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.cpp
  40. 0
    0
      Marlin/src/HAL/HAL_TEENSY35_36/SanityCheck.h
  41. 13
    2
      Marlin/src/HAL/HAL_TEENSY35_36/endstop_interrupts.h
  42. 0
    0
      Marlin/src/HAL/HAL_TEENSY35_36/pinsDebug.h
  43. 1
    1
      Marlin/src/HAL/HAL_TEENSY35_36/watchdog_Teensy.h
  44. 0
    63
      Marlin/src/HAL/HAL_endstop_interrupts.h
  45. 0
    38
      Marlin/src/HAL/HAL_pinsDebug.h
  46. 0
    48
      Marlin/src/HAL/HAL_spi_pins.h
  47. 28
    0
      Marlin/src/HAL/platforms.h
  48. 1
    1
      Marlin/src/Marlin.cpp
  49. 4
    2
      Marlin/src/inc/MarlinConfig.h
  50. 1
    1
      Marlin/src/pins/pins.h
  51. 1
    2
      Marlin/src/pins/pinsDebug.h

+ 0
- 59
Marlin/src/HAL/HAL.h View File

@@ -1,59 +0,0 @@
1
-/* **************************************************************************
2
-
3
- Marlin 3D Printer Firmware
4
- Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
5
- Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
6
-
7
- This program is free software: you can redistribute it and/or modify
8
- it under the terms of the GNU General Public License as published by
9
- the Free Software Foundation, either version 3 of the License, or
10
- (at your option) any later version.
11
-
12
- This program is distributed in the hope that it will be useful,
13
- but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
- GNU General Public License for more details.
16
-
17
- You should have received a copy of the GNU General Public License
18
- along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
-****************************************************************************/
20
-
21
-/**
22
- * Description: HAL wrapper
23
- *
24
- * Supports platforms :
25
- *    ARDUINO_ARCH_SAM : For Arduino Due and other boards based on Atmel SAM3X8E
26
- *    __AVR__ : For all Atmel AVR boards
27
- */
28
-
29
-#ifndef _HAL_H
30
-#define _HAL_H
31
-
32
-#include "HAL_SPI.h"
33
-
34
-#define CPU_32_BIT
35
-
36
-#ifdef __AVR__
37
-  #undef CPU_32_BIT
38
-  #include "HAL_AVR/HAL_AVR.h"
39
-#elif defined(ARDUINO_ARCH_SAM)
40
-  #include "HAL_DUE/HAL_Due.h"
41
-  #include "math_32bit.h"
42
-#elif defined(__MK64FX512__) || defined(__MK66FX1M0__)
43
-  #include "HAL_TEENSY35_36/HAL_Teensy.h"
44
-  #include "math_32bit.h"
45
-#elif defined(TARGET_LPC1768)
46
-  #include "math_32bit.h"
47
-  #include "HAL_LPC1768/HAL.h"
48
-#elif defined(__STM32F1__) || defined(TARGET_STM32F1)
49
-  #include "math_32bit.h"
50
-  #include "HAL_STM32F1/HAL_Stm32f1.h"
51
-#elif defined(STM32F7)
52
-  #define CPU_32_BIT
53
-  #include "math_32bit.h"
54
-  #include "HAL_STM32F7/HAL_STM32F7.h"
55
-#else
56
-  #error "Unsupported Platform!"
57
-#endif
58
-
59
-#endif // _HAL_H

Marlin/src/HAL/HAL_AVR/HAL_AVR.cpp → Marlin/src/HAL/HAL_AVR/HAL.cpp View File


Marlin/src/HAL/HAL_AVR/HAL_AVR.h → Marlin/src/HAL/HAL_AVR/HAL.h View File

@@ -43,6 +43,7 @@
43 43
 #include <avr/interrupt.h>
44 44
 #include <avr/io.h>
45 45
 
46
+#include "../HAL_SPI.h"
46 47
 #include "fastio_AVR.h"
47 48
 #include "watchdog_AVR.h"
48 49
 #include "math_AVR.h"

Marlin/src/HAL/HAL_AVR/SanityCheck_AVR_8_bit.h → Marlin/src/HAL/HAL_AVR/SanityCheck.h View File


+ 11
- 0
Marlin/src/HAL/HAL_AVR/endstop_interrupts.h View File

@@ -41,6 +41,17 @@
41 41
 #include "../../core/macros.h"
42 42
 #include <stdint.h>
43 43
 
44
+volatile uint8_t e_hit = 0; // Different from 0 when the endstops should be tested in detail.
45
+                            // Must be reset to 0 by the test function when finished.
46
+
47
+// This is what is really done inside the interrupts.
48
+FORCE_INLINE void endstop_ISR_worker( void ) {
49
+  e_hit = 2; // Because the detection of a e-stop hit has a 1 step debouncer it has to be called at least twice.
50
+}
51
+
52
+// One ISR for all EXT-Interrupts
53
+void endstop_ISR(void) { endstop_ISR_worker(); }
54
+
44 55
 /**
45 56
  * Patch for pins_arduino.h (...\Arduino\hardware\arduino\avr\variants\mega\pins_arduino.h)
46 57
  *

Marlin/src/HAL/HAL_AVR/pinsDebug_AVR_8_bit.h → Marlin/src/HAL/HAL_AVR/pinsDebug.h View File


Marlin/src/HAL/HAL_DUE/HAL_Due.cpp → Marlin/src/HAL/HAL_DUE/HAL.cpp View File

@@ -29,7 +29,7 @@
29 29
 // Includes
30 30
 // --------------------------------------------------------------------------
31 31
 
32
-#include "../HAL.h"
32
+#include "HAL.h"
33 33
 
34 34
 #include <Wire.h>
35 35
 #include "usb/usb_task.h"

Marlin/src/HAL/HAL_DUE/HAL_Due.h → Marlin/src/HAL/HAL_DUE/HAL.h View File

@@ -29,10 +29,14 @@
29 29
 #ifndef _HAL_DUE_H
30 30
 #define _HAL_DUE_H
31 31
 
32
+#define CPU_32_BIT
33
+
32 34
 #include <stdint.h>
33 35
 
34 36
 #include <Arduino.h>
35 37
 
38
+#include "../math_32bit.h"
39
+#include "../HAL_SPI.h"
36 40
 #include "fastio_Due.h"
37 41
 #include "watchdog_Due.h"
38 42
 #include "HAL_timers_Due.h"

+ 1
- 1
Marlin/src/HAL/HAL_DUE/HAL_timers_Due.cpp View File

@@ -32,7 +32,7 @@
32 32
 // Includes
33 33
 // --------------------------------------------------------------------------
34 34
 
35
-#include "../HAL.h"
35
+#include "HAL.h"
36 36
 
37 37
 #include "HAL_timers_Due.h"
38 38
 

+ 1
- 1
Marlin/src/HAL/HAL_DUE/InterruptVectors_Due.cpp View File

@@ -32,7 +32,7 @@
32 32
  */
33 33
 #ifdef ARDUINO_ARCH_SAM
34 34
 
35
-#include "HAL_Due.h"
35
+#include "HAL.h"
36 36
 #include "InterruptVectors_Due.h"
37 37
 
38 38
 /* The relocated Exception/Interrupt Table - According to the ARM

Marlin/src/HAL/HAL_DUE/SanityCheck_Due.h → Marlin/src/HAL/HAL_DUE/SanityCheck.h View File


+ 1
- 1
Marlin/src/HAL/HAL_DUE/Tone.cpp View File

@@ -27,7 +27,7 @@
27 27
 
28 28
 #ifdef ARDUINO_ARCH_SAM
29 29
 
30
-#include "HAL_Due.h"
30
+#include "HAL.h"
31 31
 #include "HAL_timers_Due.h"
32 32
 
33 33
 static pin_t tone_pin;

+ 13
- 2
Marlin/src/HAL/HAL_DUE/endstop_interrupts.h View File

@@ -34,8 +34,19 @@
34 34
  * (Located in Marlin/buildroot/share/pin_interrupt_test/pin_interrupt_test.ino)
35 35
  */
36 36
 
37
- #ifndef _ENDSTOP_INTERRUPTS_H_
38
- #define _ENDSTOP_INTERRUPTS_H_
37
+#ifndef _ENDSTOP_INTERRUPTS_H_
38
+#define _ENDSTOP_INTERRUPTS_H_
39
+
40
+volatile uint8_t e_hit = 0; // Different from 0 when the endstops should be tested in detail.
41
+                            // Must be reset to 0 by the test function when finished.
42
+
43
+// This is what is really done inside the interrupts.
44
+FORCE_INLINE void endstop_ISR_worker( void ) {
45
+  e_hit = 2; // Because the detection of a e-stop hit has a 1 step debouncer it has to be called at least twice.
46
+}
47
+
48
+// One ISR for all EXT-Interrupts
49
+void endstop_ISR(void) { endstop_ISR_worker(); }
39 50
 
40 51
 /**
41 52
  *  Endstop interrupts for Due based targets.

Marlin/src/HAL/HAL_DUE/HAL_pinsDebug_Due.h → Marlin/src/HAL/HAL_DUE/pinsDebug.h View File


+ 1
- 1
Marlin/src/HAL/HAL_DUE/watchdog_Due.h View File

@@ -25,7 +25,7 @@
25 25
 
26 26
 // Arduino Due core now has watchdog support
27 27
 
28
-#include "../HAL.h"
28
+#include "HAL.h"
29 29
 
30 30
 // Initialize watchdog with a 4 second interrupt time
31 31
 void watchdog_init();

+ 4
- 0
Marlin/src/HAL/HAL_LPC1768/HAL.h View File

@@ -28,6 +28,8 @@
28 28
 #ifndef _HAL_LPC1768_H_
29 29
 #define _HAL_LPC1768_H_
30 30
 
31
+#define CPU_32_BIT
32
+
31 33
 // --------------------------------------------------------------------------
32 34
 // Includes
33 35
 // --------------------------------------------------------------------------
@@ -58,6 +60,8 @@ extern "C" volatile uint32_t _millis;
58 60
 #include <Arduino.h>
59 61
 #include <pinmapping.h>
60 62
 
63
+#include "../math_32bit.h"
64
+#include "../HAL_SPI.h"
61 65
 #include "fastio.h"
62 66
 #include "watchdog.h"
63 67
 #include "serial.h"

+ 16
- 2
Marlin/src/HAL/HAL_LPC1768/endstop_interrupts.h View File

@@ -34,8 +34,22 @@
34 34
  * (Located in Marlin/buildroot/share/pin_interrupt_test/pin_interrupt_test.ino)
35 35
  */
36 36
 
37
- #ifndef _ENDSTOP_INTERRUPTS_H_
38
- #define _ENDSTOP_INTERRUPTS_H_
37
+#ifndef _ENDSTOP_INTERRUPTS_H_
38
+#define _ENDSTOP_INTERRUPTS_H_
39
+
40
+//Currently this is untested and broken
41
+#error "Please disable Endstop Interrupts LPC176x is currently an unsupported platform"
42
+
43
+volatile uint8_t e_hit = 0; // Different from 0 when the endstops should be tested in detail.
44
+                            // Must be reset to 0 by the test function when finished.
45
+
46
+// This is what is really done inside the interrupts.
47
+FORCE_INLINE void endstop_ISR_worker( void ) {
48
+  e_hit = 2; // Because the detection of a e-stop hit has a 1 step debouncer it has to be called at least twice.
49
+}
50
+
51
+// One ISR for all EXT-Interrupts
52
+void endstop_ISR(void) { endstop_ISR_worker(); }
39 53
 
40 54
 void setup_endstop_interrupts(void) {
41 55
   #if HAS_X_MAX

Marlin/src/HAL/HAL_LPC1768/pinsDebug_LPC1768.h → Marlin/src/HAL/HAL_LPC1768/pinsDebug.h View File


Marlin/src/HAL/HAL_STM32F1/HAL_Stm32f1.cpp → Marlin/src/HAL/HAL_STM32F1/HAL.cpp View File

@@ -31,7 +31,7 @@
31 31
 // Includes
32 32
 // --------------------------------------------------------------------------
33 33
 
34
-#include "../HAL.h"
34
+#include "HAL.h"
35 35
 #include <STM32ADC.h>
36 36
 
37 37
 //#include <Wire.h>

Marlin/src/HAL/HAL_STM32F1/HAL_Stm32f1.h → Marlin/src/HAL/HAL_STM32F1/HAL.h View File

@@ -28,6 +28,7 @@
28 28
 #ifndef _HAL_STM32F1_H
29 29
 #define _HAL_STM32F1_H
30 30
 
31
+#define CPU_32_BIT
31 32
 #undef DEBUG_NONE
32 33
 
33 34
 #ifndef vsnprintf_P
@@ -55,6 +56,9 @@
55 56
 // Includes
56 57
 // --------------------------------------------------------------------------
57 58
 
59
+#include "../math_32bit.h"
60
+#include "../HAL_SPI.h"
61
+
58 62
 #include "fastio_Stm32f1.h"
59 63
 #include "watchdog_Stm32f1.h"
60 64
 

+ 1
- 1
Marlin/src/HAL/HAL_STM32F1/HAL_spi_Stm32f1.cpp View File

@@ -36,7 +36,7 @@
36 36
 // Includes
37 37
 // --------------------------------------------------------------------------
38 38
 
39
-#include "../HAL.h"
39
+#include "HAL.h"
40 40
 #include "../HAL_SPI.h"
41 41
 #include "pins_arduino.h"
42 42
 #include "spi_pins.h"

+ 1
- 1
Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.cpp View File

@@ -30,7 +30,7 @@
30 30
 // Includes
31 31
 // --------------------------------------------------------------------------
32 32
 
33
-#include "../HAL.h"
33
+#include "HAL.h"
34 34
 
35 35
 #include "HAL_timers_Stm32f1.h"
36 36
 

Marlin/src/HAL/HAL_STM32F1/SanityCheck_Stm32f1.h → Marlin/src/HAL/HAL_STM32F1/SanityCheck.h View File


+ 11
- 0
Marlin/src/HAL/HAL_STM32F1/endstop_interrupts.h View File

@@ -49,6 +49,17 @@
49 49
 #ifndef _ENDSTOP_INTERRUPTS_H_
50 50
 #define _ENDSTOP_INTERRUPTS_H_
51 51
 
52
+volatile uint8_t e_hit = 0; // Different from 0 when the endstops should be tested in detail.
53
+                            // Must be reset to 0 by the test function when finished.
54
+
55
+// This is what is really done inside the interrupts.
56
+FORCE_INLINE void endstop_ISR_worker( void ) {
57
+  e_hit = 2; // Because the detection of a e-stop hit has a 1 step debouncer it has to be called at least twice.
58
+}
59
+
60
+// One ISR for all EXT-Interrupts
61
+void endstop_ISR(void) { endstop_ISR_worker(); }
62
+
52 63
 void setup_endstop_interrupts(void) {
53 64
   #if HAS_X_MAX
54 65
     SET_INPUT(X_MAX_PIN);

+ 1
- 0
Marlin/src/HAL/HAL_STM32F1/pinsDebug.h View File

@@ -0,0 +1 @@
1
+#error Debug pins is not supported on this Platform!

+ 2
- 2
Marlin/src/HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.h View File

@@ -9,7 +9,7 @@
9 9
   ******************************************************************************
10 10
   * @attention
11 11
   *
12
-  * <h2><center>&copy; Copyright © 2016 STMicroelectronics International N.V.
12
+  * <h2><center>&copy; Copyright © 2016 STMicroelectronics International N.V.
13 13
   * All rights reserved.</center></h2>
14 14
   *
15 15
   * Redistribution and use in source and binary forms, with or without
@@ -54,7 +54,7 @@
54 54
 // Includes
55 55
 // --------------------------------------------------------------------------
56 56
 #include "../../../inc/MarlinConfig.h"
57
-#include "../../HAL.h"
57
+#include "../HAL.h"
58 58
 
59 59
 /* Exported constants --------------------------------------------------------*/
60 60
 /* EEPROM emulation firmware error codes */

+ 1
- 1
Marlin/src/HAL/HAL_STM32F7/EmulatedEeprom.cpp View File

@@ -30,7 +30,7 @@
30 30
 // Includes
31 31
 // --------------------------------------------------------------------------
32 32
 
33
-#include "../HAL.h"
33
+#include "HAL.h"
34 34
 #include "EEPROM_Emul/eeprom_emul.h"
35 35
 
36 36
 

Marlin/src/HAL/HAL_STM32F7/HAL_STM32F7.cpp → Marlin/src/HAL/HAL_STM32F7/HAL.cpp View File

@@ -28,7 +28,7 @@
28 28
 // Includes
29 29
 // --------------------------------------------------------------------------
30 30
 
31
-#include "../HAL.h"
31
+#include "HAL.h"
32 32
 
33 33
 //#include <Wire.h>
34 34
 

Marlin/src/HAL/HAL_STM32F7/HAL_STM32F7.h → Marlin/src/HAL/HAL_STM32F7/HAL.h View File

@@ -26,6 +26,7 @@
26 26
 #ifndef _HAL_STM32F7_H
27 27
 #define _HAL_STM32F7_H
28 28
 
29
+#define CPU_32_BIT
29 30
 #undef DEBUG_NONE
30 31
 
31 32
 #ifndef vsnprintf_P
@@ -40,6 +41,9 @@
40 41
 
41 42
 #include "Arduino.h"
42 43
 
44
+#include "../math_32bit.h"
45
+#include "../HAL_SPI.h"
46
+
43 47
 #include "fastio_STM32F7.h"
44 48
 #include "watchdog_STM32F7.h"
45 49
 

+ 1
- 1
Marlin/src/HAL/HAL_STM32F7/HAL_spi_STM32F7.cpp View File

@@ -36,7 +36,7 @@
36 36
 // Includes
37 37
 // --------------------------------------------------------------------------
38 38
 
39
-#include "../HAL.h"
39
+#include "HAL.h"
40 40
 #include "../HAL_SPI.h"
41 41
 #include "pins_arduino.h"
42 42
 #include "spi_pins.h"

+ 1
- 1
Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp View File

@@ -26,7 +26,7 @@
26 26
 // Includes
27 27
 // --------------------------------------------------------------------------
28 28
 
29
-#include "../HAL.h"
29
+#include "HAL.h"
30 30
 
31 31
 #include "HAL_timers_STM32F7.h"
32 32
 

Marlin/src/HAL/HAL_STM32F7/SanityCheck_STM32F7.h → Marlin/src/HAL/HAL_STM32F7/SanityCheck.h View File


+ 11
- 0
Marlin/src/HAL/HAL_STM32F7/endstop_interrupts.h View File

@@ -26,6 +26,17 @@
26 26
 #ifndef _ENDSTOP_INTERRUPTS_H_
27 27
 #define _ENDSTOP_INTERRUPTS_H_
28 28
 
29
+volatile uint8_t e_hit = 0; // Different from 0 when the endstops should be tested in detail.
30
+                            // Must be reset to 0 by the test function when finished.
31
+
32
+// This is what is really done inside the interrupts.
33
+FORCE_INLINE void endstop_ISR_worker( void ) {
34
+  e_hit = 2; // Because the detection of a e-stop hit has a 1 step debouncer it has to be called at least twice.
35
+}
36
+
37
+// One ISR for all EXT-Interrupts
38
+void endstop_ISR(void) { endstop_ISR_worker(); }
39
+
29 40
 void setup_endstop_interrupts(void) {
30 41
   #if HAS_X_MAX
31 42
     pinMode(X_MAX_PIN, INPUT);

+ 1
- 0
Marlin/src/HAL/HAL_STM32F7/pinsDebug.h View File

@@ -0,0 +1 @@
1
+#error Debug pins is not supported on this Platform!

+ 0
- 47
Marlin/src/HAL/HAL_SanityCheck.h View File

@@ -1,47 +0,0 @@
1
-/**
2
- * Marlin 3D Printer Firmware
3
- * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
- *
5
- * Based on Sprinter and grbl.
6
- * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
- *
8
- * This program is free software: you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation, either version 3 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
- *
21
- */
22
-
23
-#ifndef HAL_SANITYCHECK_H
24
-
25
-#ifdef __AVR__
26
-  #include "HAL_AVR/SanityCheck_AVR_8_bit.h"
27
-
28
-  #elif defined(ARDUINO_ARCH_SAM)
29
-  #include "HAL_DUE/SanityCheck_Due.h"
30
-
31
-  #elif IS_32BIT_TEENSY
32
-  #include "HAL_TEENSY35_36/SanityCheck_Teensy_35_36.h"
33
-
34
-  #elif defined(TARGET_LPC1768)
35
-  #include "HAL_LPC1768/SanityCheck.h"
36
-
37
-  #elif defined(__STM32F1__)
38
-    #include "HAL_STM32F1/SanityCheck_Stm32f1.h"
39
-
40
-  #elif defined(STM32F7)
41
-    #include "HAL_STM32F7/SanityCheck_STM32F7.h"
42
-
43
-#else
44
-  #error Unsupported Platform!
45
-#endif
46
-
47
-#endif

Marlin/src/HAL/HAL_TEENSY35_36/HAL_Teensy.cpp → Marlin/src/HAL/HAL_TEENSY35_36/HAL.cpp View File

@@ -25,7 +25,7 @@
25 25
 
26 26
 #if defined(__MK64FX512__) || defined(__MK66FX1M0__)
27 27
 
28
-#include "../HAL.h"
28
+#include "HAL.h"
29 29
 
30 30
 #include <Wire.h>
31 31
 

Marlin/src/HAL/HAL_TEENSY35_36/HAL_Teensy.h → Marlin/src/HAL/HAL_TEENSY35_36/HAL.h View File

@@ -26,6 +26,8 @@
26 26
 #ifndef _HAL_TEENSY_H
27 27
 #define _HAL_TEENSY_H
28 28
 
29
+#define CPU_32_BIT
30
+
29 31
 // --------------------------------------------------------------------------
30 32
 // Includes
31 33
 // --------------------------------------------------------------------------
@@ -39,6 +41,9 @@
39 41
 #undef sq
40 42
 #define sq(x) ((x)*(x))
41 43
 
44
+#include "../math_32bit.h"
45
+#include "../HAL_SPI.h"
46
+
42 47
 #include "fastio_Teensy.h"
43 48
 #include "watchdog_Teensy.h"
44 49
 

+ 1
- 1
Marlin/src/HAL/HAL_TEENSY35_36/HAL_spi_Teensy.cpp View File

@@ -1,6 +1,6 @@
1 1
 #if defined(__MK64FX512__) || defined(__MK66FX1M0__)
2 2
 
3
-#include "../HAL.h"
3
+#include "HAL.h"
4 4
 #include <SPI.h>
5 5
 #include <pins_arduino.h>
6 6
 #include "spi_pins.h"

+ 1
- 1
Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.cpp View File

@@ -26,7 +26,7 @@
26 26
 
27 27
 #if defined(__MK64FX512__) || defined(__MK66FX1M0__)
28 28
 
29
-#include "../HAL.h"
29
+#include "HAL.h"
30 30
 #include "HAL_timers_Teensy.h"
31 31
 
32 32
 

Marlin/src/HAL/HAL_TEENSY35_36/SanityCheck_Teensy_35_36.h → Marlin/src/HAL/HAL_TEENSY35_36/SanityCheck.h View File


+ 13
- 2
Marlin/src/HAL/HAL_TEENSY35_36/endstop_interrupts.h View File

@@ -34,8 +34,19 @@
34 34
  * (Located in Marlin/buildroot/share/pin_interrupt_test/pin_interrupt_test.ino)
35 35
  */
36 36
 
37
- #ifndef _ENDSTOP_INTERRUPTS_H_
38
- #define _ENDSTOP_INTERRUPTS_H_
37
+#ifndef _ENDSTOP_INTERRUPTS_H_
38
+#define _ENDSTOP_INTERRUPTS_H_
39
+
40
+volatile uint8_t e_hit = 0; // Different from 0 when the endstops should be tested in detail.
41
+                            // Must be reset to 0 by the test function when finished.
42
+
43
+// This is what is really done inside the interrupts.
44
+FORCE_INLINE void endstop_ISR_worker( void ) {
45
+  e_hit = 2; // Because the detection of a e-stop hit has a 1 step debouncer it has to be called at least twice.
46
+}
47
+
48
+// One ISR for all EXT-Interrupts
49
+void endstop_ISR(void) { endstop_ISR_worker(); }
39 50
 
40 51
 /**
41 52
  *  Endstop interrupts for Due based targets.

Marlin/src/HAL/HAL_TEENSY35_36/HAL_pinsDebug_Teensy.h → Marlin/src/HAL/HAL_TEENSY35_36/pinsDebug.h View File


+ 1
- 1
Marlin/src/HAL/HAL_TEENSY35_36/watchdog_Teensy.h View File

@@ -23,7 +23,7 @@
23 23
 #ifndef WATCHDOG_TEENSY_H
24 24
 #define WATCHDOG_TEENSY_H
25 25
 
26
-#include "../HAL.h"
26
+#include "HAL.h"
27 27
 
28 28
 // Arduino Due core now has watchdog support
29 29
 

+ 0
- 63
Marlin/src/HAL/HAL_endstop_interrupts.h View File

@@ -1,63 +0,0 @@
1
-/**
2
- * Marlin 3D Printer Firmware
3
- * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
- *
5
- * Based on Sprinter and grbl.
6
- * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
- *
8
- * This program is free software: you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation, either version 3 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
- *
21
- */
22
-
23
-#ifndef HAL_ENDSTOP_INTERRUPTS_H_
24
-#define HAL_ENDSTOP_INTERRUPTS_H_
25
-
26
-volatile uint8_t e_hit = 0; // Different from 0 when the endstops should be tested in detail.
27
-                            // Must be reset to 0 by the test function when finished.
28
-
29
-// This is what is really done inside the interrupts.
30
-FORCE_INLINE void endstop_ISR_worker( void ) {
31
-  e_hit = 2; // Because the detection of a e-stop hit has a 1 step debouncer it has to be called at least twice.
32
-}
33
-
34
-// One ISR for all EXT-Interrupts
35
-void endstop_ISR(void) { endstop_ISR_worker(); }
36
-
37
-#ifdef __AVR__
38
-
39
-  #include "HAL_AVR/endstop_interrupts.h"
40
-
41
-#elif defined(ARDUINO_ARCH_SAM)
42
-
43
-  #include "HAL_DUE/endstop_interrupts.h"
44
-
45
-#elif IS_32BIT_TEENSY
46
-
47
-  #include "HAL_TEENSY35_36/endstop_interrupts.h"
48
-
49
-#elif defined(__STM32F1__)
50
-
51
-  #include "HAL_STM32F1/endstop_interrupts.h"
52
-
53
-#elif defined(STM32F7)
54
-
55
-  #include "HAL_STM32F7/endstop_interrupts.h"
56
-
57
-#else
58
-
59
-  #error Unsupported Platform!
60
-
61
-#endif
62
-
63
-#endif /* HAL_ENDSTOP_INTERRUPTS_H_ */

+ 0
- 38
Marlin/src/HAL/HAL_pinsDebug.h View File

@@ -1,38 +0,0 @@
1
-/**
2
- * Marlin 3D Printer Firmware
3
- * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
- *
5
- * Based on Sprinter and grbl.
6
- * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
- *
8
- * This program is free software: you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation, either version 3 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
- *
21
- */
22
-
23
-#ifndef HAL_PINSDEBUG_H
24
-#define HAL_PINSDEBUG_H
25
-
26
-#ifdef __AVR__
27
-  #include "HAL_AVR/pinsDebug_AVR_8_bit.h"
28
-#elif defined(ARDUINO_ARCH_SAM)
29
-  #include "HAL_DUE/HAL_pinsDebug_Due.h"
30
-#elif IS_32BIT_TEENSY
31
-  #include "HAL_TEENSY35_36/HAL_pinsDebug_Teensy.h"
32
-#elif defined(TARGET_LPC1768)
33
-  #include "HAL_LPC1768/pinsDebug_LPC1768.h"
34
-#else
35
-  #error Unsupported Platform!
36
-#endif
37
-
38
-#endif // HAL_PINSDEBUG_H

+ 0
- 48
Marlin/src/HAL/HAL_spi_pins.h View File

@@ -1,48 +0,0 @@
1
-/**
2
- * Marlin 3D Printer Firmware
3
- * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
- *
5
- * Based on Sprinter and grbl.
6
- * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
- *
8
- * This program is free software: you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation, either version 3 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
- *
21
- */
22
-
23
-#ifndef HAL_SPI_PINS_H_
24
-#define HAL_SPI_PINS_H_
25
-
26
-#ifdef ARDUINO_ARCH_SAM
27
-  #include "HAL_DUE/spi_pins.h"
28
-
29
-#elif defined(IS_32BIT_TEENSY)
30
-  #include "HAL_TEENSY35_36/spi_pins.h"
31
-
32
-#elif defined(__AVR__)
33
-  #include "HAL_AVR/spi_pins.h"
34
-
35
-#elif defined(TARGET_LPC1768)
36
-  #include "HAL_LPC1768/spi_pins.h"
37
-
38
-#elif defined(__STM32F1__)
39
-  #include "HAL_STM32F1/spi_pins.h"
40
-
41
-#elif defined(STM32F7)
42
-  #include "HAL_STM32F7/spi_pins.h"
43
-
44
-#else
45
-  #error "Unsupported Platform!"
46
-#endif
47
-
48
-#endif // HAL_SPI_PINS_H_

+ 28
- 0
Marlin/src/HAL/platforms.h View File

@@ -0,0 +1,28 @@
1
+#ifndef _HAL_PLATFORMS_H_
2
+#define _HAL_PLATFORMS_H_
3
+
4
+#ifndef HAL_PLATFORM
5
+
6
+#ifdef __AVR__
7
+  #define HAL_PLATFORM HAL_AVR
8
+#elif defined(ARDUINO_ARCH_SAM)
9
+  #define HAL_PLATFORM HAL_DUE
10
+#elif defined(__MK64FX512__) || defined(__MK66FX1M0__)
11
+  #define HAL_PLATFORM HAL_TEENSY35_36
12
+#elif defined(TARGET_LPC1768)
13
+  #define HAL_PLATFORM HAL_LPC1768
14
+#elif defined(__STM32F1__) || defined(TARGET_STM32F1)
15
+  #define HAL_PLATFORM HAL_STM32F1
16
+#elif defined(STM32F7)
17
+  #define HAL_PLATFORM HAL_STM32F7
18
+#else
19
+  #error "Unsupported Platform!"
20
+#endif
21
+
22
+#endif // HAL_PLATFORM
23
+
24
+#define XSTR_(M) #M
25
+#define XSTR(M) XSTR_(M)
26
+#define HAL_PATH(PATH, NAME) XSTR(PATH/HAL_PLATFORM/NAME)
27
+
28
+#endif // _HAL_PLATFORMS_H_

+ 1
- 1
Marlin/src/Marlin.cpp View File

@@ -96,7 +96,7 @@
96 96
 #endif
97 97
 
98 98
 #if ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
99
-  #include "HAL/HAL_endstop_interrupts.h"
99
+  #include HAL_PATH(HAL, endstop_interrupts.h)
100 100
 #endif
101 101
 
102 102
 #if HAS_TRINAMIC

+ 4
- 2
Marlin/src/inc/MarlinConfig.h View File

@@ -25,14 +25,16 @@
25 25
 
26 26
 #include "MarlinConfigPre.h"
27 27
 
28
-#include "../HAL/HAL.h"
28
+#include "../HAL/platforms.h"
29
+#include HAL_PATH(../HAL, HAL.h)
30
+
29 31
 #include "../pins/pins.h"
30 32
 #if defined(__AVR__) && !defined(USBCON)
31 33
   #define HardwareSerial_h // trick to disable the standard HWserial
32 34
 #endif
33 35
 #include "Conditionals_post.h"
34 36
 #include "SanityCheck.h"
35
-#include "../HAL/HAL_SanityCheck.h"
37
+#include HAL_PATH(../HAL, SanityCheck.h)
36 38
 
37 39
 // Include all core headers
38 40
 #include "../core/enum.h"

+ 1
- 1
Marlin/src/pins/pins.h View File

@@ -886,6 +886,6 @@
886 886
 
887 887
 // Note: default SPI pins are defined in the HAL
888 888
 
889
-#include "../HAL/HAL_spi_pins.h"
889
+#include HAL_PATH(../HAL, spi_pins.h)
890 890
 
891 891
 #endif // __PINS_H__

+ 1
- 2
Marlin/src/pins/pinsDebug.h View File

@@ -100,14 +100,13 @@ const PinInfo pin_array[] PROGMEM = {
100 100
 };
101 101
 
102 102
 
103
-#include "../HAL/HAL_pinsDebug.h"  // get the correct support file for this CPU
103
+#include HAL_PATH(../HAL, pinsDebug.h)  // get the correct support file for this CPU
104 104
 
105 105
 
106 106
 static void print_input_or_output(const bool isout) {
107 107
   serialprintPGM(isout ? PSTR("Output = ") : PSTR("Input  = "));
108 108
 }
109 109
 
110
-
111 110
 // pretty report with PWM info
112 111
 inline void report_pin_state_extended(pin_t pin, bool ignore, bool extended = false, const char *start_string = "") {
113 112
   char buffer[MAX_NAME_LENGTH + 1];   // for the sprintf statements

Loading…
Cancel
Save