Example program demonstrating proper powering down of Telit radio and putting the processor into STOP mode.

Dependencies:   WakeUp mbed mtsas SpiFlash25

Fork of Dragonfly_Cellular_Ping_Example by MultiTech

Revision:
5:e493656a4a1a
Parent:
4:91a322a2ec86
--- a/main.cpp	Mon Feb 29 19:28:01 2016 +0000
+++ b/main.cpp	Tue Mar 01 17:41:47 2016 +0000
@@ -26,6 +26,7 @@
 #include "mbed.h"
 #include "mtsas.h"
 #include "WakeUp.h"
+#include "SpiFlash25.h"
 
 // This line controls the regulator's battery charger.
 // BC_NCE = 0 enables the battery charger
@@ -55,6 +56,8 @@
 // It goes to 0 after the radio has successfully shut down
 DigitalIn vdd1_8_mon(PC_5);
 
+SpiFlash25 flash(SPI_MOSI, SPI_MISO, SPI_SCK, SPI_CS1);
+
 bool init_mtsas();
 void enterStopMode(const uint32_t interval);
 
@@ -94,6 +97,8 @@
         logInfo("changing regulator to 1A mode");
         bc_en1 = 0;
         bc_en2 = 1;
+        logInfo("waking up the SPI flash");
+        flash.wakeup();
         logInfo("powering on radio");
         radio_pwr = 1;
         radio_reset = 1;
@@ -150,6 +155,8 @@
             
         logInfo("radio powered off after %fs", tmr.read());
         radio_pwr = 0;
+        logInfo("putting the SPI flash in deep power down");
+        flash.deep_power_down();
         logInfo("putting regulator in 100mA mode");
         bc_en1 = 0;
         bc_en2 = 0;