Skip to content

Commit 7bce7fc

Browse files
authoredJun 15, 2021
Merge pull request #258 from pennam/wifi-wdog-feed
Add API to WiFi class to configure wdog feed function
2 parents 2f95bc3 + 28bae3e commit 7bce7fc

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed
 

‎libraries/WiFi/src/WiFi.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,18 @@ unsigned long arduino::WiFiClass::getTime() {
314314
return 0;
315315
}
316316

317+
void arduino::WiFiClass::setFeedWatchdogFunc(ArduinoPortentaH7WiFiFeedWatchdogFuncPtr func)
318+
{
319+
_feed_watchdog_func = func;
320+
}
321+
322+
void arduino::WiFiClass::feedWatchdog()
323+
{
324+
if (_feed_watchdog_func)
325+
_feed_watchdog_func();
326+
}
327+
328+
317329
#if defined(COMPONENT_4343W)
318330

319331
#include "QSPIFBlockDevice.h"

‎libraries/WiFi/src/WiFi.h

+7
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,12 @@ extern "C" {
4949
#define DEFAULT_AP_CHANNEL 6
5050
#endif
5151

52+
#define ARDUINO_PORTENTA_H7_WIFI_HAS_FEED_WATCHDOG_FUNC
53+
5254
namespace arduino {
5355

5456
typedef void* (*voidPrtFuncPtr)(void);
57+
typedef void (*ArduinoPortentaH7WiFiFeedWatchdogFuncPtr)(void);
5558

5659
class WiFiClass
5760
{
@@ -296,6 +299,9 @@ class WiFiClass
296299

297300
NetworkInterface *getNetwork();
298301

302+
void setFeedWatchdogFunc(ArduinoPortentaH7WiFiFeedWatchdogFuncPtr func);
303+
void feedWatchdog();
304+
299305
private:
300306

301307
EMACInterface* _softAP = nullptr;
@@ -316,6 +322,7 @@ class WiFiClass
316322
bool isVisible(const char* ssid);
317323
arduino::IPAddress ipAddressFromSocketAddress(SocketAddress socketAddress);
318324
SocketAddress socketAddressFromIpAddress(arduino::IPAddress ip, uint16_t port);
325+
ArduinoPortentaH7WiFiFeedWatchdogFuncPtr _feed_watchdog_func = 0;
319326
};
320327

321328
}

‎libraries/WiFi/src/WiFiHelpers.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ static FILE* target;
2323

2424
void body_callback(const char* data, uint32_t data_len)
2525
{
26+
WiFi.feedWatchdog();
2627
fwrite(data, 1, data_len, target);
2728
}
2829

0 commit comments

Comments
 (0)
Please sign in to comment.