Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-src by
Diff: targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/pinmap.c
- Revision:
- 80:66393a7b209d
- Parent:
- 76:aeb1df146756
- Child:
- 84:f54042cbc282
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/pinmap.c Thu Jan 30 09:45:05 2014 +0000
+++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/pinmap.c Thu Jan 30 12:15:05 2014 +0000
@@ -83,7 +83,13 @@
// 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);
GPIO_InitStructure.GPIO_Mode = (GPIOMode_TypeDef)mode;
@@ -91,11 +97,6 @@
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.
