Init servo pins in HAL_init (#14425)

This commit is contained in:
Scott Lahteine 2019-06-27 16:29:17 -05:00 committed by GitHub
parent 8ce84fa44f
commit 6664b90bbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 49 additions and 14 deletions

View File

@ -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"

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

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

View File

@ -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>

View File

@ -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

View File

@ -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 */

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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