mirror of
https://github.com/micropython/micropython.git
synced 2026-01-06 12:10:13 +01:00
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: Damien George <damien@micropython.org>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user