mirror of
https://github.com/tbnobody/OpenDTU.git
synced 2025-12-13 02:09:58 +01:00
Change datatype for eth pins from int to gpio_num_t
This commit is contained in:
@@ -37,9 +37,9 @@ struct PinMapping_t {
|
|||||||
#if CONFIG_ETH_USE_ESP32_EMAC
|
#if CONFIG_ETH_USE_ESP32_EMAC
|
||||||
int8_t eth_phy_addr;
|
int8_t eth_phy_addr;
|
||||||
bool eth_enabled;
|
bool eth_enabled;
|
||||||
int eth_power;
|
gpio_num_t eth_power;
|
||||||
int eth_mdc;
|
gpio_num_t eth_mdc;
|
||||||
int eth_mdio;
|
gpio_num_t eth_mdio;
|
||||||
eth_phy_type_t eth_type;
|
eth_phy_type_t eth_type;
|
||||||
eth_clock_mode_t eth_clk_mode;
|
eth_clock_mode_t eth_clk_mode;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -116,15 +116,15 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ETH_PHY_POWER
|
#ifndef ETH_PHY_POWER
|
||||||
#define ETH_PHY_POWER -1
|
#define ETH_PHY_POWER GPIO_NUM_NC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ETH_PHY_MDC
|
#ifndef ETH_PHY_MDC
|
||||||
#define ETH_PHY_MDC -1
|
#define ETH_PHY_MDC GPIO_NUM_NC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ETH_PHY_MDIO
|
#ifndef ETH_PHY_MDIO
|
||||||
#define ETH_PHY_MDIO -1
|
#define ETH_PHY_MDIO GPIO_NUM_NC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ETH_PHY_TYPE
|
#ifndef ETH_PHY_TYPE
|
||||||
@@ -170,9 +170,9 @@ PinMappingClass::PinMappingClass()
|
|||||||
_pinMapping.eth_enabled = false;
|
_pinMapping.eth_enabled = false;
|
||||||
#endif
|
#endif
|
||||||
_pinMapping.eth_phy_addr = ETH_PHY_ADDR;
|
_pinMapping.eth_phy_addr = ETH_PHY_ADDR;
|
||||||
_pinMapping.eth_power = ETH_PHY_POWER;
|
_pinMapping.eth_power = static_cast<gpio_num_t>(ETH_PHY_POWER);
|
||||||
_pinMapping.eth_mdc = ETH_PHY_MDC;
|
_pinMapping.eth_mdc = static_cast<gpio_num_t>(ETH_PHY_MDC);
|
||||||
_pinMapping.eth_mdio = ETH_PHY_MDIO;
|
_pinMapping.eth_mdio = static_cast<gpio_num_t>(ETH_PHY_MDIO);
|
||||||
_pinMapping.eth_type = ETH_PHY_TYPE;
|
_pinMapping.eth_type = ETH_PHY_TYPE;
|
||||||
_pinMapping.eth_clk_mode = ETH_CLK_MODE;
|
_pinMapping.eth_clk_mode = ETH_CLK_MODE;
|
||||||
#endif
|
#endif
|
||||||
@@ -243,9 +243,9 @@ bool PinMappingClass::init(const String& deviceMapping)
|
|||||||
_pinMapping.eth_enabled = doc[i]["eth"]["enabled"] | false;
|
_pinMapping.eth_enabled = doc[i]["eth"]["enabled"] | false;
|
||||||
#endif
|
#endif
|
||||||
_pinMapping.eth_phy_addr = doc[i]["eth"]["phy_addr"] | ETH_PHY_ADDR;
|
_pinMapping.eth_phy_addr = doc[i]["eth"]["phy_addr"] | ETH_PHY_ADDR;
|
||||||
_pinMapping.eth_power = doc[i]["eth"]["power"] | ETH_PHY_POWER;
|
_pinMapping.eth_power = doc[i]["eth"]["power"] | static_cast<gpio_num_t>(ETH_PHY_POWER);
|
||||||
_pinMapping.eth_mdc = doc[i]["eth"]["mdc"] | ETH_PHY_MDC;
|
_pinMapping.eth_mdc = doc[i]["eth"]["mdc"] | static_cast<gpio_num_t>(ETH_PHY_MDC);
|
||||||
_pinMapping.eth_mdio = doc[i]["eth"]["mdio"] | ETH_PHY_MDIO;
|
_pinMapping.eth_mdio = doc[i]["eth"]["mdio"] | static_cast<gpio_num_t>(ETH_PHY_MDIO);
|
||||||
_pinMapping.eth_type = doc[i]["eth"]["type"] | ETH_PHY_TYPE;
|
_pinMapping.eth_type = doc[i]["eth"]["type"] | ETH_PHY_TYPE;
|
||||||
_pinMapping.eth_clk_mode = doc[i]["eth"]["clk_mode"] | ETH_CLK_MODE;
|
_pinMapping.eth_clk_mode = doc[i]["eth"]["clk_mode"] | ETH_CLK_MODE;
|
||||||
#endif
|
#endif
|
||||||
@@ -298,7 +298,7 @@ bool PinMappingClass::isValidW5500Config() const
|
|||||||
bool PinMappingClass::isValidEthConfig() const
|
bool PinMappingClass::isValidEthConfig() const
|
||||||
{
|
{
|
||||||
return _pinMapping.eth_enabled
|
return _pinMapping.eth_enabled
|
||||||
&& _pinMapping.eth_mdc >= 0
|
&& _pinMapping.eth_mdc > GPIO_NUM_NC
|
||||||
&& _pinMapping.eth_mdio >= 0;
|
&& _pinMapping.eth_mdio > GPIO_NUM_NC;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user