powers down the modem on disconnect

pull/9064/head
Veijo Pesonen 2018-12-07 14:59:51 +02:00 committed by Cruz Monrreal II
parent 5799daef72
commit 7210b97c59
1 changed files with 9 additions and 3 deletions

View File

@ -109,6 +109,9 @@ ESP8266Interface::~ESP8266Interface()
if (_oob_event_id) { if (_oob_event_id) {
_global_event_queue->cancel(_oob_event_id); _global_event_queue->cancel(_oob_event_id);
} }
// Power down the modem
_rst_pin.assert();
} }
ESP8266Interface::ResetPin::ResetPin(PinName rst_pin) : _rst_pin(mbed::DigitalOut(rst_pin, 1)) ESP8266Interface::ResetPin::ResetPin(PinName rst_pin) : _rst_pin(mbed::DigitalOut(rst_pin, 1))
@ -119,9 +122,6 @@ void ESP8266Interface::ResetPin::assert()
{ {
if (_rst_pin.is_connected()) { if (_rst_pin.is_connected()) {
_rst_pin = 0; _rst_pin = 0;
// If you happen to use Pin7 CH_EN as reset pin, not needed otherwise
// https://www.espressif.com/sites/default/files/documentation/esp8266_hardware_design_guidelines_en.pdf
wait_us(200);
tr_debug("HW reset asserted"); tr_debug("HW reset asserted");
} }
} }
@ -269,6 +269,9 @@ int ESP8266Interface::disconnect()
} }
} }
// Power down the modem
_rst_pin.assert();
return ret; return ret;
} }
@ -375,6 +378,9 @@ nsapi_error_t ESP8266Interface::_init(void)
void ESP8266Interface::_hw_reset() void ESP8266Interface::_hw_reset()
{ {
_rst_pin.assert(); _rst_pin.assert();
// If you happen to use Pin7 CH_EN as reset pin, not needed otherwise
// https://www.espressif.com/sites/default/files/documentation/esp8266_hardware_design_guidelines_en.pdf
wait_us(200);
_rst_pin.deassert(); _rst_pin.deassert();
} }