Commit ea186de4 authored by Damien George's avatar Damien George

esp32: Split out WLAN code from modnetwork.c to network_wlan.c.

To match network_lan.c and network_ppp.c, and make it clear what code is
specifically for WLAN support.

Also provide a configuration option MICROPY_PY_NETWORK_WLAN which can be
used to fully disable network.WLAN (it's enabled by default).
Signed-off-by: default avatarDamien George <damien@micropython.org>
parent f046b50c
......@@ -67,6 +67,7 @@ set(MICROPY_SOURCE_PORT
${PROJECT_DIR}/modnetwork.c
${PROJECT_DIR}/network_lan.c
${PROJECT_DIR}/network_ppp.c
${PROJECT_DIR}/network_wlan.c
${PROJECT_DIR}/mpnimbleport.c
${PROJECT_DIR}/modsocket.c
${PROJECT_DIR}/modesp.c
......
This diff is collapsed.
......@@ -26,14 +26,39 @@
#ifndef MICROPY_INCLUDED_ESP32_MODNETWORK_H
#define MICROPY_INCLUDED_ESP32_MODNETWORK_H
#include "esp_event.h"
enum { PHY_LAN8720, PHY_IP101, PHY_RTL8201, PHY_DP83848, PHY_KSZ8041 };
enum { ETH_INITIALIZED, ETH_STARTED, ETH_STOPPED, ETH_CONNECTED, ETH_DISCONNECTED, ETH_GOT_IP };
// Cases similar to ESP8266 user_interface.h
// Error cases are referenced from wifi_err_reason_t in ESP-IDF
enum {
STAT_IDLE = 1000,
STAT_CONNECTING = 1001,
STAT_GOT_IP = 1010,
};
typedef struct _wlan_if_obj_t {
mp_obj_base_t base;
int if_id;
} wlan_if_obj_t;
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(get_wlan_obj);
MP_DECLARE_CONST_FUN_OBJ_KW(get_lan_obj);
MP_DECLARE_CONST_FUN_OBJ_1(ppp_make_new_obj);
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(esp_ifconfig_obj);
MP_DECLARE_CONST_FUN_OBJ_KW(esp_config_obj);
NORETURN void esp_exceptions_helper(esp_err_t e);
static inline void esp_exceptions(esp_err_t e) {
if (e != ESP_OK) {
esp_exceptions_helper(e);
}
}
void usocket_events_deinit(void);
void network_wlan_event_handler(system_event_t *event);
#endif
......@@ -174,6 +174,9 @@
#ifndef MICROPY_PY_MACHINE_I2S
#define MICROPY_PY_MACHINE_I2S (1)
#endif
#ifndef MICROPY_PY_NETWORK_WLAN
#define MICROPY_PY_NETWORK_WLAN (1)
#endif
#ifndef MICROPY_HW_ENABLE_SDCARD
#define MICROPY_HW_ENABLE_SDCARD (1)
#endif
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment