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
 // Public functions
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
 #if ENABLED(SDSUPPORT)
86
 #if ENABLED(SDSUPPORT)
71
 
87
 
72
   #include "../../sd/SdFatUtil.h"
88
   #include "../../sd/SdFatUtil.h"

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

109
 // Public functions
109
 // Public functions
110
 // --------------------------------------------------------------------------
110
 // --------------------------------------------------------------------------
111
 
111
 
112
+void HAL_init(void);
113
+
112
 //void cli(void);
114
 //void cli(void);
113
 
115
 
114
 //void _delay_ms(const int delay);
116
 //void _delay_ms(const int delay);

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

153
 
153
 
154
 // Enable hooks into idle and setup for HAL
154
 // Enable hooks into idle and setup for HAL
155
 #define HAL_IDLETASK 1
155
 #define HAL_IDLETASK 1
156
-#define HAL_INIT 1
157
 void HAL_idletask(void);
156
 void HAL_idletask(void);
158
 void HAL_init(void);
157
 void HAL_init(void);
159
 
158
 

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

123
 
123
 
124
 // Enable hooks into idle and setup for HAL
124
 // Enable hooks into idle and setup for HAL
125
 #define HAL_IDLETASK 1
125
 #define HAL_IDLETASK 1
126
-#define HAL_INIT 1
127
 #define BOARD_INIT() HAL_init_board();
126
 #define BOARD_INIT() HAL_init_board();
128
 void HAL_idletask(void);
127
 void HAL_idletask(void);
129
 void HAL_init(void);
128
 void HAL_init(void);

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

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

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

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

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

48
   disk_timerproc();
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
   #if PIN_EXISTS(LED)
54
   #if PIN_EXISTS(LED)
55
     SET_DIR_OUTPUT(LED_PIN);
55
     SET_DIR_OUTPUT(LED_PIN);
56
     WRITE_PIN_CLR(LED_PIN);
56
     WRITE_PIN_CLR(LED_PIN);
74
     }
74
     }
75
   #endif
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
   //debug_frmwrk_init();
91
   //debug_frmwrk_init();
78
   //_DBG("\n\nDebug running\n");
92
   //_DBG("\n\nDebug running\n");
79
   // Initialise the SD card chip select pins as soon as possible
93
   // Initialise the SD card chip select pins as soon as possible

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

151
 #define __bss_end __bss_end__
151
 #define __bss_end __bss_end__
152
 
152
 
153
 // Enable hooks into  setup for HAL
153
 // Enable hooks into  setup for HAL
154
-#define HAL_INIT 1
155
 void HAL_init(void);
154
 void HAL_init(void);
156
 
155
 
157
 /** clear reset reason */
156
 /** clear reset reason */

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

117
   #define NUM_SERIAL 1
117
   #define NUM_SERIAL 1
118
 #endif
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
  * TODO: review this to return 1 for pins that are not analog input
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
 // Memory related
158
 // Memory related
159
 #define __bss_end __bss_end__
159
 #define __bss_end __bss_end__
160
 
160
 
161
+inline void HAL_init(void) { }
162
+
161
 /** clear reset reason */
163
 /** clear reset reason */
162
 void HAL_clear_reset_source (void);
164
 void HAL_clear_reset_source (void);
163
 
165
 

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

145
 // Memory related
145
 // Memory related
146
 #define __bss_end __bss_end__
146
 #define __bss_end __bss_end__
147
 
147
 
148
+inline void HAL_init(void) { }
149
+
148
 /** clear reset reason */
150
 /** clear reset reason */
149
 void HAL_clear_reset_source (void);
151
 void HAL_clear_reset_source (void);
150
 
152
 

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

89
 #undef pgm_read_word
89
 #undef pgm_read_word
90
 #define pgm_read_word(addr) (*((uint16_t*)(addr)))
90
 #define pgm_read_word(addr) (*((uint16_t*)(addr)))
91
 
91
 
92
+inline void HAL_init(void) { }
93
+
92
 // Clear the reset reason
94
 // Clear the reset reason
93
 void HAL_clear_reset_source(void);
95
 void HAL_clear_reset_source(void);
94
 
96
 

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

97
 #undef pgm_read_word
97
 #undef pgm_read_word
98
 #define pgm_read_word(addr) (*((uint16_t*)(addr)))
98
 #define pgm_read_word(addr) (*((uint16_t*)(addr)))
99
 
99
 
100
+inline void HAL_init(void) { }
101
+
100
 /** clear reset reason */
102
 /** clear reset reason */
101
 void HAL_clear_reset_source(void);
103
 void HAL_clear_reset_source(void);
102
 
104
 

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

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

Loading…
Cancel
Save