1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

cpu/esp8266/esp_wifi: move gnrc specific code to separate file

This commit is contained in:
Gunar Schorcht 2019-12-16 17:12:28 +01:00
parent 058c710cba
commit e4be9b4b36
2 changed files with 52 additions and 20 deletions

View File

@ -0,0 +1,52 @@
/*
* Copyright (C) 2019 Gunar Schorcht
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup cpu_esp8266_esp_wifi
* @{
*
* @file
* @brief GNRC network interface part for ESP8266 WiFi interface
*
* @author Gunar Schorcht <gunar@schorcht.net>
*/
#if defined(MODULE_ESP_WIFI) && defined(MODULE_GNRC_NETIF_ETHERNET)
#include "esp_wifi_params.h"
#include "esp_wifi_netdev.h"
#include "net/gnrc/netif/ethernet.h"
/** the only ESP WiFi device */
extern esp_wifi_netdev_t _esp_wifi_dev;
/** device thread stack */
static char _esp_wifi_stack[ESP_WIFI_STACKSIZE];
/** setup function for the ESP WiFi */
extern void esp_wifi_setup (esp_wifi_netdev_t* dev);
void auto_init_esp_wifi (void)
{
esp_wifi_setup(&_esp_wifi_dev);
gnrc_netif_ethernet_create(_esp_wifi_stack, ESP_WIFI_STACKSIZE,
#ifdef MODULE_ESP_NOW
ESP_WIFI_PRIO - 1,
#else
ESP_WIFI_PRIO,
#endif
"netif-esp-wifi",
(netdev_t *)&_esp_wifi_dev);
}
#else /* defined(MODULE_ESP_WIFI) && defined(MODULE_GNRC_NETIF_ETHERNET) */
typedef int dont_be_pedantic;
#endif /* defined(MODULE_ESP_WIFI) && defined(MODULE_GNRC_NETIF_ETHERNET) */
/**@}*/

View File

@ -104,9 +104,6 @@
esp_wifi_netdev_t _esp_wifi_dev;
static const netdev_driver_t _esp_wifi_driver;
/* device thread stack */
static char _esp_wifi_stack[ESP_WIFI_STACKSIZE];
/** guard variable to avoid reentrance to _esp_wifi_send function */
static bool _esp_wifi_send_is_in = false;
@ -823,22 +820,5 @@ void esp_wifi_setup (esp_wifi_netdev_t* dev)
dev->event_conn = 0;
dev->event_disc = 0;
}
void auto_init_esp_wifi (void)
{
ESP_WIFI_DEBUG("initializing ESP WiFi device");
esp_wifi_setup(&_esp_wifi_dev);
_esp_wifi_dev.netif = gnrc_netif_ethernet_create(_esp_wifi_stack,
ESP_WIFI_STACKSIZE,
#ifdef MODULE_ESP_NOW
ESP_WIFI_PRIO - 1,
#else
ESP_WIFI_PRIO,
#endif
"esp_wifi",
(netdev_t *)&_esp_wifi_dev);
}
#endif /* MODULE_ESP_WIFI */
/**@}*/