Bläddra i källkod

Set pinMode with every digitalWrite (legacy compatibility)

Bob-the-Kuhn 6 år sedan
förälder
incheckning
d80877d570
1 ändrade filer med 10 tillägg och 0 borttagningar
  1. 10
    0
      Marlin/src/HAL/HAL_LPC1768/arduino.cpp

+ 10
- 0
Marlin/src/HAL/HAL_LPC1768/arduino.cpp Visa fil

@@ -121,6 +121,16 @@ void digitalWrite(int pin, int pin_status) {
121 121
     LPC_GPIO(pin_map[pin].port)->FIOSET = LPC_PIN(pin_map[pin].pin);
122 122
   else
123 123
     LPC_GPIO(pin_map[pin].port)->FIOCLR = LPC_PIN(pin_map[pin].pin);
124
+
125
+  pinMode(pin, OUTPUT);  // Set pin mode on every write (Arduino version does this)
126
+
127
+    /**
128
+     * Must be done AFTER the output state is set. Doing this before will cause a
129
+     * 2uS glitch if writing a "1".
130
+     *
131
+     * When the Port Direction bit is written to a "1" the output is immediately set
132
+     * to the value of the FIOPIN bit which is "0" because of power up defaults.
133
+     */
124 134
 }
125 135
 
126 136
 bool digitalRead(int pin) {

Laddar…
Avbryt
Spara