Skip to content

Add WiFI.config() functionality to mbed Wifi Library #399

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 2 commits into from
Feb 7, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions libraries/WiFi/src/WiFi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ int arduino::WiFiClass::begin(const char* ssid, const char* passphrase) {
return _currentNetworkStatus;
}

//Config Wifi to set Static IP && Disable DHCP
void arduino::WiFiClass::config(const char* localip, const char* netmask, const char* gateway){
wifi_if->set_network(localip, netmask, gateway);
wifi_if->set_dhcp(false);
}

int arduino::WiFiClass::beginAP(const char* ssid, const char* passphrase, uint8_t channel) {

#if defined(COMPONENT_4343W_FS)
Expand Down
2 changes: 2 additions & 0 deletions libraries/WiFi/src/WiFi.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ class WiFiClass : public MbedSocketClass {
* must be between ASCII 32-126 (decimal).
*/
int begin(const char* ssid, const char* passphrase);

void config(const char* localip, const char* netmask, const char* gateway);

int beginAP(const char* ssid, const char* passphrase, uint8_t channel = DEFAULT_AP_CHANNEL);

Expand Down