mbed library sources

Fork of mbed-src by mbed official

Revision:
531:47d2b67c511f
Parent:
491:b97b6b70036c
Child:
552:a1b9575155a3
--- a/targets/hal/TARGET_STM/TARGET_STM32L0/spi_api.c	Thu Apr 30 09:15:06 2015 +0100
+++ b/targets/hal/TARGET_STM/TARGET_STM32L0/spi_api.c	Thu Apr 30 13:00:08 2015 +0100
@@ -1,6 +1,6 @@
 /* mbed Microcontroller Library
  *******************************************************************************
- * Copyright (c) 2014, STMicroelectronics
+ * Copyright (c) 2015, STMicroelectronics
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -35,6 +35,7 @@
 #include <math.h>
 #include "cmsis.h"
 #include "pinmap.h"
+#include "mbed_error.h"
 #include "PeripheralPins.h"
 
 static SPI_HandleTypeDef SpiHandle;
@@ -57,7 +58,9 @@
     SpiHandle.Init.NSS               = obj->nss;
     SpiHandle.Init.TIMode            = SPI_TIMODE_DISABLED;
 
-    HAL_SPI_Init(&SpiHandle);
+    if (HAL_SPI_Init(&SpiHandle) != HAL_OK) {
+        error("Cannot initialize SPI");
+    }
 
     __HAL_SPI_ENABLE(&SpiHandle);
 }
@@ -193,6 +196,7 @@
     } else { // >= 16000000
         obj->br_presc = SPI_BAUDRATEPRESCALER_2; // 16 MHz
     }
+
     init_spi(obj);
 }