Skip to content

Commit ce77cf9

Browse files
authored
Merge pull request #4959 from TD-er/bugfix/esp32_SPI_eth_pins
[SPI Ethernet] Allow selecting RMII pins for SPI Ethernet
2 parents 438ef4f + db08d00 commit ce77cf9

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

src/src/DataStructs_templ/SettingsStruct.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,9 @@ template<unsigned int N_TASKS>
955955
bool SettingsStruct_tmpl<N_TASKS>::isEthernetPin(int8_t pin) const {
956956
#if FEATURE_ETHERNET
957957
if (pin < 0) return false;
958+
if (isSPI_EthernetType(ETH_Phy_Type)) {
959+
return false;
960+
}
958961
if (NetworkMedium == NetworkMedium_t::Ethernet) {
959962
if (19 == pin) return true; // ETH TXD0
960963
if (21 == pin) return true; // ETH TX EN

src/src/Helpers/StringGenerator_GPIO.cpp

+18-9
Original file line numberDiff line numberDiff line change
@@ -287,21 +287,30 @@ const __FlashStringHelper* getConflictingUse(int gpio, PinSelectPurpose purpose)
287287

288288

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

291-
if (Settings.isEthernetPin(gpio)) {
292-
return F("Eth");
293-
}
294+
if (Settings.ETH_Pin_mdio_irq == gpio) { return F("Eth SPI IRQ"); }
294295

295-
if (includeEthernet && Settings.isEthernetPinOptional(gpio)) {
296-
if (isGpioUsedInETHClockMode(Settings.ETH_Clock_Mode, gpio)) { return F("Eth Clock"); }
296+
if (Settings.ETH_Pin_power_rst == gpio) { return F("Eth SPI RST"); }
297+
}
298+
} else {
299+
if (Settings.isEthernetPin(gpio)) {
300+
return F("Eth");
301+
}
297302

298-
if (Settings.ETH_Pin_mdc_cs == gpio) { return F("Eth MDC"); }
303+
if (includeEthernet && Settings.isEthernetPinOptional(gpio)) {
304+
if (isGpioUsedInETHClockMode(Settings.ETH_Clock_Mode, gpio)) { return F("Eth Clock"); }
299305

300-
if (Settings.ETH_Pin_mdio_irq == gpio) { return F("Eth MDIO"); }
306+
if (Settings.ETH_Pin_mdc_cs == gpio) { return F("Eth MDC"); }
301307

302-
if (Settings.ETH_Pin_power_rst == gpio) { return F("Eth Pwr"); }
308+
if (Settings.ETH_Pin_mdio_irq == gpio) { return F("Eth MDIO"); }
303309

304-
return F("Eth");
310+
if (Settings.ETH_Pin_power_rst == gpio) { return F("Eth Pwr"); }
311+
312+
return F("Eth");
313+
}
305314
}
306315
#endif // if FEATURE_ETHERNET
307316

0 commit comments

Comments
 (0)