[Enhancement] Support no-IRQ for SPI Ethernet W5500 (#9251)
* [W5500] Support no-IRQ
Requires this commit from ESP-IDF to be cherry picked:
fd0a1dc53c
* Remove unrelated code to support ETH_PHY_JL1101
* remove the commented check and fix the error message
* Guard feature to be enabled when IDF backports it to v5.1
---------
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
This commit is contained in:
parent
a5b3119e4e
commit
113de1fa02
1 changed files with 17 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
@ -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;
|
||||
|
|
@ -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; }
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue