mbed library sources

Dependents:   frdm_kl05z_gpio_test

Fork of mbed-src by mbed official

Revision:
215:83cf97a28428
Parent:
208:4557f4bb2dd5
Child:
227:7bd0639b8911
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/serial_api.c	Tue May 27 08:15:07 2014 +0100
+++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/serial_api.c	Tue May 27 08:30:06 2014 +0100
@@ -95,12 +95,15 @@
     // Enable USART clock
     if (obj->uart == UART_1) {
         RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);
+        obj->index = 0;
     }
     if (obj->uart == UART_2) {
         RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);
+        obj->index = 1;
     }
     if (obj->uart == UART_3) {
         RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);
+        obj->index = 2;
     }
 
     // Configure the UART pins
@@ -118,11 +121,6 @@
 
     init_usart(obj);
 
-    // The index is used by irq
-    if (obj->uart == UART_1) obj->index = 0;
-    if (obj->uart == UART_2) obj->index = 1;
-    if (obj->uart == UART_3) obj->index = 2;
-
     // For stdio management
     if (obj->uart == STDIO_UART) {
         stdio_uart_inited = 1;