Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions libraries/Ethernet/src/ETH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,13 @@ bool ETHClass::beginSPI(eth_phy_type_t type, uint8_t phy_addr, int cs, int irq,
log_w("ETH Already Started");
return true;
}
#if ETH_SPI_SUPPORTS_NO_IRQ
if(cs < 0){
log_e("CS pin must be defined!");
#else
if(cs < 0 || irq < 0){
log_e("CS and IRQ pins must be defined!");
#endif
return false;
}

Expand Down Expand Up @@ -447,6 +452,11 @@ bool ETHClass::beginSPI(eth_phy_type_t type, uint8_t phy_addr, int cs, int irq,
if(type == ETH_PHY_W5500){
eth_w5500_config_t mac_config = ETH_W5500_DEFAULT_CONFIG(spi_host, &spi_devcfg);
mac_config.int_gpio_num = _pin_irq;
#if ETH_SPI_SUPPORTS_NO_IRQ
if (_pin_irq < 0) {
mac_config.poll_period_ms = 10;
}
#endif
#if ETH_SPI_SUPPORTS_CUSTOM
if(_spi != NULL){
mac_config.custom_spi_driver.config = this;
Expand Down Expand Up @@ -586,8 +596,13 @@ bool ETHClass::beginSPI(eth_phy_type_t type, uint8_t phy_addr, int cs, int irq,
#if ETH_SPI_SUPPORTS_CUSTOM
}
#endif
if(!perimanSetPinBus(_pin_irq, ESP32_BUS_TYPE_ETHERNET_SPI, (void *)(this), -1, -1)){ goto err; }

#if ETH_SPI_SUPPORTS_NO_IRQ
if(_pin_irq != -1){
#endif
if(!perimanSetPinBus(_pin_irq, ESP32_BUS_TYPE_ETHERNET_SPI, (void *)(this), -1, -1)){ goto err; }
#if ETH_SPI_SUPPORTS_NO_IRQ
}
#endif
if(_pin_sck != -1){
if(!perimanSetPinBus(_pin_sck, ESP32_BUS_TYPE_ETHERNET_SPI, (void *)(this), -1, -1)){ goto err; }
}
Expand Down