|
@@ -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) {
|