diff --git a/cores/arduino/wiring_digital.c b/cores/arduino/wiring_digital.c index 0d51d57d..9754e505 100644 --- a/cores/arduino/wiring_digital.c +++ b/cores/arduino/wiring_digital.c @@ -145,22 +145,19 @@ void digitalWrite(uint8_t pin, PinStatus val) /* Get port */ PORT_t *port = digitalPinToPortStruct(pin); - /* Output direction */ - if(port->DIR & bit_mask){ - - /* Set output to value */ - if (val == LOW) { /* If LOW */ - port->OUTCLR = bit_mask; + /* Set output to value */ + if (val == LOW) { /* If LOW */ + port->OUTCLR = bit_mask; - } else if (val == CHANGE) { /* If TOGGLE */ - port->OUTTGL = bit_mask; - /* If HIGH OR > TOGGLE */ - } else { - port->OUTSET = bit_mask; - } + } else if (val == CHANGE) { /* If TOGGLE */ + port->OUTTGL = bit_mask; + /* If HIGH OR > TOGGLE */ + } else { + port->OUTSET = bit_mask; + } /* Input direction */ - } else { + if(port->DIR & bit_mask){ /* Old implementation has side effect when pin set as input - pull up is enabled if this function is called. Should we purposely implement this side effect? pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy