Team DIANA / mbed-src

Dependents:   MX106-finaltest

Fork of mbed-src by mbed official

Revision:
531:47d2b67c511f
Parent:
491:b97b6b70036c
diff -r 2939f5396008 -r 47d2b67c511f targets/hal/TARGET_STM/TARGET_STM32L0/i2c_api.c
--- a/targets/hal/TARGET_STM/TARGET_STM32L0/i2c_api.c	Thu Apr 30 09:15:06 2015 +0100
+++ b/targets/hal/TARGET_STM/TARGET_STM32L0/i2c_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
@@ -34,6 +34,7 @@
 
 #include "cmsis.h"
 #include "pinmap.h"
+#include "mbed_error.h"
 #include "PeripheralPins.h"
 
 /* Timeout values for flags and events waiting loops. These timeouts are
@@ -135,7 +136,10 @@
     I2cHandle.Init.OwnAddress1      = 0;
     I2cHandle.Init.OwnAddress2      = 0;
     I2cHandle.Init.OwnAddress2Masks = I2C_OA2_NOMASK;
-    HAL_I2C_Init(&I2cHandle);
+
+    if (HAL_I2C_Init(&I2cHandle) != HAL_OK) {
+        error("Cannot initialize I2C");
+    }
 }
 
 inline int i2c_start(i2c_t *obj)