1
1
#include < GSM3ShieldV1AccessProvider.h>
2
2
#include < Arduino.h>
3
+ #include " GSM3IO.h"
3
4
4
- #define __RESETPIN__ 7
5
5
#define __TOUTSHUTDOWN__ 5000
6
6
#define __TOUTMODEMCONFIGURATION__ 5000 // equivalent to 30000 because of time in interrupt routine.
7
7
#define __TOUTAT__ 1000
@@ -38,6 +38,11 @@ GSM3_NetworkStatus_t GSM3ShieldV1AccessProvider::begin(char* pin, bool restart,
38
38
{
39
39
pinMode (__RESETPIN__, OUTPUT);
40
40
41
+ #ifdef TTOPEN_V1
42
+ pinMode (__POWERPIN__, OUTPUT);
43
+ digitalWrite (__POWERPIN__, HIGH);
44
+ #endif
45
+
41
46
// If asked for modem restart, restart
42
47
if (restart)
43
48
HWrestart ();
@@ -60,7 +65,11 @@ GSM3_NetworkStatus_t GSM3ShieldV1AccessProvider::begin(char* pin, bool restart,
60
65
// HWrestart.
61
66
int GSM3ShieldV1AccessProvider::HWrestart ()
62
67
{
63
-
68
+ #ifdef TTOPEN_V1
69
+ digitalWrite (__POWERPIN__, HIGH);
70
+ delay (1000 );
71
+ #endif
72
+
64
73
theGSM3ShieldV1ModemCore.setStatus (IDLE);
65
74
digitalWrite (__RESETPIN__, HIGH);
66
75
delay (12000 );
@@ -292,5 +301,23 @@ bool GSM3ShieldV1AccessProvider::shutdown()
292
301
return resp;
293
302
}
294
303
return false ;
295
- }
304
+ }
296
305
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