23
23
24
24
#define MAX_SOFTAP_CONNECTION_DEF 5
25
25
26
+ #if defined(SPIWIFI_ACK) // Arduino Nano RP2040 Connect
27
+ #define ESPHOST_DATA_READY SPIWIFI_ACK
28
+ #endif
29
+
26
30
bool ESPHostLwIP::wifiHwInitialized = false ;
27
31
ESPHostLwIP* ESPHostLwIP::instance = nullptr ;
28
32
33
+ ESPHostLwIP::ESPHostLwIP () :
34
+ LwipIntfDev<ESPHost>(SS, SPI, ESPHOST_DATA_READY) {
35
+
36
+ }
37
+
29
38
void ESPHostLwIP::setSTA () {
30
39
apMode = false ;
31
40
}
@@ -122,7 +131,7 @@ bool ESPHostLwIP::begin() {
122
131
if (!initHW ()) {
123
132
return false ;
124
133
}
125
- ethernet_arch_lwip_begin ();
134
+ ethernet_arch_lwip_gpio_mask ();
126
135
if (!apMode) {
127
136
CEspControl::getInstance ().setWifiMode (WIFI_MODE_STA);
128
137
if (CEspControl::getInstance ().connectAccessPoint (ap) != ESP_CONTROL_OK) {
@@ -148,18 +157,18 @@ bool ESPHostLwIP::begin() {
148
157
}
149
158
CEspControl::getInstance ().getSoftAccessPointConfig (softAP);
150
159
}
151
- ethernet_arch_lwip_end ();
160
+ ethernet_arch_lwip_gpio_unmask ();
152
161
uint8_t mac[6 ];
153
162
if (!LwipIntfDev<ESPHost>::begin (macAddress (apMode, mac))) {
154
- ethernet_arch_lwip_begin ();
163
+ ethernet_arch_lwip_gpio_mask ();
155
164
if (apMode) {
156
165
CEspControl::getInstance ().stopSoftAccessPoint ();
157
166
wifiStatus = WL_AP_FAILED;
158
167
} else {
159
168
CEspControl::getInstance ().disconnectAccessPoint ();
160
169
wifiStatus = WL_CONNECT_FAILED;
161
170
}
162
- ethernet_arch_lwip_end ();
171
+ ethernet_arch_lwip_gpio_unmask ();
163
172
return false ;
164
173
}
165
174
if (apMode) {
@@ -206,11 +215,11 @@ uint8_t* ESPHostLwIP::macAddress(bool apMode, uint8_t *mac) {
206
215
}
207
216
WifiMac_t MAC;
208
217
MAC.mode = apMode ? WIFI_MODE_AP : WIFI_MODE_STA;
209
- ethernet_arch_lwip_begin ();
218
+ ethernet_arch_lwip_gpio_mask ();
210
219
if (CEspControl::getInstance ().getWifiMacAddress (MAC) == ESP_CONTROL_OK) {
211
220
CNetUtilities::macStr2macArray (mac, MAC.mac );
212
221
}
213
- ethernet_arch_lwip_end ();
222
+ ethernet_arch_lwip_gpio_unmask ();
214
223
return mac;
215
224
}
216
225
@@ -227,9 +236,9 @@ int32_t ESPHostLwIP::RSSI() {
227
236
if (!joined) {
228
237
return 0 ;
229
238
}
230
- ethernet_arch_lwip_begin ();
239
+ ethernet_arch_lwip_gpio_mask ();
231
240
CEspControl::getInstance ().getAccessPointConfig (ap);
232
- ethernet_arch_lwip_end ();
241
+ ethernet_arch_lwip_gpio_unmask ();
233
242
return ap.rssi ;
234
243
}
235
244
@@ -264,9 +273,9 @@ int8_t ESPHostLwIP::scanNetworks(bool async) {
264
273
if (!initHW ()) {
265
274
return -1 ;
266
275
}
267
- ethernet_arch_lwip_begin ();
276
+ ethernet_arch_lwip_gpio_mask ();
268
277
int res = CEspControl::getInstance ().getAccessPointScanList (accessPoints);
269
- ethernet_arch_lwip_end ();
278
+ ethernet_arch_lwip_gpio_unmask ();
270
279
wifiStatus = WL_SCAN_COMPLETED;
271
280
if (res != ESP_CONTROL_OK) {
272
281
return -1 ;
@@ -321,9 +330,9 @@ void ESPHostLwIP::lowPowerMode() {
321
330
if (!initHW ()) {
322
331
return ;
323
332
}
324
- ethernet_arch_lwip_begin ();
333
+ ethernet_arch_lwip_gpio_mask ();
325
334
CEspControl::getInstance ().setPowerSaveMode (1 );
326
- ethernet_arch_lwip_end ();
335
+ ethernet_arch_lwip_gpio_unmask ();
327
336
}
328
337
329
338
void ESPHostLwIP::noLowPowerMode () {
0 commit comments