This is a sample to make Software Standby using OS.

Revision:
1:29fa0989ec31
Parent:
0:27ae610e630e
Child:
2:c0f92fd0e8e9
--- a/main.cpp	Fri Nov 18 09:44:29 2016 +0000
+++ b/main.cpp	Fri Nov 18 10:40:19 2016 +0000
@@ -6,11 +6,11 @@
 DigitalOut led1(LED1);
 Thread * pTestTask = NULL;
 
+#if(0)  // Do not set when using SoftwareStandby.
 static void idle_hook(void) {
-    __SEV();
-    __WFE();
-    __WFE();
+    __WFI();  // Do not set when using SoftwareStandby.
 }
+#endif
 
 void SoftwareStandby(void) {
     volatile uint32_t dummy_32;
@@ -30,9 +30,7 @@
     CPG.STBCR1 = 0x80;
     dummy_8 = CPG.STBCR1;
 
-    __SEV();
-    __WFE();
-    __WFE();
+    __WFI();
 
     GIC_EnableIRQ(OSTMI0TINT_IRQn);
 }
@@ -64,7 +62,9 @@
 }
 
 int main() {
+#if(0)  // Do not set when using SoftwareStandby.
     Thread::attach_idle_hook(idle_hook);
+#endif
     pTestTask = new Thread();
     pTestTask->start(test_task);
 }