Browse Source

Use direct pin manipulation whenever possible

Scott Lahteine 7 years ago
parent
commit
ea734f910b
2 changed files with 16 additions and 16 deletions
  1. 6
    6
      Marlin/Marlin_main.cpp
  2. 10
    10
      Marlin/stepper.cpp

+ 6
- 6
Marlin/Marlin_main.cpp View File

@@ -963,15 +963,15 @@ void servo_init() {
963 963
 
964 964
       // This variant uses 3 separate pins for the RGB components.
965 965
       // If the pins can do PWM then their intensity will be set.
966
-      digitalWrite(RGB_LED_R_PIN, r ? HIGH : LOW);
967
-      digitalWrite(RGB_LED_G_PIN, g ? HIGH : LOW);
968
-      digitalWrite(RGB_LED_B_PIN, b ? HIGH : LOW);
966
+      WRITE(RGB_LED_R_PIN, r ? HIGH : LOW);
967
+      WRITE(RGB_LED_G_PIN, g ? HIGH : LOW);
968
+      WRITE(RGB_LED_B_PIN, b ? HIGH : LOW);
969 969
       analogWrite(RGB_LED_R_PIN, r);
970 970
       analogWrite(RGB_LED_G_PIN, g);
971 971
       analogWrite(RGB_LED_B_PIN, b);
972 972
 
973 973
       #if ENABLED(RGBW_LED)
974
-        digitalWrite(RGB_LED_W_PIN, w ? HIGH : LOW);
974
+        WRITE(RGB_LED_W_PIN, w ? HIGH : LOW);
975 975
         analogWrite(RGB_LED_W_PIN, w);
976 976
       #endif
977 977
 
@@ -8548,7 +8548,7 @@ inline void gcode_M907() {
8548 8548
   uint8_t case_light_brightness = 255;
8549 8549
 
8550 8550
   void update_case_light() {
8551
-    digitalWrite(CASE_LIGHT_PIN, case_light_on != INVERT_CASE_LIGHT ? HIGH : LOW);
8551
+    WRITE(CASE_LIGHT_PIN, case_light_on != INVERT_CASE_LIGHT ? HIGH : LOW);
8552 8552
     analogWrite(CASE_LIGHT_PIN, case_light_on != INVERT_CASE_LIGHT ? case_light_brightness : 0);
8553 8553
   }
8554 8554
 
@@ -10739,7 +10739,7 @@ void prepare_move_to_destination() {
10739 10739
       uint8_t speed = (!lastMotorOn || ELAPSED(ms, lastMotorOn + (CONTROLLERFAN_SECS) * 1000UL)) ? 0 : CONTROLLERFAN_SPEED;
10740 10740
 
10741 10741
       // allows digital or PWM fan output to be used (see M42 handling)
10742
-      digitalWrite(CONTROLLERFAN_PIN, speed);
10742
+      WRITE(CONTROLLERFAN_PIN, speed);
10743 10743
       analogWrite(CONTROLLERFAN_PIN, speed);
10744 10744
     }
10745 10745
   }

+ 10
- 10
Marlin/stepper.cpp View File

@@ -1484,33 +1484,33 @@ void Stepper::report_positions() {
1484 1484
 
1485 1485
   void Stepper::microstep_ms(uint8_t driver, int8_t ms1, int8_t ms2) {
1486 1486
     if (ms1 >= 0) switch (driver) {
1487
-      case 0: digitalWrite(X_MS1_PIN, ms1); break;
1487
+      case 0: WRITE(X_MS1_PIN, ms1); break;
1488 1488
       #if HAS_MICROSTEPS_Y
1489
-        case 1: digitalWrite(Y_MS1_PIN, ms1); break;
1489
+        case 1: WRITE(Y_MS1_PIN, ms1); break;
1490 1490
       #endif
1491 1491
       #if HAS_MICROSTEPS_Z
1492
-        case 2: digitalWrite(Z_MS1_PIN, ms1); break;
1492
+        case 2: WRITE(Z_MS1_PIN, ms1); break;
1493 1493
       #endif
1494 1494
       #if HAS_MICROSTEPS_E0
1495
-        case 3: digitalWrite(E0_MS1_PIN, ms1); break;
1495
+        case 3: WRITE(E0_MS1_PIN, ms1); break;
1496 1496
       #endif
1497 1497
       #if HAS_MICROSTEPS_E1
1498
-        case 4: digitalWrite(E1_MS1_PIN, ms1); break;
1498
+        case 4: WRITE(E1_MS1_PIN, ms1); break;
1499 1499
       #endif
1500 1500
     }
1501 1501
     if (ms2 >= 0) switch (driver) {
1502
-      case 0: digitalWrite(X_MS2_PIN, ms2); break;
1502
+      case 0: WRITE(X_MS2_PIN, ms2); break;
1503 1503
       #if HAS_MICROSTEPS_Y
1504
-        case 1: digitalWrite(Y_MS2_PIN, ms2); break;
1504
+        case 1: WRITE(Y_MS2_PIN, ms2); break;
1505 1505
       #endif
1506 1506
       #if HAS_MICROSTEPS_Z
1507
-        case 2: digitalWrite(Z_MS2_PIN, ms2); break;
1507
+        case 2: WRITE(Z_MS2_PIN, ms2); break;
1508 1508
       #endif
1509 1509
       #if HAS_MICROSTEPS_E0
1510
-        case 3: digitalWrite(E0_MS2_PIN, ms2); break;
1510
+        case 3: WRITE(E0_MS2_PIN, ms2); break;
1511 1511
       #endif
1512 1512
       #if HAS_MICROSTEPS_E1
1513
-        case 4: digitalWrite(E1_MS2_PIN, ms2); break;
1513
+        case 4: WRITE(E1_MS2_PIN, ms2); break;
1514 1514
       #endif
1515 1515
     }
1516 1516
   }

Loading…
Cancel
Save