mirror of https://github.com/ARMmbed/mbed-os.git
[NUCLEO_F030R8] Change AF setting before GPIO setting
parent
955223fd2c
commit
3ace84aece
|
@ -83,6 +83,12 @@ void pin_function(PinName pin, int data) {
|
|||
// Enable GPIO clock
|
||||
uint32_t gpio_add = Set_GPIO_Clock(port_index);
|
||||
gpio = (GPIO_TypeDef *)gpio_add;
|
||||
|
||||
// Configure Alternate Function
|
||||
// Warning: Must be done before the GPIO is initialized
|
||||
if (afnum != 0xFF) {
|
||||
GPIO_PinAFConfig(gpio, (uint16_t)pin_index, afnum);
|
||||
}
|
||||
|
||||
// Configure GPIO
|
||||
GPIO_InitStructure.GPIO_Pin = (uint16_t)(1 << pin_index);
|
||||
|
@ -91,11 +97,6 @@ void pin_function(PinName pin, int data) {
|
|||
GPIO_InitStructure.GPIO_OType = (GPIOOType_TypeDef)otype;
|
||||
GPIO_InitStructure.GPIO_PuPd = (GPIOPuPd_TypeDef)pupd;
|
||||
GPIO_Init(gpio, &GPIO_InitStructure);
|
||||
|
||||
// Configure Alternate Function
|
||||
if (afnum != 0xFF) {
|
||||
GPIO_PinAFConfig(gpio, (uint16_t)pin_index, afnum);
|
||||
}
|
||||
|
||||
// *** TODO ***
|
||||
// Disconnect JTAG-DP + SW-DP signals.
|
||||
|
|
Loading…
Reference in New Issue