mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
stm32f1: fix gpio mode GPIO_IN_PU
This commit is contained in:
parent
f6a5f36e18
commit
d4de629c34
@ -90,6 +90,12 @@ int gpio_init(gpio_t pin, gpio_mode_t mode)
|
|||||||
port->CR[pin_num >> 3] &= ~(0xf << ((pin_num & 0x7) * 4));
|
port->CR[pin_num >> 3] &= ~(0xf << ((pin_num & 0x7) * 4));
|
||||||
port->CR[pin_num >> 3] |= ((mode & MODE_MASK) << ((pin_num & 0x7) * 4));
|
port->CR[pin_num >> 3] |= ((mode & MODE_MASK) << ((pin_num & 0x7) * 4));
|
||||||
|
|
||||||
|
/* set ODR */
|
||||||
|
if (mode == GPIO_IN_PU)
|
||||||
|
port->ODR |= 1 << pin_num;
|
||||||
|
else
|
||||||
|
port->ODR &= ~(1 << pin_num);
|
||||||
|
|
||||||
return 0; /* all OK */
|
return 0; /* all OK */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user