Merged in gnagflow/nuttx (pull request #134)
SAM3/4: Fix GPIO pull-up/down code.
This commit is contained in:
commit
0441c53aec
|
@ -190,6 +190,12 @@ static inline int sam_configinput(uintptr_t base, uint32_t pin,
|
|||
|
||||
if ((cfgset & GPIO_CFG_PULLUP) != 0)
|
||||
{
|
||||
/* The pull-up on a pin can not be enabled if its pull-down is still
|
||||
* active. Therefore, we need to disable the pull-down first before
|
||||
* enabling the pull-up.
|
||||
*/
|
||||
|
||||
putreg32(pin, base + SAM_PIO_PPDDR_OFFSET);
|
||||
putreg32(pin, base + SAM_PIO_PUER_OFFSET);
|
||||
}
|
||||
else
|
||||
|
@ -202,6 +208,12 @@ static inline int sam_configinput(uintptr_t base, uint32_t pin,
|
|||
|
||||
if ((cfgset & GPIO_CFG_PULLDOWN) != 0)
|
||||
{
|
||||
/* The pull-down on a pin can not be enabled if its pull-up is still
|
||||
* active. Therefore, we need to disable the pull-up first before
|
||||
* enabling the pull-down.
|
||||
*/
|
||||
|
||||
putreg32(pin, base + SAM_PIO_PUDR_OFFSET);
|
||||
putreg32(pin, base + SAM_PIO_PPDER_OFFSET);
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue