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

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Revision:
145:64910690c574
Parent:
138:093f2bd7b9eb
Child:
152:235179ab3f27
--- a/platform/mbed_sleep.h	Thu Jun 08 14:53:05 2017 +0100
+++ b/platform/mbed_sleep.h	Wed Jun 21 17:31:38 2017 +0100
@@ -28,7 +28,8 @@
 /** Send the microcontroller to sleep
  *
  * @note This function can be a noop if not implemented by the platform.
- * @note This function will only put device to sleep in release mode (small profile or when NDEBUG is defined).
+ * @note This function will be a noop in debug mode (debug build profile when MBED_DEBUG is defined).
+ * @note This function will be a noop while uVisor is in use.
  *
  * The processor is setup ready for sleep, and sent to sleep using __WFI(). In this mode, the
  * system clock to the core is stopped until a reset or an interrupt occurs. This eliminates
@@ -44,17 +45,20 @@
  */
 __INLINE static void sleep(void)
 {
-#ifdef NDEBUG
+#if !(defined(FEATURE_UVISOR) && defined(TARGET_UVISOR_SUPPORTED))
+#ifndef MBED_DEBUG
 #if DEVICE_SLEEP
     hal_sleep();
 #endif /* DEVICE_SLEEP */
-#endif /* NDEBUG */
+#endif /* MBED_DEBUG */
+#endif /* !(defined(FEATURE_UVISOR) && defined(TARGET_UVISOR_SUPPORTED)) */
 }
 
 /** Send the microcontroller to deep sleep
  *
  * @note This function can be a noop if not implemented by the platform.
- * @note This function will only put device to sleep in release mode (small profile or when NDEBUG is defined).
+ * @note This function will be a noop in debug mode (debug build profile when MBED_DEBUG is defined)
+ * @note This function will be a noop while uVisor is in use.
  *
  * This processor is setup ready for deep sleep, and sent to sleep using __WFI(). This mode
  * has the same sleep features as sleep plus it powers down peripherals and clocks. All state
@@ -69,11 +73,13 @@
  */
 __INLINE static void deepsleep(void)
 {
-#ifdef NDEBUG
+#if !(defined(FEATURE_UVISOR) && defined(TARGET_UVISOR_SUPPORTED))
+#ifndef MBED_DEBUG
 #if DEVICE_SLEEP
     hal_deepsleep();
 #endif /* DEVICE_SLEEP */
-#endif /* NDEBUG */
+#endif /* MBED_DEBUG */
+#endif /* !(defined(FEATURE_UVISOR) && defined(TARGET_UVISOR_SUPPORTED)) */
 }
 
 #ifdef __cplusplus