Init servo pins in HAL_init (#14425)

2.0.x
Scott Lahteine 6 years ago committed by GitHub
parent 8ce84fa44f
commit 6664b90bbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -67,6 +67,22 @@
// Public functions // 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) #if ENABLED(SDSUPPORT)
#include "../../sd/SdFatUtil.h" #include "../../sd/SdFatUtil.h"

@ -109,6 +109,8 @@ typedef int8_t pin_t;
// Public functions // Public functions
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
void HAL_init(void);
//void cli(void); //void cli(void);
//void _delay_ms(const int delay); //void _delay_ms(const int delay);

@ -153,7 +153,6 @@ void noTone(const pin_t _pin);
// Enable hooks into idle and setup for HAL // Enable hooks into idle and setup for HAL
#define HAL_IDLETASK 1 #define HAL_IDLETASK 1
#define HAL_INIT 1
void HAL_idletask(void); void HAL_idletask(void);
void HAL_init(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 // Enable hooks into idle and setup for HAL
#define HAL_IDLETASK 1 #define HAL_IDLETASK 1
#define HAL_INIT 1
#define BOARD_INIT() HAL_init_board(); #define BOARD_INIT() HAL_init_board();
void HAL_idletask(void); void HAL_idletask(void);
void HAL_init(void); void HAL_init(void);

@ -82,6 +82,8 @@ extern HalSerial usb_serial;
#define ENABLE_ISRS() #define ENABLE_ISRS()
#define DISABLE_ISRS() #define DISABLE_ISRS()
inline void HAL_init(void) { }
// Utility functions // Utility functions
int freeMemory(void); int freeMemory(void);

@ -27,9 +27,8 @@
*/ */
#define CPU_32_BIT #define CPU_32_BIT
#define HAL_INIT
void HAL_init(); void HAL_init(void);
#include <stdint.h> #include <stdint.h>
#include <stdarg.h> #include <stdarg.h>

@ -48,9 +48,9 @@ void SysTick_Callback() {
disk_timerproc(); disk_timerproc();
} }
void HAL_init() { void HAL_init(void) {
// Support the 4 LEDs some LPC176x boards have // Init LEDs
#if PIN_EXISTS(LED) #if PIN_EXISTS(LED)
SET_DIR_OUTPUT(LED_PIN); SET_DIR_OUTPUT(LED_PIN);
WRITE_PIN_CLR(LED_PIN); WRITE_PIN_CLR(LED_PIN);
@ -74,6 +74,20 @@ void HAL_init() {
} }
#endif #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(); //debug_frmwrk_init();
//_DBG("\n\nDebug running\n"); //_DBG("\n\nDebug running\n");
// Initialise the SD card chip select pins as soon as possible // 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__ #define __bss_end __bss_end__
// Enable hooks into setup for HAL // Enable hooks into setup for HAL
#define HAL_INIT 1
void HAL_init(void); void HAL_init(void);
/** clear reset reason */ /** clear reset reason */

@ -117,9 +117,8 @@
#define NUM_SERIAL 1 #define NUM_SERIAL 1
#endif #endif
// Use HAL_init() to set interrupt grouping. // Set interrupt grouping for this MCU
#define HAL_INIT void HAL_init(void);
void HAL_init();
/** /**
* TODO: review this to return 1 for pins that are not analog input * 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 // Memory related
#define __bss_end __bss_end__ #define __bss_end __bss_end__
inline void HAL_init(void) { }
/** clear reset reason */ /** clear reset reason */
void HAL_clear_reset_source (void); void HAL_clear_reset_source (void);

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

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

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

@ -822,9 +822,7 @@ void stop() {
*/ */
void setup() { void setup() {
#ifdef HAL_INIT
HAL_init(); HAL_init();
#endif
#if HAS_DRIVER(L6470) #if HAS_DRIVER(L6470)
L6470.init(); // setup SPI and then init chips L6470.init(); // setup SPI and then init chips

Loading…
Cancel
Save