Bläddra i källkod

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

Chris Pepper 6 år sedan
förälder
incheckning
3c13c9e3e9

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/fastio.h Visa fil

37
 
37
 
38
 #include <Arduino.h>
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
 #define LPC_PIN(pin)            gpio_pin(pin)
42
 #define LPC_PIN(pin)            gpio_pin(pin)
43
 #define LPC_GPIO(port)          gpio_port(port)
43
 #define LPC_GPIO(port)          gpio_port(port)

+ 15
- 9
Marlin/src/HAL/HAL_LPC1768/main.cpp Visa fil

28
 }
28
 }
29
 
29
 
30
 void HAL_init() {
30
 void HAL_init() {
31
+
32
+  // Support the 4 LEDs some LPC176x boards have
31
   #if PIN_EXISTS(LED)
33
   #if PIN_EXISTS(LED)
32
     SET_DIR_OUTPUT(LED_PIN);
34
     SET_DIR_OUTPUT(LED_PIN);
33
     WRITE_PIN_CLR(LED_PIN);
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
     // Flash status LED 3 times to indicate Marlin has started booting
48
     // Flash status LED 3 times to indicate Marlin has started booting
44
     for (uint8_t i = 0; i < 6; ++i) {
49
     for (uint8_t i = 0; i < 6; ++i) {
45
       TOGGLE(LED_PIN);
50
       TOGGLE(LED_PIN);
46
       delay(100);
51
       delay(100);
47
     }
52
     }
48
   #endif
53
   #endif
54
+
49
   //debug_frmwrk_init();
55
   //debug_frmwrk_init();
50
   //_DBG("\n\nDebug running\n");
56
   //_DBG("\n\nDebug running\n");
51
   // Initialise the SD card chip select pins as soon as possible
57
   // Initialise the SD card chip select pins as soon as possible

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/watchdog.cpp Visa fil

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

+ 4
- 1
Marlin/src/pins/pins_MKS_SBASE.h Visa fil

42
 #define PIN_P0_03          P0_03   // AUX1 (Interrupt Capable/ADC/Serial Port 0)
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
 // Servo pin
51
 // Servo pin

Laddar…
Avbryt
Spara