-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Added support for W5500 via. esp_netif_t
interface.
#7163
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
Closed
Closed
Changes from 9 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c19cbd2
Added support for W5500 via. esp netif interface.
OekoSolveMG 64404ba
Added example for new begin method.
OekoSolveMG d3e5932
Added HttpsOTAUpdate over Ethernet with example.
OekoSolveMG 299733f
Merge branch 'master' into feat_w5500_netif
OekoSolveMG 3495e73
Fixed include statement.
OekoSolveMG a643341
Added another optional argument for stack size.
OekoSolveMG d143ca2
Fixed incorrect comment.
OekoSolveMG 8f2a4b2
Added additional optional parameters.
OekoSolveMG 8a91e51
Attempt to fix spi driver not blocking semaphore.
OekoSolveMG 51c20de
Removed not needed defines.
OekoSolveMG f255679
Merge branch 'master' into feat_w5500_netif
OekoSolveMG f4d3314
Adjusted examples.
OekoSolveMG 84561ad
Merge branch 'master' into feat_w5500_netif
OekoSolveMG 4db899b
Merge branch 'espressif:master' into feat_w5500_netif
OekoSolveMG File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* | ||
This sketch shows the Ethernet event usage | ||
|
||
*/ | ||
|
||
#include <ETH.h> | ||
|
||
#define MOSI_GPIO 23 | ||
#define MISO_GPIO 38 | ||
#define SCLK_GPIO 18 | ||
#define CS_GPIO 26 | ||
#define INT_GPIO 34 | ||
#define PHY_RST_GPIO 19 | ||
|
||
static bool eth_connected = false; | ||
|
||
void WiFiEvent(WiFiEvent_t event) | ||
{ | ||
switch (event) { | ||
case ARDUINO_EVENT_ETH_START: | ||
Serial.println("ETH Started"); | ||
//set eth hostname here | ||
ETH.setHostname("esp32-ethernet"); | ||
break; | ||
case ARDUINO_EVENT_ETH_CONNECTED: | ||
Serial.println("ETH Connected"); | ||
break; | ||
case ARDUINO_EVENT_ETH_GOT_IP: | ||
Serial.print("ETH MAC: "); | ||
Serial.print(ETH.macAddress()); | ||
Serial.print(", IPv4: "); | ||
Serial.print(ETH.localIP()); | ||
if (ETH.fullDuplex()) { | ||
Serial.print(", FULL_DUPLEX"); | ||
} | ||
Serial.print(", "); | ||
Serial.print(ETH.linkSpeed()); | ||
Serial.println("Mbps"); | ||
eth_connected = true; | ||
break; | ||
case ARDUINO_EVENT_ETH_DISCONNECTED: | ||
Serial.println("ETH Disconnected"); | ||
eth_connected = false; | ||
break; | ||
case ARDUINO_EVENT_ETH_STOP: | ||
Serial.println("ETH Stopped"); | ||
eth_connected = false; | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
|
||
void testClient(const char * host, uint16_t port) | ||
{ | ||
Serial.print("\nconnecting to "); | ||
Serial.println(host); | ||
|
||
WiFiClient client; | ||
if (!client.connect(host, port)) { | ||
Serial.println("connection failed"); | ||
return; | ||
} | ||
client.printf("GET / HTTP/1.1\r\nHost: %s\r\n\r\n", host); | ||
while (client.connected() && !client.available()); | ||
while (client.available()) { | ||
Serial.write(client.read()); | ||
} | ||
|
||
Serial.println("closing connection\n"); | ||
client.stop(); | ||
} | ||
|
||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
WiFi.onEvent(WiFiEvent); | ||
|
||
std::array<uint8_t, 6U> mac_address; | ||
WiFi.macAddress(mac_address.data()); | ||
ETH.begin_w5500(mac_address.data(), MOSI_GPIO, MISO_GPIO, SCLK_GPIO, CS_GPIO, INT_GPIO, PHY_RST_GPIO); | ||
} | ||
|
||
|
||
void loop() | ||
{ | ||
if (eth_connected) { | ||
testClient("google.com", 80); | ||
} | ||
delay(10000); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.