Browse Source

Init servo pins in HAL_init (#14425)

Scott Lahteine 5 years ago
parent
commit
6664b90bbb
No account linked to committer's email address

+ 16
- 0
Marlin/src/HAL/HAL_AVR/HAL.cpp View File

@@ -67,6 +67,22 @@
67 67
 // Public functions
68 68
 // --------------------------------------------------------------------------
69 69
 
70
+void HAL_init(void) {
71
+  // Init Servo Pins
72
+  #if PIN_EXISTS(SERVO0)
73
+    OUT_WRITE(SERVO0_PIN, LOW);
74
+  #endif
75
+  #if PIN_EXISTS(SERVO1)
76
+    OUT_WRITE(SERVO1_PIN, LOW);
77
+  #endif
78
+  #if PIN_EXISTS(SERVO2)
79
+    OUT_WRITE(SERVO2_PIN, LOW);
80
+  #endif
81
+  #if PIN_EXISTS(SERVO3)
82
+    OUT_WRITE(SERVO3_PIN, LOW);
83
+  #endif
84
+}
85
+
70 86
 #if ENABLED(SDSUPPORT)
71 87
 
72 88
   #include "../../sd/SdFatUtil.h"

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

@@ -109,6 +109,8 @@ typedef int8_t pin_t;
109 109
 // Public functions
110 110
 // --------------------------------------------------------------------------
111 111
 
112
+void HAL_init(void);
113
+
112 114
 //void cli(void);
113 115
 
114 116
 //void _delay_ms(const int delay);

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

@@ -153,7 +153,6 @@ void noTone(const pin_t _pin);
153 153
 
154 154
 // Enable hooks into idle and setup for HAL
155 155
 #define HAL_IDLETASK 1
156
-#define HAL_INIT 1
157 156
 void HAL_idletask(void);
158 157
 void HAL_init(void);
159 158
 

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

@@ -123,7 +123,6 @@ void HAL_adc_start_conversion(uint8_t adc_pin);
123 123
 
124 124
 // Enable hooks into idle and setup for HAL
125 125
 #define HAL_IDLETASK 1
126
-#define HAL_INIT 1
127 126
 #define BOARD_INIT() HAL_init_board();
128 127
 void HAL_idletask(void);
129 128
 void HAL_init(void);

+ 3
- 1
Marlin/src/HAL/HAL_LINUX/HAL.h View File

@@ -82,7 +82,9 @@ extern HalSerial usb_serial;
82 82
 #define ENABLE_ISRS()
83 83
 #define DISABLE_ISRS()
84 84
 
85
-//Utility functions
85
+inline void HAL_init(void) { }
86
+
87
+// Utility functions
86 88
 int freeMemory(void);
87 89
 
88 90
 // SPI: Extended functions which take a channel number (hardware SPI only)

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

@@ -27,9 +27,8 @@
27 27
  */
28 28
 
29 29
 #define CPU_32_BIT
30
-#define HAL_INIT
31 30
 
32
-void HAL_init();
31
+void HAL_init(void);
33 32
 
34 33
 #include <stdint.h>
35 34
 #include <stdarg.h>

+ 16
- 2
Marlin/src/HAL/HAL_LPC1768/main.cpp View File

@@ -48,9 +48,9 @@ void SysTick_Callback() {
48 48
   disk_timerproc();
49 49
 }
50 50
 
51
-void HAL_init() {
51
+void HAL_init(void) {
52 52
 
53
-  // Support the 4 LEDs some LPC176x boards have
53
+  // Init LEDs
54 54
   #if PIN_EXISTS(LED)
55 55
     SET_DIR_OUTPUT(LED_PIN);
56 56
     WRITE_PIN_CLR(LED_PIN);
@@ -74,6 +74,20 @@ void HAL_init() {
74 74
     }
75 75
   #endif
76 76
 
77
+  // Init Servo Pins
78
+  #if PIN_EXISTS(SERVO0)
79
+    OUT_WRITE(SERVO0_PIN, LOW);
80
+  #endif
81
+  #if PIN_EXISTS(SERVO1)
82
+    OUT_WRITE(SERVO1_PIN, LOW);
83
+  #endif
84
+  #if PIN_EXISTS(SERVO2)
85
+    OUT_WRITE(SERVO2_PIN, LOW);
86
+  #endif
87
+  #if PIN_EXISTS(SERVO3)
88
+    OUT_WRITE(SERVO3_PIN, LOW);
89
+  #endif
90
+
77 91
   //debug_frmwrk_init();
78 92
   //_DBG("\n\nDebug running\n");
79 93
   // Initialise the SD card chip select pins as soon as possible

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

@@ -151,7 +151,6 @@ extern uint16_t HAL_adc_result;
151 151
 #define __bss_end __bss_end__
152 152
 
153 153
 // Enable hooks into  setup for HAL
154
-#define HAL_INIT 1
155 154
 void HAL_init(void);
156 155
 
157 156
 /** clear reset reason */

+ 2
- 3
Marlin/src/HAL/HAL_STM32F1/HAL.h View File

@@ -117,9 +117,8 @@
117 117
   #define NUM_SERIAL 1
118 118
 #endif
119 119
 
120
-// Use HAL_init() to set interrupt grouping.
121
-#define HAL_INIT
122
-void HAL_init();
120
+// Set interrupt grouping for this MCU
121
+void HAL_init(void);
123 122
 
124 123
 /**
125 124
  * TODO: review this to return 1 for pins that are not analog input

+ 2
- 0
Marlin/src/HAL/HAL_STM32F4/HAL.h View File

@@ -158,6 +158,8 @@ extern uint16_t HAL_adc_result;
158 158
 // Memory related
159 159
 #define __bss_end __bss_end__
160 160
 
161
+inline void HAL_init(void) { }
162
+
161 163
 /** clear reset reason */
162 164
 void HAL_clear_reset_source (void);
163 165
 

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

@@ -145,6 +145,8 @@ extern uint16_t HAL_adc_result;
145 145
 // Memory related
146 146
 #define __bss_end __bss_end__
147 147
 
148
+inline void HAL_init(void) { }
149
+
148 150
 /** clear reset reason */
149 151
 void HAL_clear_reset_source (void);
150 152
 

+ 2
- 0
Marlin/src/HAL/HAL_TEENSY31_32/HAL.h View File

@@ -89,6 +89,8 @@ typedef int8_t pin_t;
89 89
 #undef pgm_read_word
90 90
 #define pgm_read_word(addr) (*((uint16_t*)(addr)))
91 91
 
92
+inline void HAL_init(void) { }
93
+
92 94
 // Clear the reset reason
93 95
 void HAL_clear_reset_source(void);
94 96
 

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

@@ -97,6 +97,8 @@ typedef int8_t pin_t;
97 97
 #undef pgm_read_word
98 98
 #define pgm_read_word(addr) (*((uint16_t*)(addr)))
99 99
 
100
+inline void HAL_init(void) { }
101
+
100 102
 /** clear reset reason */
101 103
 void HAL_clear_reset_source(void);
102 104
 

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

@@ -822,9 +822,7 @@ void stop() {
822 822
  */
823 823
 void setup() {
824 824
 
825
-  #ifdef HAL_INIT
826
-    HAL_init();
827
-  #endif
825
+  HAL_init();
828 826
 
829 827
   #if HAS_DRIVER(L6470)
830 828
     L6470.init();         // setup SPI and then init chips

Loading…
Cancel
Save