Skip to content

digitalWrite() unnecessarily activates the pull-up resistor on the specified pin #94

Closed
@BlackBrix

Description

@BlackBrix

digitalWrite() unnecessarily activates the pull-up resistor on the specified pin.

the issue with the pull-up in digitalWrite(),
(other than the fact that this line shouldn't be there),
is because the pin configuration register (PINCFG) isn't logically ORed with the bit mask when the pull-up bit (PULLEN) is enabled,
instead the mask is copied directly into the register.
This effectively clears all the other bits in the register including the input enable (INEN).

in addition this issue makes the code not forward/backward compatible to AVR code
(digitalRead therefore cannot read back the current value of a digital PIN configured as OUTPUT.)

--> https://forum.arduino.cc/index.php?topic=367517.msg2534096#msg2534096
--> http://forum.arduino.cc/index.php?topic=334073.msg2306580#msg2306580

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions