23
23
#include " include/esp32x_fixes.h"
24
24
#endif
25
25
26
-
27
26
/*
28
27
// VariousBits1 defaults to 0, keep in mind when adding bit lookups.
29
28
template<unsigned int N_TASKS>
@@ -566,9 +565,9 @@ void SettingsStruct_tmpl<N_TASKS>::clearMisc() {
566
565
#ifdef ESP32
567
566
// Ethernet related settings are never used on ESP8266
568
567
ETH_Phy_Addr = DEFAULT_ETH_PHY_ADDR;
569
- ETH_Pin_mdc_cs = DEFAULT_ETH_PIN_MDC;
570
- ETH_Pin_mdio_irq = DEFAULT_ETH_PIN_MDIO;
571
- ETH_Pin_power_rst = DEFAULT_ETH_PIN_POWER;
568
+ ETH_Pin_mdc_cs = DEFAULT_ETH_PIN_MDC;
569
+ ETH_Pin_mdio_irq = DEFAULT_ETH_PIN_MDIO;
570
+ ETH_Pin_power_rst = DEFAULT_ETH_PIN_POWER;
572
571
ETH_Phy_Type = DEFAULT_ETH_PHY_TYPE;
573
572
ETH_Clock_Mode = DEFAULT_ETH_CLOCK_MODE;
574
573
#endif
@@ -883,25 +882,37 @@ spi_host_device_t SettingsStruct_tmpl<N_TASKS>::getSPI_host() const
883
882
switch (SPI_selection) {
884
883
case SPI_Options_e::Vspi_Fspi:
885
884
{
886
- return VSPI_HOST;
885
+ #if CONFIG_IDF_TARGET_ESP32
886
+ return static_cast <spi_host_device_t >(VSPI);
887
+ #else
888
+ return static_cast <spi_host_device_t >(FSPI);
889
+ #endif
887
890
}
888
891
#ifdef ESP32_CLASSIC
889
892
case SPI_Options_e::Hspi:
890
893
{
891
- return HSPI_HOST ;
894
+ return static_cast < spi_host_device_t >(HSPI) ;
892
895
}
893
896
#endif
894
897
case SPI_Options_e::UserDefined:
895
898
{
896
- return HSPI_HOST;
899
+ #if CONFIG_IDF_TARGET_ESP32
900
+ return static_cast <spi_host_device_t >(VSPI);
901
+ #else
902
+ return static_cast <spi_host_device_t >(FSPI);
903
+ #endif
897
904
}
898
905
case SPI_Options_e::None:
899
906
break ;
900
907
}
901
908
902
909
}
903
910
#if ESP_IDF_VERSION_MAJOR < 5
904
- return SPI_HOST;
911
+ #if CONFIG_IDF_TARGET_ESP32
912
+ return static_cast <spi_host_device_t >(VSPI);
913
+ #else
914
+ return static_cast <spi_host_device_t >(FSPI);
915
+ #endif
905
916
#else
906
917
return spi_host_device_t ::SPI_HOST_MAX;
907
918
#endif
@@ -955,10 +966,8 @@ template<unsigned int N_TASKS>
955
966
bool SettingsStruct_tmpl<N_TASKS>::isEthernetPin(int8_t pin) const {
956
967
#if FEATURE_ETHERNET
957
968
if (pin < 0 ) return false ;
958
- if (isSPI_EthernetType (ETH_Phy_Type)) {
959
- return false ;
960
- }
961
- if (NetworkMedium == NetworkMedium_t::Ethernet) {
969
+ if (NetworkMedium == NetworkMedium_t::Ethernet &&
970
+ !isSPI_EthernetType (ETH_Phy_Type)) {
962
971
if (19 == pin) return true ; // ETH TXD0
963
972
if (21 == pin) return true ; // ETH TX EN
964
973
if (22 == pin) return true ; // ETH TXD1
@@ -976,7 +985,7 @@ bool SettingsStruct_tmpl<N_TASKS>::isEthernetPinOptional(int8_t pin) const {
976
985
#if FEATURE_ETHERNET
977
986
if (pin < 0 ) return false ;
978
987
if (NetworkMedium == NetworkMedium_t::Ethernet) {
979
- if (isGpioUsedInETHClockMode (ETH_Clock_Mode, pin)) return true ;
988
+ if (! isSPI_EthernetType (ETH_Phy_Type) && isGpioUsedInETHClockMode (ETH_Clock_Mode, pin)) return true ;
980
989
if (ETH_Pin_mdc_cs == pin) return true ;
981
990
if (ETH_Pin_mdio_irq == pin) return true ;
982
991
if (ETH_Pin_power_rst == pin) return true ;
0 commit comments