Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8f450c8

Browse filesBrowse files
committed
GSM: add software reset and power off
1 parent f23d294 commit 8f450c8
Copy full SHA for 8f450c8

File tree

2 files changed

+25
-3
lines changed
Filter options

2 files changed

+25
-3
lines changed

‎libraries/GSM/src/GSM.cpp

Copy file name to clipboardExpand all lines: libraries/GSM/src/GSM.cpp
+14-2Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ int arduino::GSMClass::begin(const char* pin, const char* apn, const char* usern
6262
const bool emergencyReset = restart || isCmuxEnable();
6363
DEBUG_INFO("Emergency reset %s", emergencyReset ? "enabled" : "disabled");
6464
if (emergencyReset) {
65-
reset();
65+
hardwareReset();
6666
}
6767

6868
/* Create rising edge on pin ON */
@@ -140,6 +140,18 @@ void arduino::GSMClass::end() {
140140
}
141141
}
142142

143+
void arduino::GSMClass::reset() {
144+
if(_device) {
145+
_device->soft_reset();
146+
}
147+
}
148+
149+
void arduino::GSMClass::off() {
150+
if(_device) {
151+
_device->soft_power_off();
152+
}
153+
}
154+
143155
int arduino::GSMClass::ping(const char* hostname, int ttl) {
144156

145157
mbed::GEMALTO_CINTERION_CellularStack* stack = (mbed::GEMALTO_CINTERION_CellularStack*)_context->get_stack();
@@ -215,7 +227,7 @@ NetworkInterface* arduino::GSMClass::getNetwork() {
215227
return _context;
216228
}
217229

218-
void arduino::GSMClass::reset() {
230+
void arduino::GSMClass::hardwareReset() {
219231
/* Reset logic is inverted */
220232
pinMode(MBED_CONF_GEMALTO_CINTERION_RST, OUTPUT);
221233
digitalWrite(MBED_CONF_GEMALTO_CINTERION_RST, HIGH);

‎libraries/GSM/src/GSM.h

Copy file name to clipboardExpand all lines: libraries/GSM/src/GSM.h
+11-1Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,16 @@ class GSMClass : public MbedSocketClass {
100100
*/
101101
void end(void);
102102

103+
/*
104+
* Send AT+CFUN=1,1 command to trigger a software reset. To be called only after end();
105+
*/
106+
void reset();
107+
108+
/*
109+
* Send AT^SMSO="fast command to power off the modem. To be called only after end();
110+
*/
111+
void off();
112+
103113
/*
104114
* Change cellular state timeouts. Needs to be called before GSM.begin()
105115
*/
@@ -157,7 +167,7 @@ class GSMClass : public MbedSocketClass {
157167
static const char * getRegistrationStateString(const mbed::CellularNetwork::RegistrationStatus state);
158168
void onStatusChange(nsapi_event_t ev, intptr_t in);
159169

160-
void reset();
170+
void hardwareReset();
161171
void on();
162172
};
163173

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.