Skip to content

Commit 35d0cdc

Browse files
authored
Guard feature to be enabled when IDF backports it to v5.1
1 parent 4866be8 commit 35d0cdc

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Diff for: libraries/Ethernet/src/ETH.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,13 @@ bool ETHClass::beginSPI(eth_phy_type_t type, uint8_t phy_addr, int cs, int irq,
351351
log_w("ETH Already Started");
352352
return true;
353353
}
354+
#if ETH_SPI_SUPPORTS_NO_IRQ
354355
if(cs < 0){
355356
log_e("CS pin must be defined!");
357+
#else
358+
if(cs < 0 || irq < 0){
359+
log_e("CS and IRQ pins must be defined!");
360+
#endif
356361
return false;
357362
}
358363

@@ -447,9 +452,11 @@ bool ETHClass::beginSPI(eth_phy_type_t type, uint8_t phy_addr, int cs, int irq,
447452
if(type == ETH_PHY_W5500){
448453
eth_w5500_config_t mac_config = ETH_W5500_DEFAULT_CONFIG(spi_host, &spi_devcfg);
449454
mac_config.int_gpio_num = _pin_irq;
455+
#if ETH_SPI_SUPPORTS_NO_IRQ
450456
if (_pin_irq < 0) {
451457
mac_config.poll_period_ms = 10;
452458
}
459+
#endif
453460
#if ETH_SPI_SUPPORTS_CUSTOM
454461
if(_spi != NULL){
455462
mac_config.custom_spi_driver.config = this;
@@ -589,9 +596,13 @@ bool ETHClass::beginSPI(eth_phy_type_t type, uint8_t phy_addr, int cs, int irq,
589596
#if ETH_SPI_SUPPORTS_CUSTOM
590597
}
591598
#endif
599+
#if ETH_SPI_SUPPORTS_NO_IRQ
592600
if(_pin_irq != -1){
601+
#endif
593602
if(!perimanSetPinBus(_pin_irq, ESP32_BUS_TYPE_ETHERNET_SPI, (void *)(this), -1, -1)){ goto err; }
603+
#if ETH_SPI_SUPPORTS_NO_IRQ
594604
}
605+
#endif
595606
if(_pin_sck != -1){
596607
if(!perimanSetPinBus(_pin_sck, ESP32_BUS_TYPE_ETHERNET_SPI, (void *)(this), -1, -1)){ goto err; }
597608
}

0 commit comments

Comments
 (0)