Init servo pins in HAL_init (#14425)
This commit is contained in:
		| @@ -67,6 +67,22 @@ | ||||
| // Public functions | ||||
| // -------------------------------------------------------------------------- | ||||
|  | ||||
| void HAL_init(void) { | ||||
|   // Init Servo Pins | ||||
|   #if PIN_EXISTS(SERVO0) | ||||
|     OUT_WRITE(SERVO0_PIN, LOW); | ||||
|   #endif | ||||
|   #if PIN_EXISTS(SERVO1) | ||||
|     OUT_WRITE(SERVO1_PIN, LOW); | ||||
|   #endif | ||||
|   #if PIN_EXISTS(SERVO2) | ||||
|     OUT_WRITE(SERVO2_PIN, LOW); | ||||
|   #endif | ||||
|   #if PIN_EXISTS(SERVO3) | ||||
|     OUT_WRITE(SERVO3_PIN, LOW); | ||||
|   #endif | ||||
| } | ||||
|  | ||||
| #if ENABLED(SDSUPPORT) | ||||
|  | ||||
|   #include "../../sd/SdFatUtil.h" | ||||
|   | ||||
| @@ -109,6 +109,8 @@ typedef int8_t pin_t; | ||||
| // Public functions | ||||
| // -------------------------------------------------------------------------- | ||||
|  | ||||
| void HAL_init(void); | ||||
|  | ||||
| //void cli(void); | ||||
|  | ||||
| //void _delay_ms(const int delay); | ||||
|   | ||||
| @@ -153,7 +153,6 @@ void noTone(const pin_t _pin); | ||||
|  | ||||
| // Enable hooks into idle and setup for HAL | ||||
| #define HAL_IDLETASK 1 | ||||
| #define HAL_INIT 1 | ||||
| void HAL_idletask(void); | ||||
| void HAL_init(void); | ||||
|  | ||||
|   | ||||
| @@ -123,7 +123,6 @@ void HAL_adc_start_conversion(uint8_t adc_pin); | ||||
|  | ||||
| // Enable hooks into idle and setup for HAL | ||||
| #define HAL_IDLETASK 1 | ||||
| #define HAL_INIT 1 | ||||
| #define BOARD_INIT() HAL_init_board(); | ||||
| void HAL_idletask(void); | ||||
| void HAL_init(void); | ||||
|   | ||||
| @@ -82,7 +82,9 @@ extern HalSerial usb_serial; | ||||
| #define ENABLE_ISRS() | ||||
| #define DISABLE_ISRS() | ||||
|  | ||||
| //Utility functions | ||||
| inline void HAL_init(void) { } | ||||
|  | ||||
| // Utility functions | ||||
| int freeMemory(void); | ||||
|  | ||||
| // SPI: Extended functions which take a channel number (hardware SPI only) | ||||
|   | ||||
| @@ -27,9 +27,8 @@ | ||||
|  */ | ||||
|  | ||||
| #define CPU_32_BIT | ||||
| #define HAL_INIT | ||||
|  | ||||
| void HAL_init(); | ||||
| void HAL_init(void); | ||||
|  | ||||
| #include <stdint.h> | ||||
| #include <stdarg.h> | ||||
|   | ||||
| @@ -48,9 +48,9 @@ void SysTick_Callback() { | ||||
|   disk_timerproc(); | ||||
| } | ||||
|  | ||||
| void HAL_init() { | ||||
| void HAL_init(void) { | ||||
|  | ||||
|   // Support the 4 LEDs some LPC176x boards have | ||||
|   // Init LEDs | ||||
|   #if PIN_EXISTS(LED) | ||||
|     SET_DIR_OUTPUT(LED_PIN); | ||||
|     WRITE_PIN_CLR(LED_PIN); | ||||
| @@ -74,6 +74,20 @@ void HAL_init() { | ||||
|     } | ||||
|   #endif | ||||
|  | ||||
|   // Init Servo Pins | ||||
|   #if PIN_EXISTS(SERVO0) | ||||
|     OUT_WRITE(SERVO0_PIN, LOW); | ||||
|   #endif | ||||
|   #if PIN_EXISTS(SERVO1) | ||||
|     OUT_WRITE(SERVO1_PIN, LOW); | ||||
|   #endif | ||||
|   #if PIN_EXISTS(SERVO2) | ||||
|     OUT_WRITE(SERVO2_PIN, LOW); | ||||
|   #endif | ||||
|   #if PIN_EXISTS(SERVO3) | ||||
|     OUT_WRITE(SERVO3_PIN, LOW); | ||||
|   #endif | ||||
|  | ||||
|   //debug_frmwrk_init(); | ||||
|   //_DBG("\n\nDebug running\n"); | ||||
|   // Initialise the SD card chip select pins as soon as possible | ||||
|   | ||||
| @@ -151,7 +151,6 @@ extern uint16_t HAL_adc_result; | ||||
| #define __bss_end __bss_end__ | ||||
|  | ||||
| // Enable hooks into  setup for HAL | ||||
| #define HAL_INIT 1 | ||||
| void HAL_init(void); | ||||
|  | ||||
| /** clear reset reason */ | ||||
|   | ||||
| @@ -117,9 +117,8 @@ | ||||
|   #define NUM_SERIAL 1 | ||||
| #endif | ||||
|  | ||||
| // Use HAL_init() to set interrupt grouping. | ||||
| #define HAL_INIT | ||||
| void HAL_init(); | ||||
| // Set interrupt grouping for this MCU | ||||
| void HAL_init(void); | ||||
|  | ||||
| /** | ||||
|  * TODO: review this to return 1 for pins that are not analog input | ||||
|   | ||||
| @@ -158,6 +158,8 @@ extern uint16_t HAL_adc_result; | ||||
| // Memory related | ||||
| #define __bss_end __bss_end__ | ||||
|  | ||||
| inline void HAL_init(void) { } | ||||
|  | ||||
| /** clear reset reason */ | ||||
| void HAL_clear_reset_source (void); | ||||
|  | ||||
|   | ||||
| @@ -145,6 +145,8 @@ extern uint16_t HAL_adc_result; | ||||
| // Memory related | ||||
| #define __bss_end __bss_end__ | ||||
|  | ||||
| inline void HAL_init(void) { } | ||||
|  | ||||
| /** clear reset reason */ | ||||
| void HAL_clear_reset_source (void); | ||||
|  | ||||
|   | ||||
| @@ -89,6 +89,8 @@ typedef int8_t pin_t; | ||||
| #undef pgm_read_word | ||||
| #define pgm_read_word(addr) (*((uint16_t*)(addr))) | ||||
|  | ||||
| inline void HAL_init(void) { } | ||||
|  | ||||
| // Clear the reset reason | ||||
| void HAL_clear_reset_source(void); | ||||
|  | ||||
|   | ||||
| @@ -97,6 +97,8 @@ typedef int8_t pin_t; | ||||
| #undef pgm_read_word | ||||
| #define pgm_read_word(addr) (*((uint16_t*)(addr))) | ||||
|  | ||||
| inline void HAL_init(void) { } | ||||
|  | ||||
| /** clear reset reason */ | ||||
| void HAL_clear_reset_source(void); | ||||
|  | ||||
|   | ||||
| @@ -822,9 +822,7 @@ void stop() { | ||||
|  */ | ||||
| void setup() { | ||||
|  | ||||
|   #ifdef HAL_INIT | ||||
|     HAL_init(); | ||||
|   #endif | ||||
|   HAL_init(); | ||||
|  | ||||
|   #if HAS_DRIVER(L6470) | ||||
|     L6470.init();         // setup SPI and then init chips | ||||
|   | ||||
		Reference in New Issue
	
	Block a user