/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2022-10-25     theo         the first version
 */

#include <gpio.h>
#include <wifi-latest/dev_esp8266.h>
#include <sys.h>

#ifdef DEV_USING_ESP8266_WIFI
/* ESP8266 Initialization */
void esp8266_init(void)
{
    /* 配置WIFI管脚为推挽输出模式 */
    rt_pin_mode(WIFI_RST_PIN, PIN_MODE_OUTPUT);
    rt_pin_mode(WIFI_SET_PIN, PIN_MODE_OUTPUT);

    /* 默认状态 */
    WIFI_RST_H;
    WIFI_SET_H;
}

/* ESP8266 reset */
void esp8266_reset(void)
{
    /* 配置WIFI管脚为推挽输出模式 */
    rt_pin_mode(WIFI_RST_PIN, PIN_MODE_OUTPUT);
    rt_pin_mode(WIFI_SET_PIN, PIN_MODE_OUTPUT);

    /* 状态设置 */
    WIFI_RST_L;
    rt_thread_delay(200);
    WIFI_RST_H;
    WIFI_SET_H;
}

#endif

/* 参考:
 * https://blog.csdn.net/Davidysw/article/details/105838779?ops_request_misc=&request_id=&biz_id=102&utm_term=rt-thread%20%E6%9C%8D%E5%8A%A1%E5%99%A8&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-5-105838779.142^v59^pc_rank_34_1,201^v3^control_1
 */
