Example use of the sleep manager API.

Files at this revision

API Documentation at this revision

Comitter:
c1728p9
Date:
Fri Oct 27 23:06:33 2017 +0000
Commit message:
Initial Commit

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r e85412b4147e main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Oct 27 23:06:33 2017 +0000
@@ -0,0 +1,16 @@
+#include "mbed.h"
+
+int main()
+{
+    // Deep sleep for 1 second
+    printf("Deep sleep allowed: %i\r\n", sleep_manager_can_deep_sleep());
+    wait(1.0);
+    
+    // Lock deep sleep
+    printf("Locking deep sleep\r\n");
+    sleep_manager_lock_deep_sleep();
+    
+    // Sleep for 1 second
+    printf("Deep sleep allowed: %i\r\n", sleep_manager_can_deep_sleep());
+    wait(1.0);
+}
\ No newline at end of file
diff -r 000000000000 -r e85412b4147e mbed-os.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Fri Oct 27 23:06:33 2017 +0000
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#e62a1b9236b44e70ae3b0902dc538481c04d455b