Skip to content

Add API to WiFi class to configure wdog feed function #258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions libraries/WiFi/src/WiFi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,18 @@ unsigned long arduino::WiFiClass::getTime() {
return 0;
}

void arduino::WiFiClass::setFeedWatchdogFunc(voidPrtFuncPtr func)
{
_feed_watchdog_func = func;
}

void arduino::WiFiClass::feedWatchdog()
{
if (_feed_watchdog_func)
_feed_watchdog_func();
}


#if defined(COMPONENT_4343W)

#include "QSPIFBlockDevice.h"
Expand Down
6 changes: 6 additions & 0 deletions libraries/WiFi/src/WiFi.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ extern "C" {
#define DEFAULT_AP_CHANNEL 6
#endif

#define WIFI_HAS_FEED_WATCHDOG_FUNC
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use a more unique name, e.g. ARDUINO_PORTENTA_H7_WIFI_HAS_FEED_WATCHDOG_FUNC

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed with 28bae3e


namespace arduino {

typedef void* (*voidPrtFuncPtr)(void);
Expand Down Expand Up @@ -296,6 +298,9 @@ class WiFiClass

NetworkInterface *getNetwork();

void setFeedWatchdogFunc(voidPrtFuncPtr func);
void feedWatchdog();

private:

EMACInterface* _softAP = nullptr;
Expand All @@ -316,6 +321,7 @@ class WiFiClass
bool isVisible(const char* ssid);
arduino::IPAddress ipAddressFromSocketAddress(SocketAddress socketAddress);
SocketAddress socketAddressFromIpAddress(arduino::IPAddress ip, uint16_t port);
voidPrtFuncPtr _feed_watchdog_func = 0;
};

}
Expand Down
1 change: 1 addition & 0 deletions libraries/WiFi/src/WiFiHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ static FILE* target;

void body_callback(const char* data, uint32_t data_len)
{
WiFi.feedWatchdog();
fwrite(data, 1, data_len, target);
}

Expand Down