2017-09-27 22:59:49 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the MicroPython project, http://micropython.org/
|
|
|
|
*
|
|
|
|
* The MIT License (MIT)
|
|
|
|
*
|
|
|
|
* Copyright (c) 2017 "Eric Poulsen" <eric@zyxod.com>
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
#ifndef MICROPY_INCLUDED_ESP32_MODNETWORK_H
|
|
|
|
#define MICROPY_INCLUDED_ESP32_MODNETWORK_H
|
|
|
|
|
2021-09-21 15:35:46 +01:00
|
|
|
#include "esp_event.h"
|
|
|
|
|
2023-01-13 05:04:07 +00:00
|
|
|
enum { PHY_LAN8710, PHY_LAN8720, PHY_IP101, PHY_RTL8201, PHY_DP83848, PHY_KSZ8041, PHY_KSZ8851SNL = 100, PHY_DM9051, PHY_W5500 };
|
|
|
|
#define IS_SPI_PHY(NUM) (NUM >= 100)
|
2021-04-18 20:38:36 +01:00
|
|
|
enum { ETH_INITIALIZED, ETH_STARTED, ETH_STOPPED, ETH_CONNECTED, ETH_DISCONNECTED, ETH_GOT_IP };
|
2017-09-27 22:59:49 +01:00
|
|
|
|
2021-09-21 15:35:46 +01:00
|
|
|
// 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);
|
2017-09-27 22:59:49 +01:00
|
|
|
MP_DECLARE_CONST_FUN_OBJ_KW(get_lan_obj);
|
2018-05-16 22:35:21 +01:00
|
|
|
MP_DECLARE_CONST_FUN_OBJ_1(ppp_make_new_obj);
|
2017-09-27 22:59:49 +01:00
|
|
|
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(esp_ifconfig_obj);
|
2019-08-27 18:11:03 +01:00
|
|
|
MP_DECLARE_CONST_FUN_OBJ_KW(esp_config_obj);
|
2017-09-27 22:59:49 +01:00
|
|
|
|
2021-09-21 15:35:46 +01:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-27 14:53:45 +01:00
|
|
|
void usocket_events_deinit(void);
|
2021-09-21 15:35:46 +01:00
|
|
|
void network_wlan_event_handler(system_event_t *event);
|
2018-04-27 14:53:45 +01:00
|
|
|
|
2017-09-27 22:59:49 +01:00
|
|
|
#endif
|