Skip to content

Commit

Permalink
Add default values for ethernet pins in case they are not defined for…
Browse files Browse the repository at this point in the history
… a specific board
  • Loading branch information
tbnobody committed Sep 27, 2024
1 parent b433830 commit b85e0ab
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/PinMapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,30 @@
#define W5500_RST -1
#endif

#ifndef ETH_PHY_ADDR
#define ETH_PHY_ADDR -1
#endif

#ifndef ETH_PHY_POWER
#define ETH_PHY_POWER -1
#endif

#ifndef ETH_PHY_MDC
#define ETH_PHY_MDC -1
#endif

#ifndef ETH_PHY_MDIO
#define ETH_PHY_MDIO -1
#endif

#ifndef ETH_PHY_TYPE
#define ETH_PHY_TYPE ETH_PHY_LAN8720
#endif

#ifndef ETH_CLK_MODE
#define ETH_CLK_MODE ETH_CLOCK_GPIO0_IN
#endif

PinMappingClass PinMapping;

PinMappingClass::PinMappingClass()
Expand Down Expand Up @@ -261,5 +285,7 @@ bool PinMappingClass::isValidW5500Config() const

bool PinMappingClass::isValidEthConfig() const
{
return _pinMapping.eth_enabled;
return _pinMapping.eth_enabled
&& _pinMapping.eth_mdc >= 0
&& _pinMapping.eth_mdio >= 0;
}

0 comments on commit b85e0ab

Please sign in to comment.