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:
- 84:f54042cbc282
- Parent:
- 80:66393a7b209d
- Child:
- 129:0182c99221bc
diff -r 5a6f638110fe -r f54042cbc282 targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/pinmap.c --- a/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/pinmap.c Fri Jan 31 10:15:06 2014 +0000 +++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/pinmap.c Mon Feb 03 09:30:05 2014 +0000 @@ -30,7 +30,6 @@ #include "pinmap.h" #include "error.h" -// Not an API function // Enable GPIO clock and return GPIO base address uint32_t Set_GPIO_Clock(uint32_t port_idx) { uint32_t gpio_add = 0; @@ -66,9 +65,6 @@ * Configure pin (mode, speed, output type and pull-up/pull-down) */ void pin_function(PinName pin, int data) { - GPIO_TypeDef *gpio; - GPIO_InitTypeDef GPIO_InitStructure; - if (pin == NC) return; // Get the pin informations @@ -82,7 +78,7 @@ // Enable GPIO clock uint32_t gpio_add = Set_GPIO_Clock(port_index); - gpio = (GPIO_TypeDef *)gpio_add; + GPIO_TypeDef *gpio = (GPIO_TypeDef *)gpio_add; // Configure Alternate Function // Warning: Must be done before the GPIO is initialized @@ -91,6 +87,7 @@ } // Configure GPIO + GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitStructure.GPIO_Pin = (uint16_t)(1 << pin_index); GPIO_InitStructure.GPIO_Mode = (GPIOMode_TypeDef)mode; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_40MHz; @@ -113,8 +110,6 @@ * Configure pin pull-up/pull-down */ void pin_mode(PinName pin, PinMode mode) { - GPIO_TypeDef *gpio; - if (pin == NC) return; uint32_t port_index = STM_PORT(pin); @@ -122,7 +117,7 @@ // Enable GPIO clock uint32_t gpio_add = Set_GPIO_Clock(port_index); - gpio = (GPIO_TypeDef *)gpio_add; + GPIO_TypeDef *gpio = (GPIO_TypeDef *)gpio_add; // Configure pull-up/pull-down resistors uint32_t pupd = (uint32_t)mode;