arm/rp2040: Add rp2040_gpio_set_pulls()

This commit is contained in:
Yuichi Nakamura 2021-03-02 22:50:57 +09:00 committed by Alan Carvalho de Assis
parent 8d0fd4038b
commit 60b18467f3
2 changed files with 9 additions and 0 deletions

View File

@ -59,3 +59,11 @@ void rp2040_gpio_set_function(uint32_t gpio, uint32_t func)
putreg32(func & RP2040_IO_BANK0_GPIO_CTRL_FUNCSEL_MASK,
RP2040_IO_BANK0_GPIO_CTRL(gpio));
}
void rp2040_gpio_set_pulls(uint32_t gpio, int up, int down)
{
modbits_reg32((up ? RP2040_PADS_BANK0_GPIO_PUE : 0) |
(down ? RP2040_PADS_BANK0_GPIO_PDE : 0),
RP2040_PADS_BANK0_GPIO_PUE | RP2040_PADS_BANK0_GPIO_PDE,
RP2040_PADS_BANK0_GPIO(gpio));
}

View File

@ -55,6 +55,7 @@ extern "C"
****************************************************************************/
void rp2040_gpio_set_function(uint32_t gpio, uint32_t func);
void rp2040_gpio_set_pulls(uint32_t gpio, int up, int down);
#undef EXTERN
#if defined(__cplusplus)