From 1a84cd582093c11f58b81f2eed2003e264e24c9d Mon Sep 17 00:00:00 2001 From: Chris Snow Date: Thu, 17 Oct 2024 21:00:26 +0100 Subject: [PATCH] Resolve header issues --- .../COMPONENT_ESPRESSIF_ESP32/ESP32/ESP32.h | 19 +------------------ .../ESP32Interface.cpp | 8 +++++--- .../ESP32Interface.h | 1 - .../ESP32InterfaceAP.h | 3 +-- .../COMPONENT_ESPRESSIF_ESP32/ESP32Stack.h | 6 +++++- 5 files changed, 12 insertions(+), 25 deletions(-) diff --git a/connectivity/drivers/wifi/COMPONENT_ESPRESSIF_ESP32/ESP32/ESP32.h b/connectivity/drivers/wifi/COMPONENT_ESPRESSIF_ESP32/ESP32/ESP32.h index e6460dd4b7e..b424c80ed86 100644 --- a/connectivity/drivers/wifi/COMPONENT_ESPRESSIF_ESP32/ESP32/ESP32.h +++ b/connectivity/drivers/wifi/COMPONENT_ESPRESSIF_ESP32/ESP32/ESP32.h @@ -19,26 +19,13 @@ #define ESP32_H #if DEVICE_SERIAL && defined(MBED_CONF_EVENTS_PRESENT) && defined(MBED_CONF_NSAPI_PRESENT) && defined(MBED_CONF_RTOS_PRESENT) -#include -#include -#include + #include "drivers/DigitalOut.h" -#include "drivers/SerialBase.h" #include "netsocket/nsapi_types.h" #include "netsocket/WiFiAccessPoint.h" -#include "PinNames.h" #include "platform/ATCmdParser.h" -#include "platform/Callback.h" -#include "platform/mbed_error.h" -#include "platform/mbed_version.h" -#include "rtos/Mutex.h" #include "rtos/ThisThread.h" - -#if (MBED_MAJOR_VERSION < 6) -#include "drivers/UARTSerial.h" -#else #include "drivers/BufferedSerial.h" -#endif #ifndef ESP32_CONNECT_TIMEOUT #define ESP32_CONNECT_TIMEOUT 15000 @@ -275,11 +262,7 @@ class ESP32 mbed::DigitalOut * _p_wifi_io0; bool _init_end_common; bool _init_end_wifi; -#if (MBED_MAJOR_VERSION < 6) - mbed::UARTSerial _serial; -#else mbed::BufferedSerial _serial; -#endif mbed::ATCmdParser _parser; struct packet { struct packet *next; diff --git a/connectivity/drivers/wifi/COMPONENT_ESPRESSIF_ESP32/ESP32Interface.cpp b/connectivity/drivers/wifi/COMPONENT_ESPRESSIF_ESP32/ESP32Interface.cpp index f9755736361..45e1fad368e 100644 --- a/connectivity/drivers/wifi/COMPONENT_ESPRESSIF_ESP32/ESP32Interface.cpp +++ b/connectivity/drivers/wifi/COMPONENT_ESPRESSIF_ESP32/ESP32Interface.cpp @@ -17,6 +17,8 @@ #include #include "ESP32Interface.h" +using namespace std::chrono_literals; + // ESP32Interface implementation ESP32Interface::ESP32Interface() : ESP32Stack(MBED_CONF_ESP32_WIFI_EN, MBED_CONF_ESP32_WIFI_IO0, MBED_CONF_ESP32_WIFI_TX, MBED_CONF_ESP32_WIFI_RX, MBED_CONF_ESP32_WIFI_DEBUG, @@ -34,7 +36,7 @@ ESP32Interface::ESP32Interface() : _connection_status_cb(NULL) { memset(_ap_ssid, 0, sizeof(_ap_ssid)); - _esp->attach_wifi_status(callback(this, &ESP32Interface::wifi_status_cb)); + _esp->attach_wifi_status(mbed::callback(this, &ESP32Interface::wifi_status_cb)); } ESP32Interface::ESP32Interface(PinName en, PinName io0, PinName tx, PinName rx, bool debug, @@ -53,7 +55,7 @@ ESP32Interface::ESP32Interface(PinName en, PinName io0, PinName tx, PinName rx, _connection_status_cb(NULL) { memset(_ap_ssid, 0, sizeof(_ap_ssid)); - _esp->attach_wifi_status(callback(this, &ESP32Interface::wifi_status_cb)); + _esp->attach_wifi_status(mbed::callback(this, &ESP32Interface::wifi_status_cb)); } ESP32Interface::ESP32Interface(PinName tx, PinName rx, bool debug) : @@ -71,7 +73,7 @@ ESP32Interface::ESP32Interface(PinName tx, PinName rx, bool debug) : _connection_status_cb(NULL) { memset(_ap_ssid, 0, sizeof(_ap_ssid)); - _esp->attach_wifi_status(callback(this, &ESP32Interface::wifi_status_cb)); + _esp->attach_wifi_status(mbed::callback(this, &ESP32Interface::wifi_status_cb)); } nsapi_error_t ESP32Interface::set_network(const SocketAddress &ip_address, const SocketAddress &netmask, const SocketAddress &gateway) diff --git a/connectivity/drivers/wifi/COMPONENT_ESPRESSIF_ESP32/ESP32Interface.h b/connectivity/drivers/wifi/COMPONENT_ESPRESSIF_ESP32/ESP32Interface.h index d5909ce33ff..6c4c7736fb8 100644 --- a/connectivity/drivers/wifi/COMPONENT_ESPRESSIF_ESP32/ESP32Interface.h +++ b/connectivity/drivers/wifi/COMPONENT_ESPRESSIF_ESP32/ESP32Interface.h @@ -17,7 +17,6 @@ #ifndef ESP32_INTERFACE_H #define ESP32_INTERFACE_H -#include "mbed.h" #include "ESP32Stack.h" /** ESP32Interface class diff --git a/connectivity/drivers/wifi/COMPONENT_ESPRESSIF_ESP32/ESP32InterfaceAP.h b/connectivity/drivers/wifi/COMPONENT_ESPRESSIF_ESP32/ESP32InterfaceAP.h index 8a6aecf4002..de0ce2aec88 100644 --- a/connectivity/drivers/wifi/COMPONENT_ESPRESSIF_ESP32/ESP32InterfaceAP.h +++ b/connectivity/drivers/wifi/COMPONENT_ESPRESSIF_ESP32/ESP32InterfaceAP.h @@ -17,7 +17,6 @@ #ifndef ESP32_INTERFACE_AP_H #define ESP32_INTERFACE_AP_H -#include "mbed.h" #include "ESP32Stack.h" @@ -253,7 +252,7 @@ class ESP32InterfaceAP : public ESP32Stack, public WiFiInterface SocketAddress _netmask; SocketAddress _gateway; nsapi_connection_status_t _connection_status; - Callback _connection_status_cb; + mbed::Callback _connection_status_cb; }; #endif diff --git a/connectivity/drivers/wifi/COMPONENT_ESPRESSIF_ESP32/ESP32Stack.h b/connectivity/drivers/wifi/COMPONENT_ESPRESSIF_ESP32/ESP32Stack.h index e3d8a67f633..3848fb44b52 100644 --- a/connectivity/drivers/wifi/COMPONENT_ESPRESSIF_ESP32/ESP32Stack.h +++ b/connectivity/drivers/wifi/COMPONENT_ESPRESSIF_ESP32/ESP32Stack.h @@ -18,8 +18,12 @@ #ifndef ESP32_STACK_H #define ESP32_STACK_H -#include "mbed.h" + #include "ESP32.h" +#include "netsocket/NetworkInterface.h" +#include "netsocket/NetworkStack.h" +#include "netsocket/nsapi_types.h" +#include "netsocket/WiFiInterface.h" /** ESP32Stack class * Implementation of the NetworkStack for the ESP32