Skip to content

Commit

Permalink
Merge pull request letscontrolit#4959 from TD-er/bugfix/esp32_SPI_eth…
Browse files Browse the repository at this point in the history
…_pins

[SPI Ethernet] Allow selecting RMII pins for SPI Ethernet
  • Loading branch information
TD-er authored Feb 3, 2024
2 parents 438ef4f + db08d00 commit ce77cf9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
3 changes: 3 additions & 0 deletions src/src/DataStructs_templ/SettingsStruct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,9 @@ template<unsigned int N_TASKS>
bool SettingsStruct_tmpl<N_TASKS>::isEthernetPin(int8_t pin) const {
#if FEATURE_ETHERNET
if (pin < 0) return false;
if (isSPI_EthernetType(ETH_Phy_Type)) {
return false;
}
if (NetworkMedium == NetworkMedium_t::Ethernet) {
if (19 == pin) return true; // ETH TXD0
if (21 == pin) return true; // ETH TX EN
Expand Down
27 changes: 18 additions & 9 deletions src/src/Helpers/StringGenerator_GPIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,21 +287,30 @@ const __FlashStringHelper* getConflictingUse(int gpio, PinSelectPurpose purpose)


#if FEATURE_ETHERNET
if (isSPI_EthernetType(Settings.ETH_Phy_Type)) {
if (includeEthernet && Settings.isEthernetPinOptional(gpio)) {
if (Settings.ETH_Pin_mdc_cs == gpio) { return F("Eth SPI CS"); }

if (Settings.isEthernetPin(gpio)) {
return F("Eth");
}
if (Settings.ETH_Pin_mdio_irq == gpio) { return F("Eth SPI IRQ"); }

if (includeEthernet && Settings.isEthernetPinOptional(gpio)) {
if (isGpioUsedInETHClockMode(Settings.ETH_Clock_Mode, gpio)) { return F("Eth Clock"); }
if (Settings.ETH_Pin_power_rst == gpio) { return F("Eth SPI RST"); }
}
} else {
if (Settings.isEthernetPin(gpio)) {
return F("Eth");
}

if (Settings.ETH_Pin_mdc_cs == gpio) { return F("Eth MDC"); }
if (includeEthernet && Settings.isEthernetPinOptional(gpio)) {
if (isGpioUsedInETHClockMode(Settings.ETH_Clock_Mode, gpio)) { return F("Eth Clock"); }

if (Settings.ETH_Pin_mdio_irq == gpio) { return F("Eth MDIO"); }
if (Settings.ETH_Pin_mdc_cs == gpio) { return F("Eth MDC"); }

if (Settings.ETH_Pin_power_rst == gpio) { return F("Eth Pwr"); }
if (Settings.ETH_Pin_mdio_irq == gpio) { return F("Eth MDIO"); }

return F("Eth");
if (Settings.ETH_Pin_power_rst == gpio) { return F("Eth Pwr"); }

return F("Eth");
}
}
#endif // if FEATURE_ETHERNET

Expand Down

0 comments on commit ce77cf9

Please sign in to comment.