Flotsam / Full-Project

Dependencies:   GPSLibrary GSM mbed-modifed Storage_Library Temp_Library Wakeup pH_Sensor

Files at this revision

API Documentation at this revision

Comitter:
ptcrews
Date:
Mon Nov 02 20:24:56 2015 +0000
Parent:
1:83d3982f32d5
Child:
3:6afcf4f3b2aa
Commit message:
Added deep sleep

Changed in this revision

Wakeup.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Wakeup.lib	Mon Nov 02 20:24:56 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/Sissors/code/WakeUp/#787915edaed6
--- a/main.cpp	Mon Nov 02 19:34:26 2015 +0000
+++ b/main.cpp	Mon Nov 02 20:24:56 2015 +0000
@@ -1,4 +1,5 @@
 #include "Adafruit_FONA.h"
+#include "WakeUp.h"
 #include "mbed.h"
 
 #define FONA_TX D8
@@ -11,17 +12,28 @@
 Serial pcSerial(USBTX, USBRX);
 DigitalOut key(FONA_KEY);
 
-void pullKey()
+void changeGSMPowerState()
 {
     key.write(0);
     wait(2);
     key.write(1);
 }
 
+void enterSleep(int msec){
+    if(msec > 0) WakeUp::set_ms(msec);
+    deepsleep();
+}
+    
+
 int main()
 {
+    printf("Deep sleep test\n");
+    // Enters deep sleep indefinitely
+    enterSleep(0);
+    printf("Exiting\n");
+    
     pcSerial.baud(9600);
-    pullKey();
+    changeGSMPowerState();
     printf("Starting FONA\n");
     while(!fona.begin(9600)) {
         printf("Cannot find FONA\n");
@@ -31,7 +43,7 @@
     pcSerial.printf("On for 2 seconds\n");
     wait(2);
     pcSerial.printf("Turning off\n");
-    pullKey();
+    changeGSMPowerState();
 
     return 0;
 }
\ No newline at end of file