Kaynağa Gözat

Use fastio for literal pins

Scott Lahteine 8 yıl önce
ebeveyn
işleme
cb48292338

+ 4
- 6
Marlin/Marlin_main.cpp Dosyayı Görüntüle

@@ -782,7 +782,7 @@ void setup_killpin() {
782 782
 #if ENABLED(FILAMENT_RUNOUT_SENSOR)
783 783
 
784 784
   void setup_filrunoutpin() {
785
-    pinMode(FIL_RUNOUT_PIN, INPUT);
785
+    SET_INPUT(FIL_RUNOUT_PIN);
786 786
     #if ENABLED(ENDSTOPPULLUP_FIL_RUNOUT)
787 787
       WRITE(FIL_RUNOUT_PIN, HIGH);
788 788
     #endif
@@ -860,10 +860,9 @@ void servo_init() {
860 860
  */
861 861
 #if HAS_STEPPER_RESET
862 862
   void disableStepperDrivers() {
863
-    pinMode(STEPPER_RESET_PIN, OUTPUT);
864
-    digitalWrite(STEPPER_RESET_PIN, LOW);  // drive it down to hold in reset motor driver chips
863
+    OUT_WRITE(STEPPER_RESET_PIN, LOW);  // drive it down to hold in reset motor driver chips
865 864
   }
866
-  void enableStepperDrivers() { pinMode(STEPPER_RESET_PIN, INPUT); }  // set to input, which allows it to be pulled high by pullups
865
+  void enableStepperDrivers() { SET_INPUT(STEPPER_RESET_PIN); }  // set to input, which allows it to be pulled high by pullups
867 866
 #endif
868 867
 
869 868
 #if ENABLED(EXPERIMENTAL_I2CBUS) && I2C_SLAVE_ADDRESS > 0
@@ -9194,8 +9193,7 @@ void setup() {
9194 9193
   #endif
9195 9194
 
9196 9195
   #if ENABLED(Z_PROBE_SLED) && PIN_EXISTS(SLED)
9197
-    pinMode(SLED_PIN, OUTPUT);
9198
-    digitalWrite(SLED_PIN, LOW); // turn it off
9196
+    OUT_WRITE(SLED_PIN, LOW); // turn it off
9199 9197
   #endif // Z_PROBE_SLED
9200 9198
 
9201 9199
   setup_homepin();

+ 5
- 5
Marlin/Sd2Card.cpp Dosyayı Görüntüle

@@ -302,16 +302,16 @@ bool Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) {
302 302
   // set pin modes
303 303
   pinMode(chipSelectPin_, OUTPUT);
304 304
   chipSelectHigh();
305
-  pinMode(SPI_MISO_PIN, INPUT);
306
-  pinMode(SPI_MOSI_PIN, OUTPUT);
307
-  pinMode(SPI_SCK_PIN, OUTPUT);
305
+  SET_INPUT(SPI_MISO_PIN);
306
+  SET_OUTPUT(SPI_MOSI_PIN);
307
+  SET_OUTPUT(SPI_SCK_PIN);
308 308
 
309 309
   #if DISABLED(SOFTWARE_SPI)
310 310
     // SS must be in output mode even it is not chip select
311
-    pinMode(SS_PIN, OUTPUT);
311
+    SET_OUTPUT(SS_PIN);
312 312
     // set SS high - may be chip select for another SPI device
313 313
     #if SET_SPI_SS_HIGH
314
-      digitalWrite(SS_PIN, HIGH);
314
+      WRITE(SS_PIN, HIGH);
315 315
     #endif  // SET_SPI_SS_HIGH
316 316
     // set SCK rate for initialization commands
317 317
     spiRate_ = SPI_SD_INIT_RATE;

+ 12
- 12
Marlin/stepper.cpp Dosyayı Görüntüle

@@ -1155,10 +1155,10 @@ void Stepper::report_positions() {
1155 1155
 
1156 1156
   // From Arduino DigitalPotControl example
1157 1157
   void Stepper::digitalPotWrite(int address, int value) {
1158
-    digitalWrite(DIGIPOTSS_PIN, LOW); // take the SS pin low to select the chip
1158
+    WRITE(DIGIPOTSS_PIN, LOW); // take the SS pin low to select the chip
1159 1159
     SPI.transfer(address); //  send in the address and value via SPI:
1160 1160
     SPI.transfer(value);
1161
-    digitalWrite(DIGIPOTSS_PIN, HIGH); // take the SS pin high to de-select the chip:
1161
+    WRITE(DIGIPOTSS_PIN, HIGH); // take the SS pin high to de-select the chip:
1162 1162
     //delay(10);
1163 1163
   }
1164 1164
 
@@ -1275,21 +1275,21 @@ void Stepper::microstep_mode(uint8_t driver, uint8_t stepping_mode) {
1275 1275
 void Stepper::microstep_readings() {
1276 1276
   SERIAL_PROTOCOLLNPGM("MS1,MS2 Pins");
1277 1277
   SERIAL_PROTOCOLPGM("X: ");
1278
-  SERIAL_PROTOCOL(digitalRead(X_MS1_PIN));
1279
-  SERIAL_PROTOCOLLN(digitalRead(X_MS2_PIN));
1278
+  SERIAL_PROTOCOL(READ(X_MS1_PIN));
1279
+  SERIAL_PROTOCOLLN(READ(X_MS2_PIN));
1280 1280
   SERIAL_PROTOCOLPGM("Y: ");
1281
-  SERIAL_PROTOCOL(digitalRead(Y_MS1_PIN));
1282
-  SERIAL_PROTOCOLLN(digitalRead(Y_MS2_PIN));
1281
+  SERIAL_PROTOCOL(READ(Y_MS1_PIN));
1282
+  SERIAL_PROTOCOLLN(READ(Y_MS2_PIN));
1283 1283
   SERIAL_PROTOCOLPGM("Z: ");
1284
-  SERIAL_PROTOCOL(digitalRead(Z_MS1_PIN));
1285
-  SERIAL_PROTOCOLLN(digitalRead(Z_MS2_PIN));
1284
+  SERIAL_PROTOCOL(READ(Z_MS1_PIN));
1285
+  SERIAL_PROTOCOLLN(READ(Z_MS2_PIN));
1286 1286
   SERIAL_PROTOCOLPGM("E0: ");
1287
-  SERIAL_PROTOCOL(digitalRead(E0_MS1_PIN));
1288
-  SERIAL_PROTOCOLLN(digitalRead(E0_MS2_PIN));
1287
+  SERIAL_PROTOCOL(READ(E0_MS1_PIN));
1288
+  SERIAL_PROTOCOLLN(READ(E0_MS2_PIN));
1289 1289
   #if HAS_MICROSTEPS_E1
1290 1290
     SERIAL_PROTOCOLPGM("E1: ");
1291
-    SERIAL_PROTOCOL(digitalRead(E1_MS1_PIN));
1292
-    SERIAL_PROTOCOLLN(digitalRead(E1_MS2_PIN));
1291
+    SERIAL_PROTOCOL(READ(E1_MS1_PIN));
1292
+    SERIAL_PROTOCOLLN(READ(E1_MS2_PIN));
1293 1293
   #endif
1294 1294
 }
1295 1295
 

+ 1
- 2
Marlin/stepper_dac.cpp Dosyayı Görüntüle

@@ -52,8 +52,7 @@
52 52
 
53 53
   int dac_init() {
54 54
     #if PIN_EXISTS(DAC_DISABLE)
55
-      pinMode(DAC_DISABLE_PIN, OUTPUT);
56
-      digitalWrite(DAC_DISABLE_PIN, LOW);  // set pin low to enable DAC
55
+      OUT_WRITE(DAC_DISABLE_PIN, LOW);  // set pin low to enable DAC
57 56
     #endif
58 57
 
59 58
     mcp4728_init();

+ 2
- 4
Marlin/ultralcd_impl_DOGM.h Dosyayı Görüntüle

@@ -221,13 +221,11 @@ void lcd_printPGM(const char* str) {
221 221
 static void lcd_implementation_init() {
222 222
 
223 223
   #if PIN_EXISTS(LCD_BACKLIGHT) // Enable LCD backlight
224
-    pinMode(LCD_BACKLIGHT_PIN, OUTPUT);
225
-    digitalWrite(LCD_BACKLIGHT_PIN, HIGH);
224
+    OUT_WRITE(LCD_BACKLIGHT_PIN, HIGH);
226 225
   #endif
227 226
 
228 227
   #if PIN_EXISTS(LCD_RESET)
229
-    pinMode(LCD_RESET_PIN, OUTPUT);
230
-    digitalWrite(LCD_RESET_PIN, HIGH);
228
+    OUT_WRITE(LCD_RESET_PIN, HIGH);
231 229
   #endif
232 230
 
233 231
   #if DISABLED(MINIPANEL) // setContrast not working for Mini Panel

Loading…
İptal
Kaydet