From a5ce13699896f7d9328d76fec1c99778bb5dd631 Mon Sep 17 00:00:00 2001 From: mculover666 <2412828003@qq.com> Date: Tue, 11 Aug 2020 19:22:40 +0800 Subject: [PATCH] add deinit func in esp8266 driver --- devices/esp8266/esp8266.c | 15 +++++++++++++++ devices/esp8266/esp8266.h | 2 ++ 2 files changed, 17 insertions(+) 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__ */