1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-27 18:02:17 +03:00

PHY status API for ethernet drivers (#8784)

* PHY status API for W5500 & ENC28J60 drivers
* move linkStatus() from ArduinoEthernet:: to LwipIntfDev::
* LwipIntfDev: include PHY status into ::connected()
This commit is contained in:
david gauchard
2023-01-05 09:23:57 +01:00
committed by GitHub
parent c9f90a3ed3
commit 7cfb551f90
7 changed files with 112 additions and 17 deletions

View File

@ -52,6 +52,8 @@ void loop() {
Serial.print(':');
Serial.println(port);
Serial.printf("Link sense: %d (detectable: %d)\n", eth.isLinked(), eth.isLinkDetectable());
// Use WiFiClient class to create TCP connections
// (this class could have been named TCPClient)
WiFiClient client;

View File

@ -10,13 +10,6 @@ using EthernetUDP = WiFiUDP;
using EthernetClient = WiFiClient;
using EthernetServer = ArduinoWiFiServer;
enum EthernetLinkStatus
{
Unknown,
LinkON,
LinkOFF
};
enum
{
DHCP_CHECK_NONE = 0,
@ -40,7 +33,6 @@ public:
LwipIntfDev<RawDev>(cs, spi, intr)
{
_hardwareStatus = EthernetNoHardware;
_linkStatus = Unknown;
}
// Arduino-Ethernet API compatibility, order can be either:
@ -70,7 +62,6 @@ public:
if (ret)
{
_hardwareStatus = EthernetHardwareFound;
_linkStatus = LinkON;
}
return ret;
@ -81,19 +72,13 @@ public:
return _hardwareStatus;
}
EthernetLinkStatus linkStatus() const
{
return _linkStatus;
}
int maintain() const
{
return DHCP_CHECK_NONE;
}
protected:
HardwareStatus _hardwareStatus;
EthernetLinkStatus _linkStatus;
HardwareStatus _hardwareStatus;
};
using ArduinoWiznet5500lwIP = ArduinoEthernet<Wiznet5500>;