esp8266: add reset function

This commit is contained in:
King Kévin 2022-08-11 14:06:22 +02:00
parent 61a427c18a
commit 6ebdb31e07
2 changed files with 15 additions and 1 deletions

View File

@ -122,7 +122,19 @@ void radio_esp8266_setup(void)
while (!radio_esp8266_activity || !radio_esp8266_success) { // wait for response
__WFI(); // sleep until something happened
}
radio_esp8266_transmit((uint8_t*)"AT+RST\r\n", 8); // reset module
radio_esp8266_transmit_at("E0"); // disable echoing
while (!radio_esp8266_activity || !radio_esp8266_success) { // wait for response
__WFI(); // sleep until something happened
}
}
void radio_esp8266_reset(void)
{
radio_esp8266_transmit_at("+RST"); // reset module
while (!radio_esp8266_activity || !radio_esp8266_success) { // wait for response
__WFI(); // sleep until something happened
}
radio_esp8266_transmit_at("E0"); // disable echoing
while (!radio_esp8266_activity || !radio_esp8266_success) { // wait for response
__WFI(); // sleep until something happened
}

View File

@ -20,6 +20,8 @@ extern uint16_t radio_esp8266_received_len;
* @note this is blocking to ensure we are connected to the WiFi network
*/
void radio_esp8266_setup(void);
/** reset ESP */
void radio_esp8266_reset(void);
/** establish TCP connection
* @param[in] host host to connect to
* @param[in] port TCP port to connect to