@@ -351,8 +351,13 @@ bool ETHClass::beginSPI(eth_phy_type_t type, uint8_t phy_addr, int cs, int irq,
351
351
log_w (" ETH Already Started" );
352
352
return true ;
353
353
}
354
+ #if ETH_SPI_SUPPORTS_NO_IRQ
354
355
if (cs < 0 ){
355
356
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
356
361
return false ;
357
362
}
358
363
@@ -447,9 +452,11 @@ bool ETHClass::beginSPI(eth_phy_type_t type, uint8_t phy_addr, int cs, int irq,
447
452
if (type == ETH_PHY_W5500){
448
453
eth_w5500_config_t mac_config = ETH_W5500_DEFAULT_CONFIG (spi_host, &spi_devcfg);
449
454
mac_config.int_gpio_num = _pin_irq;
455
+ #if ETH_SPI_SUPPORTS_NO_IRQ
450
456
if (_pin_irq < 0 ) {
451
457
mac_config.poll_period_ms = 10 ;
452
458
}
459
+ #endif
453
460
#if ETH_SPI_SUPPORTS_CUSTOM
454
461
if (_spi != NULL ){
455
462
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,
589
596
#if ETH_SPI_SUPPORTS_CUSTOM
590
597
}
591
598
#endif
599
+ #if ETH_SPI_SUPPORTS_NO_IRQ
592
600
if (_pin_irq != -1 ){
601
+ #endif
593
602
if (!perimanSetPinBus (_pin_irq, ESP32_BUS_TYPE_ETHERNET_SPI, (void *)(this ), -1 , -1 )){ goto err; }
603
+ #if ETH_SPI_SUPPORTS_NO_IRQ
594
604
}
605
+ #endif
595
606
if (_pin_sck != -1 ){
596
607
if (!perimanSetPinBus (_pin_sck, ESP32_BUS_TYPE_ETHERNET_SPI, (void *)(this ), -1 , -1 )){ goto err; }
597
608
}
0 commit comments