mirror of
https://github.com/esphome/esphome.git
synced 2026-07-10 08:55:36 +00:00
touch ups
This commit is contained in:
@@ -437,7 +437,7 @@ def _final_validate_spi(config):
|
||||
|
||||
if spi_configs := fv.full_config.get().get(CONF_SPI):
|
||||
# get_spi_interface() returns strings like "SPI2_HOST"
|
||||
spi_host = config[CONF_INTERFACE].upper() + "_HOST"
|
||||
spi_host = f"{config[CONF_INTERFACE].upper()}_HOST"
|
||||
for spi_conf in spi_configs:
|
||||
if (index := spi_conf.get(CONF_INTERFACE_INDEX)) is not None:
|
||||
interface = get_spi_interface(index)
|
||||
@@ -535,8 +535,7 @@ async def _to_code_esp32(var: cg.Pvariable, config: ConfigType) -> None:
|
||||
|
||||
cg.add_define("USE_ETHERNET_SPI")
|
||||
|
||||
if CONF_INTERFACE in config:
|
||||
cg.add(var.set_interface(SPI_INTERFACE_MAP[config[CONF_INTERFACE]]))
|
||||
cg.add(var.set_interface(SPI_INTERFACE_MAP[config[CONF_INTERFACE]]))
|
||||
add_idf_sdkconfig_option("CONFIG_ETH_USE_SPI_ETHERNET", True)
|
||||
# CONFIG_ETH_SPI_ETHERNET_{TYPE} Kconfig options were removed in IDF 6.0
|
||||
# ENC28J60 was never built-in to IDF, so it has no Kconfig option
|
||||
|
||||
@@ -205,7 +205,7 @@ class EthernetComponent final : public Component {
|
||||
int reset_pin_{-1};
|
||||
int phy_addr_spi_{-1};
|
||||
int clock_speed_;
|
||||
spi_host_device_t interface_{SPI2_HOST};
|
||||
spi_host_device_t interface_{SPI3_HOST};
|
||||
#ifdef USE_ETHERNET_SPI_POLLING_SUPPORT
|
||||
uint32_t polling_interval_{0};
|
||||
#endif
|
||||
|
||||
@@ -453,12 +453,11 @@ void EthernetComponent::dump_config() {
|
||||
" MOSI Pin: %u\n"
|
||||
" CS Pin: %u",
|
||||
this->clk_pin_, this->miso_pin_, this->mosi_pin_, this->cs_pin_);
|
||||
{
|
||||
constexpr std::array<const char *, 3> values{"spi1", "spi2", "spi3"};
|
||||
if (this->interface_ < values.size()) {
|
||||
ESP_LOGCONFIG(TAG, " Interface: %s", values[this->interface_]);
|
||||
}
|
||||
const char *spi_interface = "spi3";
|
||||
if (this->interface_ == SPI2_HOST) {
|
||||
spi_interface = "spi2";
|
||||
}
|
||||
ESP_LOGCONFIG(TAG, " Interface: %s", spi_interface);
|
||||
#ifdef USE_ETHERNET_SPI_POLLING_SUPPORT
|
||||
if (this->polling_interval_ != 0) {
|
||||
ESP_LOGCONFIG(TAG, " Polling Interval: %" PRIu32 " ms", this->polling_interval_);
|
||||
|
||||
Reference in New Issue
Block a user