|
ESPHome 2025.12.0-dev
|
#include <ethernet_component.h>
Public Member Functions | |
| EthernetComponent () | |
| void | setup () override |
| void | loop () override |
| void | dump_config () override |
| float | get_setup_priority () const override |
| void | on_powerdown () override |
| bool | is_connected () |
| void | set_clk_pin (uint8_t clk_pin) |
| void | set_miso_pin (uint8_t miso_pin) |
| void | set_mosi_pin (uint8_t mosi_pin) |
| void | set_cs_pin (uint8_t cs_pin) |
| void | set_interrupt_pin (uint8_t interrupt_pin) |
| void | set_reset_pin (uint8_t reset_pin) |
| void | set_clock_speed (int clock_speed) |
| void | set_polling_interval (uint32_t polling_interval) |
| void | set_phy_addr (uint8_t phy_addr) |
| void | set_power_pin (int power_pin) |
| void | set_mdc_pin (uint8_t mdc_pin) |
| void | set_mdio_pin (uint8_t mdio_pin) |
| void | set_clk_pin (uint8_t clk_pin) |
| void | set_clk_mode (emac_rmii_clock_mode_t clk_mode) |
| void | add_phy_register (PHYRegister register_value) |
| void | set_type (EthernetType type) |
| void | set_manual_ip (const ManualIP &manual_ip) |
| void | set_fixed_mac (const std::array< uint8_t, 6 > &mac) |
| network::IPAddresses | get_ip_addresses () |
| network::IPAddress | get_dns_address (uint8_t num) |
| const char * | get_use_address () const |
| void | set_use_address (const char *use_address) |
| void | get_eth_mac_address_raw (uint8_t *mac) |
| std::string | get_eth_mac_address_pretty () |
| eth_duplex_t | get_duplex_mode () |
| eth_speed_t | get_link_speed () |
| bool | powerdown () |
Public Member Functions inherited from esphome::Component | |
| float | get_actual_setup_priority () const |
| void | set_setup_priority (float priority) |
| virtual float | get_loop_priority () const |
| priority of loop(). | |
| void | call () |
| virtual void | on_shutdown () |
| virtual void | on_safe_shutdown () |
| virtual bool | teardown () |
| Called during teardown to allow component to gracefully finish operations. | |
| uint8_t | get_component_state () const |
| void | reset_to_construction_state () |
| Reset this component back to the construction state to allow setup to run again. | |
| bool | is_in_loop_state () const |
| Check if this component has completed setup and is in the loop state. | |
| bool | is_idle () const |
| Check if this component is idle. | |
| virtual void | mark_failed () |
| Mark this component as failed. | |
| void | mark_failed (const char *message) |
| void | disable_loop () |
| Disable this component's loop. | |
| void | enable_loop () |
| Enable this component's loop. | |
| void | enable_loop_soon_any_context () |
| Thread and ISR-safe version of enable_loop() that can be called from any context. | |
| bool | is_failed () const |
| bool | is_ready () const |
| virtual bool | can_proceed () |
| bool | status_has_warning () const |
| bool | status_has_error () const |
| void | status_set_warning (const char *message=nullptr) |
| void | status_set_warning (const LogString *message) |
| void | status_set_error (const char *message=nullptr) |
| void | status_clear_warning () |
| void | status_clear_error () |
| void | status_momentary_warning (const std::string &name, uint32_t length=5000) |
| void | status_momentary_error (const std::string &name, uint32_t length=5000) |
| bool | has_overridden_loop () const |
| void | set_component_source (const LogString *source) |
| Set where this component was loaded from for some debug messages. | |
| const LogString * | get_component_log_str () const |
| Get the integration where this component was declared as a LogString for logging. | |
| bool | should_warn_of_blocking (uint32_t blocking_time) |
Protected Member Functions | |
| void | start_connect_ () |
| void | finish_connect_ () |
| void | dump_connect_params_ () |
| void | log_error_and_mark_failed_ (esp_err_t err, const char *message) |
| void | ksz8081_set_clock_reference_ (esp_eth_mac_t *mac) |
Set RMII Reference Clock Select bit for KSZ8081. | |
| void | write_phy_register_ (esp_eth_mac_t *mac, PHYRegister register_data) |
| Set arbitratry PHY registers from config. | |
Protected Member Functions inherited from esphome::Component | |
| virtual void | call_loop () |
| virtual void | call_setup () |
| virtual void | call_dump_config () |
| void | set_component_state_ (uint8_t state) |
| Helper to set component state (clears state bits and sets new state) | |
| void | set_interval (const std::string &name, uint32_t interval, std::function< void()> &&f) |
| Set an interval function with a unique name. | |
| void | set_interval (const char *name, uint32_t interval, std::function< void()> &&f) |
| Set an interval function with a const char* name. | |
| void | set_interval (uint32_t interval, std::function< void()> &&f) |
| bool | cancel_interval (const std::string &name) |
| Cancel an interval function. | |
| bool | cancel_interval (const char *name) |
| void | set_retry (const std::string &name, uint32_t initial_wait_time, uint8_t max_attempts, std::function< RetryResult(uint8_t)> &&f, float backoff_increase_factor=1.0f) |
| Set an retry function with a unique name. | |
| void | set_retry (uint32_t initial_wait_time, uint8_t max_attempts, std::function< RetryResult(uint8_t)> &&f, float backoff_increase_factor=1.0f) |
| bool | cancel_retry (const std::string &name) |
| Cancel a retry function. | |
| void | set_timeout (const std::string &name, uint32_t timeout, std::function< void()> &&f) |
| Set a timeout function with a unique name. | |
| void | set_timeout (const char *name, uint32_t timeout, std::function< void()> &&f) |
| Set a timeout function with a const char* name. | |
| void | set_timeout (uint32_t timeout, std::function< void()> &&f) |
| bool | cancel_timeout (const std::string &name) |
| Cancel a timeout function. | |
| bool | cancel_timeout (const char *name) |
| void | defer (const std::string &name, std::function< void()> &&f) |
| Defer a callback to the next loop() call. | |
| void | defer (const char *name, std::function< void()> &&f) |
| Defer a callback to the next loop() call with a const char* name. | |
| void | defer (std::function< void()> &&f) |
| Defer a callback to the next loop() call. | |
| bool | cancel_defer (const std::string &name) |
| Cancel a defer callback using the specified name, name must not be empty. | |
Static Protected Member Functions | |
| static void | eth_event_handler (void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data) |
| static void | got_ip_event_handler (void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data) |
| static void | got_ip6_event_handler (void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data) |
Protected Attributes | |
| uint8_t | clk_pin_ {0} |
| uint8_t | miso_pin_ |
| uint8_t | mosi_pin_ |
| uint8_t | cs_pin_ |
| int | interrupt_pin_ {-1} |
| int | reset_pin_ {-1} |
| int | phy_addr_spi_ {-1} |
| int | clock_speed_ |
| uint32_t | polling_interval_ {0} |
| int | power_pin_ {-1} |
| emac_rmii_clock_mode_t | clk_mode_ {EMAC_CLK_EXT_IN} |
| std::vector< PHYRegister > | phy_registers_ {} |
| uint8_t | phy_addr_ {0} |
| uint8_t | mdc_pin_ {23} |
| uint8_t | mdio_pin_ {18} |
| optional< ManualIP > | manual_ip_ {} |
| uint32_t | connect_begin_ |
| EthernetType | type_ {ETHERNET_TYPE_UNKNOWN} |
| EthernetComponentState | state_ {EthernetComponentState::STOPPED} |
| bool | started_ {false} |
| bool | connected_ {false} |
| bool | got_ipv4_address_ {false} |
| uint8_t | ipv6_count_ {0} |
| bool | ipv6_setup_done_ {false} |
| esp_netif_t * | eth_netif_ {nullptr} |
| esp_eth_handle_t | eth_handle_ |
| esp_eth_phy_t * | phy_ {nullptr} |
| optional< std::array< uint8_t, 6 > > | fixed_mac_ |
Protected Attributes inherited from esphome::Component | |
| const LogString * | component_source_ {nullptr} |
| uint16_t | warn_if_blocking_over_ {WARN_IF_BLOCKING_OVER_MS} |
| Warn if blocked for this many ms (max 65.5s) | |
| uint8_t | component_state_ {0x00} |
| State of this component - each bit has a purpose: Bits 0-2: Component state (0x00=CONSTRUCTION, 0x01=SETUP, 0x02=LOOP, 0x03=FAILED, 0x04=LOOP_DONE) Bit 3: STATUS_LED_WARNING Bit 4: STATUS_LED_ERROR Bits 5-7: Unused - reserved for future expansion. | |
| volatile bool | pending_enable_loop_ {false} |
| ISR-safe flag for enable_loop_soon_any_context. | |
Definition at line 54 of file ethernet_component.h.
| esphome::ethernet::EthernetComponent::EthernetComponent | ( | ) |
Definition at line 61 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::add_phy_register | ( | PHYRegister | register_value | ) |
Definition at line 688 of file ethernet_component.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 330 of file ethernet_component.cpp.
|
protected |
Definition at line 630 of file ethernet_component.cpp.
|
staticprotected |
Definition at line 454 of file ethernet_component.cpp.
|
protected |
Definition at line 516 of file ethernet_component.cpp.
| network::IPAddress esphome::ethernet::EthernetComponent::get_dns_address | ( | uint8_t | num | ) |
Definition at line 448 of file ethernet_component.cpp.
| eth_duplex_t esphome::ethernet::EthernetComponent::get_duplex_mode | ( | ) |
Definition at line 713 of file ethernet_component.cpp.
| std::string esphome::ethernet::EthernetComponent::get_eth_mac_address_pretty | ( | ) |
Definition at line 705 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::get_eth_mac_address_raw | ( | uint8_t * | mac | ) |
Definition at line 699 of file ethernet_component.cpp.
| network::IPAddresses esphome::ethernet::EthernetComponent::get_ip_addresses | ( | ) |
Definition at line 424 of file ethernet_component.cpp.
| eth_speed_t esphome::ethernet::EthernetComponent::get_link_speed | ( | ) |
Definition at line 721 of file ethernet_component.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 422 of file ethernet_component.cpp.
| const char * esphome::ethernet::EthernetComponent::get_use_address | ( | ) | const |
Definition at line 695 of file ethernet_component.cpp.
|
staticprotected |
Definition at line 500 of file ethernet_component.cpp.
|
staticprotected |
Definition at line 484 of file ethernet_component.cpp.
| bool esphome::ethernet::EthernetComponent::is_connected | ( | ) |
Definition at line 628 of file ethernet_component.cpp.
|
protected |
Set RMII Reference Clock Select bit for KSZ8081.
Definition at line 750 of file ethernet_component.cpp.
|
protected |
Definition at line 44 of file ethernet_component.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 286 of file ethernet_component.cpp.
|
inlineoverridevirtual |
Reimplemented from esphome::Component.
Definition at line 61 of file ethernet_component.h.
| bool esphome::ethernet::EthernetComponent::powerdown | ( | ) |
Definition at line 729 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_clk_mode | ( | emac_rmii_clock_mode_t | clk_mode | ) |
Definition at line 687 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_clk_pin | ( | uint8_t | clk_pin | ) |
Definition at line 671 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_clk_pin | ( | uint8_t | clk_pin | ) |
| void esphome::ethernet::EthernetComponent::set_clock_speed | ( | int | clock_speed | ) |
Definition at line 677 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_cs_pin | ( | uint8_t | cs_pin | ) |
Definition at line 674 of file ethernet_component.cpp.
|
inline |
Definition at line 86 of file ethernet_component.h.
| void esphome::ethernet::EthernetComponent::set_interrupt_pin | ( | uint8_t | interrupt_pin | ) |
Definition at line 675 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_manual_ip | ( | const ManualIP & | manual_ip | ) |
Definition at line 691 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_mdc_pin | ( | uint8_t | mdc_pin | ) |
Definition at line 684 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_mdio_pin | ( | uint8_t | mdio_pin | ) |
Definition at line 685 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_miso_pin | ( | uint8_t | miso_pin | ) |
Definition at line 672 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_mosi_pin | ( | uint8_t | mosi_pin | ) |
Definition at line 673 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_phy_addr | ( | uint8_t | phy_addr | ) |
Definition at line 682 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_polling_interval | ( | uint32_t | polling_interval | ) |
Definition at line 679 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_power_pin | ( | int | power_pin | ) |
Definition at line 683 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_reset_pin | ( | uint8_t | reset_pin | ) |
Definition at line 676 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_type | ( | EthernetType | type | ) |
Definition at line 690 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_use_address | ( | const char * | use_address | ) |
Definition at line 697 of file ethernet_component.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 63 of file ethernet_component.cpp.
|
protected |
Definition at line 540 of file ethernet_component.cpp.
|
protected |
Set arbitratry PHY registers from config.
Definition at line 778 of file ethernet_component.cpp.
|
protected |
Definition at line 131 of file ethernet_component.h.
|
protected |
Definition at line 117 of file ethernet_component.h.
|
protected |
Definition at line 124 of file ethernet_component.h.
|
protected |
Definition at line 141 of file ethernet_component.h.
|
protected |
Definition at line 147 of file ethernet_component.h.
|
protected |
Definition at line 120 of file ethernet_component.h.
|
protected |
Definition at line 156 of file ethernet_component.h.
|
protected |
Definition at line 155 of file ethernet_component.h.
|
protected |
Definition at line 158 of file ethernet_component.h.
|
protected |
Definition at line 148 of file ethernet_component.h.
|
protected |
Definition at line 121 of file ethernet_component.h.
|
protected |
Definition at line 150 of file ethernet_component.h.
|
protected |
Definition at line 151 of file ethernet_component.h.
Definition at line 140 of file ethernet_component.h.
|
protected |
Definition at line 137 of file ethernet_component.h.
|
protected |
Definition at line 138 of file ethernet_component.h.
|
protected |
Definition at line 118 of file ethernet_component.h.
|
protected |
Definition at line 119 of file ethernet_component.h.
|
protected |
Definition at line 157 of file ethernet_component.h.
|
protected |
Definition at line 136 of file ethernet_component.h.
|
protected |
Definition at line 123 of file ethernet_component.h.
|
protected |
Definition at line 132 of file ethernet_component.h.
|
protected |
Definition at line 126 of file ethernet_component.h.
|
protected |
Definition at line 130 of file ethernet_component.h.
|
protected |
Definition at line 122 of file ethernet_component.h.
|
protected |
Definition at line 146 of file ethernet_component.h.
|
protected |
Definition at line 145 of file ethernet_component.h.
|
protected |
Definition at line 144 of file ethernet_component.h.