pac55xx: gpio: fix gpio_set_af for pin alternate function settings.

register bits were not cleared before setting. refactored to be similar
to how the drive strength register is being set.
This commit is contained in:
Kevin Stefanik
2020-02-28 07:40:27 -05:00
committed by Karl Palsson
parent abc74fd78b
commit 89e90e0e5d
2 changed files with 6 additions and 4 deletions

View File

@@ -110,10 +110,9 @@ void gpio_set_af(uint32_t gpioport, ccs_muxsel_func_t muxsel, uint16_t gpios) {
int ffs = __builtin_ffs(gpios);
while (ffs) {
const int pin = ffs - 1;
const int shift = pin * 4;
reg &= CCS_MUXSELR_MASK << shift;
reg |= muxsel << shift;
reg &= ~CCS_MUXSELR_MASK_PIN(pin);
reg |= CCS_MUXSELR_VAL(pin, muxsel);
/* Set the pinmux configurations for the pull-up / pull-down. */
gpios ^= (1 << pin); /* Clear the bit we just serviced. */