Skip to content

digitalRead() broken on pins in output mode. #79

Closed
@WestfW

Description

@WestfW

Apparently "pinMode(pin, OUTPUT)" will clear the INEN bit for the GPIO pin in question, preventing digitalRead() (or direct port access) from being able to read the current output state of an output pin, and breaking trivial statements like:
digitalWrite(13, ! digitalRead(13)); // toggle LED
As far as I can tell, there should never be a reason to disable input on the GPIO pins (PORT_PINCFG_INEN bit cleared in pincfg), except maybe when the pin is used for analog input.

http://forum.arduino.cc/index.php?topic=367517

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