11#include < GSM3ShieldV1AccessProvider.h>
22#include < Arduino.h>
3+ #include " GSM3IO.h"
34
4- #define __RESETPIN__ 7
55#define __TOUTSHUTDOWN__ 5000
66#define __TOUTMODEMCONFIGURATION__ 5000 // equivalent to 30000 because of time in interrupt routine.
77#define __TOUTAT__ 1000
@@ -38,6 +38,11 @@ GSM3_NetworkStatus_t GSM3ShieldV1AccessProvider::begin(char* pin, bool restart,
3838{
3939 pinMode (__RESETPIN__, OUTPUT);
4040
41+ #ifdef TTOPEN_V1
42+ pinMode (__POWERPIN__, OUTPUT);
43+ digitalWrite (__POWERPIN__, HIGH);
44+ #endif
45+
4146 // If asked for modem restart, restart
4247 if (restart)
4348 HWrestart ();
@@ -60,7 +65,11 @@ GSM3_NetworkStatus_t GSM3ShieldV1AccessProvider::begin(char* pin, bool restart,
6065// HWrestart.
6166int GSM3ShieldV1AccessProvider::HWrestart ()
6267{
63-
68+ #ifdef TTOPEN_V1
69+ digitalWrite (__POWERPIN__, HIGH);
70+ delay (1000 );
71+ #endif
72+
6473 theGSM3ShieldV1ModemCore.setStatus (IDLE);
6574 digitalWrite (__RESETPIN__, HIGH);
6675 delay (12000 );
@@ -292,5 +301,23 @@ bool GSM3ShieldV1AccessProvider::shutdown()
292301 return resp;
293302 }
294303 return false ;
295- }
304+ }
296305
306+ // Secure shutdown.
307+ bool GSM3ShieldV1AccessProvider::secureShutdown ()
308+ {
309+ // It makes no sense to have an asynchronous shutdown
310+ pinMode (__RESETPIN__, OUTPUT);
311+ digitalWrite (__RESETPIN__, HIGH);
312+ delay (900 );
313+ digitalWrite (__RESETPIN__, LOW);
314+ theGSM3ShieldV1ModemCore.setStatus (OFF);
315+ theGSM3ShieldV1ModemCore.gss .close ();
316+
317+ #ifdef TTOPEN_V1
318+ _delay_ms (12000 );
319+ digitalWrite (__POWERPIN__, LOW);
320+ #endif
321+
322+ return true ;
323+ }
0 commit comments