Skip to content

Commit

Permalink
[sam] Fix pull-down configuration for SAMx7x and SAMG5x devices
Browse files Browse the repository at this point in the history
To enable the pull-down no pull-up may be active. The code for
reconfiguring the input type was not working when the type was changed
from pull-up to pull-down.
  • Loading branch information
chris-durand committed Jan 12, 2023
1 parent 29d8387 commit c93dd2c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/modm/platform/gpio/sam/pin.hpp.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Copyright (c) 2017-2018, Niklas Hauser
* Copyright (c) 2020, Erik Henriksson
* Copyright (c) 2023, Christopher Durand
*
* This file is part of the modm project.
*
Expand Down Expand Up @@ -221,8 +222,8 @@ public:
setPortReg(PIO_PPDDR_OFFSET); // disable pull down
setPortReg(PIO_PUDR_OFFSET); // disable pull up
} else if (type == InputType::PullDown) {
setPortReg(PIO_PPDER_OFFSET); // Enable pull down
setPortReg(PIO_PUDR_OFFSET); // disable pull up
setPortReg(PIO_PPDER_OFFSET); // enable pull down
} else {
setPortReg(PIO_PPDDR_OFFSET); // Disable pull down
setPortReg(PIO_PUER_OFFSET); // Enable pull up
Expand Down

0 comments on commit c93dd2c

Please sign in to comment.