Skip to content
This repository was archived by the owner on Feb 9, 2022. It is now read-only.

Commit a8e73dd

Browse files
authored
Add patch for Ethernet2 library
Add patch for Ethernet2 library to provide link status function link(), similar to Ethernet3
1 parent 7e9fcc4 commit a8e73dd

File tree

6 files changed

+2364
-0
lines changed

6 files changed

+2364
-0
lines changed

LibraryPatches/Ethernet2/src/Ethernet2.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,21 @@ int EthernetClass::maintain(){
210210
return rc;
211211
}
212212

213+
// KH add to report link status
214+
uint8_t EthernetClass::link()
215+
{
216+
return bitRead(w5500.getPHYCFGR(), 0);
217+
}
218+
219+
const char* EthernetClass::linkReport()
220+
{
221+
if (bitRead(w5500.getPHYCFGR(), 0) == 1)
222+
return "LINK";
223+
else
224+
return "NO LINK";
225+
}
226+
//////
227+
213228
IPAddress EthernetClass::localIP()
214229
{
215230
IPAddress ret;

LibraryPatches/Ethernet2/src/Ethernet2.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ class EthernetClass {
6262
#endif
6363

6464
int maintain();
65+
66+
// KH add to report link status
67+
uint8_t link(); // returns the linkstate, 1 = linked, 0 = no link
68+
const char* linkReport(); // returns the linkstate as a string
69+
//////
6570

6671
// KH add to have similar function to Ethernet lib
6772
// Certainly we can use void macAddress(uint8_t mac[]) to read from W5x00.

0 commit comments

Comments
 (0)