Skip to content

Commit 257a99f

Browse files
authored
[W5500] Support no-IRQ
Requires this commit from ESP-IDF to be cherry picked: espressif/esp-idf@fd0a1dc
1 parent 698b78a commit 257a99f

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

libraries/Ethernet/src/ETH.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ bool ETHClass::begin(eth_phy_type_t type, uint8_t phy_addr, int mdc, int mdio, i
149149
case ETH_PHY_DP83848:
150150
phy = esp_eth_phy_new_dp83848(&phy_config);
151151
break;
152+
case ETH_PHY_JL1101:
153+
phy = esp_eth_phy_new_jl1101(&phy_config);
154+
break;
152155
case ETH_PHY_KSZ8041:
153156
phy = esp_eth_phy_new_ksz80xx(&phy_config);
154157
break;
@@ -351,7 +354,7 @@ bool ETHClass::beginSPI(eth_phy_type_t type, uint8_t phy_addr, int cs, int irq,
351354
log_w("ETH Already Started");
352355
return true;
353356
}
354-
if(cs < 0 || irq < 0){
357+
if(cs < 0 /*|| irq < 0*/){
355358
log_e("CS and IRQ pins must be defined!");
356359
return false;
357360
}
@@ -447,6 +450,9 @@ bool ETHClass::beginSPI(eth_phy_type_t type, uint8_t phy_addr, int cs, int irq,
447450
if(type == ETH_PHY_W5500){
448451
eth_w5500_config_t mac_config = ETH_W5500_DEFAULT_CONFIG(spi_host, &spi_devcfg);
449452
mac_config.int_gpio_num = _pin_irq;
453+
if (_pin_irq < 0) {
454+
mac_config.poll_period_ms = 10;
455+
}
450456
#if ETH_SPI_SUPPORTS_CUSTOM
451457
if(_spi != NULL){
452458
mac_config.custom_spi_driver.config = this;
@@ -586,8 +592,9 @@ bool ETHClass::beginSPI(eth_phy_type_t type, uint8_t phy_addr, int cs, int irq,
586592
#if ETH_SPI_SUPPORTS_CUSTOM
587593
}
588594
#endif
589-
if(!perimanSetPinBus(_pin_irq, ESP32_BUS_TYPE_ETHERNET_SPI, (void *)(this), -1, -1)){ goto err; }
590-
595+
if(_pin_irq != -1){
596+
if(!perimanSetPinBus(_pin_irq, ESP32_BUS_TYPE_ETHERNET_SPI, (void *)(this), -1, -1)){ goto err; }
597+
}
591598
if(_pin_sck != -1){
592599
if(!perimanSetPinBus(_pin_sck, ESP32_BUS_TYPE_ETHERNET_SPI, (void *)(this), -1, -1)){ goto err; }
593600
}

0 commit comments

Comments
 (0)