Browse Source

[LPC176x] Fix USEABLE_HARDWARE_PWM macro, cleanup multiple LED support (#12129)

pull/1/head
Chris Pepper 6 years ago
committed by Scott Lahteine
parent
commit
3c13c9e3e9
  1. 2
      Marlin/src/HAL/HAL_LPC1768/fastio.h
  2. 24
      Marlin/src/HAL/HAL_LPC1768/main.cpp
  3. 2
      Marlin/src/HAL/HAL_LPC1768/watchdog.cpp
  4. 5
      Marlin/src/pins/pins_MKS_SBASE.h

2
Marlin/src/HAL/HAL_LPC1768/fastio.h

@ -37,7 +37,7 @@
#include <Arduino.h> #include <Arduino.h>
#define USEABLE_HARDWARE_PWM(pin) useable_hardware_PWM(pin) #define USEABLE_HARDWARE_PWM(pin) TRUE // all pins are PWM capable
#define LPC_PIN(pin) gpio_pin(pin) #define LPC_PIN(pin) gpio_pin(pin)
#define LPC_GPIO(port) gpio_port(port) #define LPC_GPIO(port) gpio_port(port)

24
Marlin/src/HAL/HAL_LPC1768/main.cpp

@ -28,24 +28,30 @@ void SysTick_Callback() {
} }
void HAL_init() { void HAL_init() {
// Support the 4 LEDs some LPC176x boards have
#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);
#if PIN_EXISTS(LED2)
// MKS_SBASE has 3 other LEDs the bootloader uses during flashing. Clear them. SET_DIR_OUTPUT(LED2_PIN);
SET_DIR_OUTPUT(P1_19); WRITE_PIN_CLR(LED2_PIN);
WRITE_PIN_CLR(P1_19); #if PIN_EXISTS(LED3)
SET_DIR_OUTPUT(P1_20); SET_DIR_OUTPUT(LED3_PIN);
WRITE_PIN_CLR(P1_20); WRITE_PIN_CLR(LED3_PIN);
SET_DIR_OUTPUT(P1_21); #if PIN_EXISTS(LED4)
WRITE_PIN_CLR(P1_21); SET_DIR_OUTPUT(LED4_PIN);
WRITE_PIN_CLR(LED4_PIN);
#endif
#endif
#endif
// Flash status LED 3 times to indicate Marlin has started booting // Flash status LED 3 times to indicate Marlin has started booting
for (uint8_t i = 0; i < 6; ++i) { for (uint8_t i = 0; i < 6; ++i) {
TOGGLE(LED_PIN); TOGGLE(LED_PIN);
delay(100); delay(100);
} }
#endif #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

2
Marlin/src/HAL/HAL_LPC1768/watchdog.cpp

@ -68,7 +68,7 @@ uint8_t HAL_get_reset_source(void) {
void watchdog_reset() { void watchdog_reset() {
WDT_Feed(); WDT_Feed();
#if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED) #if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED)
TOGGLE(LED_PIN); // heart beat indicator TOGGLE(LED_PIN); // heartbeat indicator
#endif #endif
} }

5
Marlin/src/pins/pins_MKS_SBASE.h

@ -42,7 +42,10 @@
#define PIN_P0_03 P0_03 // AUX1 (Interrupt Capable/ADC/Serial Port 0) #define PIN_P0_03 P0_03 // AUX1 (Interrupt Capable/ADC/Serial Port 0)
*/ */
#define LED_PIN P1_18 // LED2 P1_19, LED3 P1_20, LED4 P1_21 #define LED_PIN P1_18 // Used as a status indicator
#define LED2_PIN P1_19
#define LED3_PIN P1_20
#define LED4_PIN P1_21
// //
// Servo pin // Servo pin

Loading…
Cancel
Save