mbed library sources. Supersedes mbed-src. Fixed broken STM32F1xx RTC on rtc_api.c

Dependents:   Nucleo_F103RB_RTC_battery_bkup_pwr_off_okay

Fork of mbed-dev by mbed official

Revision:
174:b96e65c34a4d
Parent:
149:156823d33999
diff -r e131a1973e81 -r b96e65c34a4d drivers/I2C.cpp
--- a/drivers/I2C.cpp	Fri Sep 15 14:59:18 2017 +0100
+++ b/drivers/I2C.cpp	Mon Oct 02 15:33:19 2017 +0100
@@ -17,6 +17,10 @@
 
 #if DEVICE_I2C
 
+#if DEVICE_I2C_ASYNCH
+#include "platform/mbed_sleep.h"
+#endif
+
 namespace mbed {
 
 I2C *I2C::_owner = NULL;
@@ -129,6 +133,7 @@
         unlock();
         return -1; // transaction ongoing
     }
+    sleep_manager_lock_deep_sleep();
     aquire();
 
     _callback = callback;
@@ -143,6 +148,7 @@
 {
     lock();
     i2c_abort_asynch(&_i2c);
+    sleep_manager_unlock_deep_sleep();
     unlock();
 }
 
@@ -152,6 +158,9 @@
     if (_callback && event) {
         _callback.call(event);
     }
+    if (event) {
+        sleep_manager_unlock_deep_sleep();
+    }
 
 }