mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Revision:
84:f54042cbc282
Parent:
80:66393a7b209d
Child:
145:cfacfb0a9e19
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/pinmap.c	Fri Jan 31 10:15:06 2014 +0000
+++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/pinmap.c	Mon Feb 03 09:30:05 2014 +0000
@@ -43,7 +43,6 @@
   GPIO_Remap_I2C1         // 8
 };
 
-// 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;
@@ -75,9 +74,6 @@
  * Configure pin (input, output, alternate function or analog) + output speed + AF
  */
 void pin_function(PinName pin, int data) {
-    GPIO_TypeDef *gpio;
-    GPIO_InitTypeDef GPIO_InitStructure;
-  
     if (pin == NC) return;
 
     // Get the pin informations
@@ -89,7 +85,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;
 
     // Enable AFIO clock
     RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
@@ -101,6 +97,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_50MHz;
@@ -120,9 +117,8 @@
  * Configure pin pull-up/pull-down
  */
 void pin_mode(PinName pin, PinMode mode) {
-    GPIO_TypeDef *gpio;
     GPIO_InitTypeDef GPIO_InitStructure;
-
+    
     if (pin == NC) return;
 
     uint32_t port_index = STM_PORT(pin);
@@ -130,7 +126,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 open-drain and pull-up/down
     switch (mode) {