Browse Source

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

Chris Pepper 5 years ago
parent
commit
3c13c9e3e9

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

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

+ 15
- 9
Marlin/src/HAL/HAL_LPC1768/main.cpp View File

@@ -28,24 +28,30 @@ void SysTick_Callback() {
28 28
 }
29 29
 
30 30
 void HAL_init() {
31
+
32
+  // Support the 4 LEDs some LPC176x boards have
31 33
   #if PIN_EXISTS(LED)
32 34
     SET_DIR_OUTPUT(LED_PIN);
33 35
     WRITE_PIN_CLR(LED_PIN);
34
-
35
-    // MKS_SBASE has 3 other LEDs the bootloader uses during flashing. Clear them.
36
-    SET_DIR_OUTPUT(P1_19);
37
-    WRITE_PIN_CLR(P1_19);
38
-    SET_DIR_OUTPUT(P1_20);
39
-    WRITE_PIN_CLR(P1_20);
40
-    SET_DIR_OUTPUT(P1_21);
41
-    WRITE_PIN_CLR(P1_21);
42
-
36
+    #if PIN_EXISTS(LED2)
37
+        SET_DIR_OUTPUT(LED2_PIN);
38
+        WRITE_PIN_CLR(LED2_PIN);
39
+      #if PIN_EXISTS(LED3)
40
+          SET_DIR_OUTPUT(LED3_PIN);
41
+          WRITE_PIN_CLR(LED3_PIN);
42
+        #if PIN_EXISTS(LED4)
43
+            SET_DIR_OUTPUT(LED4_PIN);
44
+            WRITE_PIN_CLR(LED4_PIN);
45
+        #endif
46
+      #endif
47
+    #endif
43 48
     // Flash status LED 3 times to indicate Marlin has started booting
44 49
     for (uint8_t i = 0; i < 6; ++i) {
45 50
       TOGGLE(LED_PIN);
46 51
       delay(100);
47 52
     }
48 53
   #endif
54
+
49 55
   //debug_frmwrk_init();
50 56
   //_DBG("\n\nDebug running\n");
51 57
   // Initialise the SD card chip select pins as soon as possible

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/watchdog.cpp View File

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

+ 4
- 1
Marlin/src/pins/pins_MKS_SBASE.h View File

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

Loading…
Cancel
Save