diff --git a/devices/esp8266/esp8266.c b/devices/esp8266/esp8266.c index bfbc1c4e..732700c3 100644 --- a/devices/esp8266/esp8266.c +++ b/devices/esp8266/esp8266.c @@ -475,3 +475,18 @@ int esp8266_sal_init(hal_uart_port_t uart_port) return 0; } +int esp8266_sal_deinit() +{ + int id = 0; + + for (id = 0; id < AT_DATA_CHANNEL_NUM; ++id) { + tos_sal_module_close(id); + } + + tos_sal_module_register_default(); + + tos_at_deinit(); + + return 0; +} + diff --git a/devices/esp8266/esp8266.h b/devices/esp8266/esp8266.h index c5add3f9..2e8370a7 100644 --- a/devices/esp8266/esp8266.h +++ b/devices/esp8266/esp8266.h @@ -40,5 +40,7 @@ int esp8266_sal_init(hal_uart_port_t uart_port); int esp8266_join_ap(const char *ssid, const char *pwd); +int esp8266_sal_deinit(void); + #endif /* __ESP8266_H__ */