Initial Commit

This commit is contained in:
me-no-dev
2020-05-09 19:11:30 +03:00
parent ebe0d9a6cb
commit 0a262244e6
4324 changed files with 645232 additions and 253864 deletions

View File

@ -147,17 +147,19 @@ bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_typ
esp_event_handler_register(ETH_EVENT, ESP_EVENT_ANY_ID, eth_event_handler, this);
//ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, IP_EVENT_ETH_GOT_IP, &got_ip_event_handler, NULL));
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
mac_config.smi_mdc_gpio_num = mdc;
mac_config.smi_mdio_gpio_num = mdio;
//mac_config.sw_reset_timeout_ms = 1000;
esp_eth_mac_t *eth_mac = NULL;
#if CONFIG_ETH_SPI_ETHERNET_DM9051
if(type == ETH_PHY_DM9051){
return false;//todo
} else {
#endif
#if CONFIG_ETH_USE_ESP32_EMAC
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
mac_config.smi_mdc_gpio_num = mdc;
mac_config.smi_mdio_gpio_num = mdio;
//mac_config.sw_reset_timeout_ms = 1000;
eth_mac = esp_eth_mac_new_esp32(&mac_config);
#endif
#if CONFIG_ETH_SPI_ETHERNET_DM9051
}
#endif

View File

@ -32,7 +32,7 @@ extern "C" {
#include <string.h>
#include <esp_err.h>
#include <esp_wifi.h>
#include <esp_event_loop.h>
#include <esp_event.h>
}

View File

@ -35,7 +35,7 @@ extern "C" {
#include <string.h>
#include <esp_err.h>
#include <esp_wifi.h>
#include <esp_event_loop.h>
#include <esp_event.h>
#include <lwip/ip_addr.h>
#include "dhcpserver/dhcpserver_options.h"
}
@ -166,8 +166,8 @@ bool WiFiAPClass::softAPConfig(IPAddress local_ip, IPAddress gateway, IPAddress
lease.end_ip.addr = static_cast<uint32_t>(local_ip) + (11 << 24);
tcpip_adapter_dhcps_option(
(tcpip_adapter_option_mode_t)TCPIP_ADAPTER_OP_SET,
(tcpip_adapter_option_id_t)REQUESTED_IP_ADDRESS,
(tcpip_adapter_dhcp_option_mode_t)TCPIP_ADAPTER_OP_SET,
(tcpip_adapter_dhcp_option_id_t)REQUESTED_IP_ADDRESS,
(void*)&lease, sizeof(dhcps_lease_t)
);

View File

@ -35,7 +35,7 @@ extern "C" {
#include <esp_err.h>
#include <esp_wifi.h>
#include <esp_event_loop.h>
#include <esp_event.h>
#include "lwip/ip_addr.h"
#include "lwip/opt.h"
#include "lwip/err.h"
@ -79,19 +79,19 @@ static void _network_event_task(void * arg){
_network_event_task_handle = NULL;
}
static esp_err_t _network_event_cb(void *arg, system_event_t *event){
system_prov_event_t *sys_prov_data = (system_prov_event_t *)malloc(sizeof(system_prov_event_t));
if(sys_prov_data == NULL) {
return ESP_FAIL;
static void _network_event_cb(void* arg, esp_event_base_t base, int32_t id, void* data) {
if (xQueueSend(_network_event_queue, (system_event_t *)data, portMAX_DELAY) != pdPASS) {
log_w("Network Event Queue Send Failed!");
}
sys_prov_data->sys_event = event;
sys_prov_data->prov_event = NULL;
if (postToSysQueue(sys_prov_data) != ESP_OK){
free(sys_prov_data);
return ESP_FAIL;
}
return ESP_OK;
}
// static esp_err_t _network_event_cb(void *arg, system_event_t *event){
// if (xQueueSend(_network_event_queue, event, portMAX_DELAY) != pdPASS) {
// log_w("Network Event Queue Send Failed!");
// return ESP_FAIL;
// }
// return ESP_OK;
// }
ESP_EVENT_DEFINE_BASE(SYSTEM_EVENT);
static bool _start_network_event_task(){
if(!_network_event_group){
@ -116,7 +116,14 @@ static bool _start_network_event_task(){
return false;
}
}
return esp_event_loop_init(&_network_event_cb, NULL) == ESP_OK;
esp_err_t err = esp_event_loop_create_default();
if (err != ESP_OK && err != ESP_ERR_INVALID_STATE) {
return err;
}
return esp_event_handler_register(SYSTEM_EVENT, ESP_EVENT_ANY_ID, _network_event_cb, NULL) == ESP_OK;
//return esp_event_loop_init(&_network_event_cb, NULL) == ESP_OK;
}
void tcpipInit(){
@ -130,7 +137,7 @@ void tcpipInit(){
}
esp_event_loop_create_default();
#endif
tcpip_adapter_init();
esp_netif_init();
}
}

View File

@ -24,7 +24,7 @@
#define ESP32WIFIGENERIC_H_
#include <esp_err.h>
#include <esp_event_loop.h>
#include <esp_event.h>
#include <functional>
#include "WiFiType.h"
#include "IPAddress.h"

View File

@ -35,13 +35,13 @@ extern "C" {
#include <string.h>
#include <esp_err.h>
#include <esp_wifi.h>
#include <esp_event_loop.h>
#include <esp_event.h>
#include <esp32-hal.h>
#include <lwip/ip_addr.h>
#include "lwip/err.h"
#include "lwip/dns.h"
#include <esp_smartconfig.h>
#include <tcpip_adapter.h>
#include <esp_netif.h>
}
// -----------------------------------------------------------------------------------------------------------------------

View File

@ -36,7 +36,7 @@ extern "C" {
#include <string.h>
#include <esp_err.h>
#include <esp_wifi.h>
#include <esp_event_loop.h>
#include <esp_event.h>
#include <esp32-hal.h>
#include <lwip/ip_addr.h>
#include "lwip/err.h"