@@ -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
355
+ if (cs < 0 ){
356
+ log_e (" CS pin must be defined!" );
357
+ #else
354
358
if (cs < 0 || irq < 0 ){
355
359
log_e (" CS and IRQ pins must be defined!" );
360
+ #endif
356
361
return false ;
357
362
}
358
363
@@ -447,6 +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
456
+ if (_pin_irq < 0 ) {
457
+ mac_config.poll_period_ms = 10 ;
458
+ }
459
+ #endif
450
460
#if ETH_SPI_SUPPORTS_CUSTOM
451
461
if (_spi != NULL ){
452
462
mac_config.custom_spi_driver .config = this ;
@@ -586,8 +596,13 @@ bool ETHClass::beginSPI(eth_phy_type_t type, uint8_t phy_addr, int cs, int irq,
586
596
#if ETH_SPI_SUPPORTS_CUSTOM
587
597
}
588
598
#endif
589
- if (!perimanSetPinBus (_pin_irq, ESP32_BUS_TYPE_ETHERNET_SPI, (void *)(this ), -1 , -1 )){ goto err; }
590
-
599
+ #if ETH_SPI_SUPPORTS_NO_IRQ
600
+ if (_pin_irq != -1 ){
601
+ #endif
602
+ if (!perimanSetPinBus (_pin_irq, ESP32_BUS_TYPE_ETHERNET_SPI, (void *)(this ), -1 , -1 )){ goto err; }
603
+ #if ETH_SPI_SUPPORTS_NO_IRQ
604
+ }
605
+ #endif
591
606
if (_pin_sck != -1 ){
592
607
if (!perimanSetPinBus (_pin_sck, ESP32_BUS_TYPE_ETHERNET_SPI, (void *)(this ), -1 , -1 )){ goto err; }
593
608
}
0 commit comments