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:
committed by
Karl Palsson
parent
abc74fd78b
commit
89e90e0e5d
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user