Skip to content

Commit

Permalink
[sam] GPIO setOutput overrides peripheral control
Browse files Browse the repository at this point in the history
Calling setOutput now overrides peripheral control of the pin. This
behavior is consistent with the STM32 GPIO implementation, this commit also
ensures output value is set before the output drive is enabled to prevent
glitch.
  • Loading branch information
mcbridejc committed Feb 7, 2022
1 parent 3f3ff3d commit a4da024
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/modm/platform/gpio/sam/pin.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,17 @@ public:
inline static void
setOutput()
{
// Enable PIO control of the pin (disables peripheral control)
setPortReg(PIO_PER_OFFSET);
// Enable output driver
setPortReg(PIO_OER_OFFSET);
}

inline static void
setOutput(bool status)
{
setOutput();
set(status);
setOutput();
}

static void
Expand Down

0 comments on commit a4da024

Please sign in to comment.