ESPHome 2025.8.0b2
|
#include <ethernet_component.h>
Public Member Functions | |
EthernetComponent () | |
void | setup () override |
void | loop () override |
void | dump_config () override |
float | get_setup_priority () const override |
bool | can_proceed () 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) |
network::IPAddresses | get_ip_addresses () |
network::IPAddress | get_dns_address (uint8_t num) |
std::string | get_use_address () const |
void | set_use_address (const std::string &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 () |
![]() | |
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. | |
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 |
bool | status_has_warning () const |
bool | status_has_error () const |
void | status_set_warning (const char *message=nullptr) |
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 char *source) |
Set where this component was loaded from for some debug messages. | |
const char * | get_component_source () const |
Get the integration where this component was declared as a string. | |
bool | should_warn_of_blocking (uint32_t blocking_time) |
Protected Member Functions | |
void | start_connect_ () |
void | dump_connect_params_ () |
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. | |
![]() | |
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 | |
std::string | use_address_ |
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} |
esp_netif_t * | eth_netif_ {nullptr} |
esp_eth_handle_t | eth_handle_ |
esp_eth_phy_t * | phy_ {nullptr} |
![]() | |
const char * | 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 53 of file ethernet_component.h.
esphome::ethernet::EthernetComponent::EthernetComponent | ( | ) |
Definition at line 54 of file ethernet_component.cpp.
void esphome::ethernet::EthernetComponent::add_phy_register | ( | PHYRegister | register_value | ) |
Definition at line 618 of file ethernet_component.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 395 of file ethernet_component.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 310 of file ethernet_component.cpp.
|
protected |
Definition at line 560 of file ethernet_component.cpp.
|
staticprotected |
Definition at line 427 of file ethernet_component.cpp.
network::IPAddress esphome::ethernet::EthernetComponent::get_dns_address | ( | uint8_t | num | ) |
Definition at line 421 of file ethernet_component.cpp.
eth_duplex_t esphome::ethernet::EthernetComponent::get_duplex_mode | ( | ) |
Definition at line 644 of file ethernet_component.cpp.
std::string esphome::ethernet::EthernetComponent::get_eth_mac_address_pretty | ( | ) |
Definition at line 638 of file ethernet_component.cpp.
void esphome::ethernet::EthernetComponent::get_eth_mac_address_raw | ( | uint8_t * | mac | ) |
Definition at line 632 of file ethernet_component.cpp.
network::IPAddresses esphome::ethernet::EthernetComponent::get_ip_addresses | ( | ) |
Definition at line 397 of file ethernet_component.cpp.
eth_speed_t esphome::ethernet::EthernetComponent::get_link_speed | ( | ) |
Definition at line 652 of file ethernet_component.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 393 of file ethernet_component.cpp.
std::string esphome::ethernet::EthernetComponent::get_use_address | ( | ) | const |
Definition at line 623 of file ethernet_component.cpp.
|
staticprotected |
Definition at line 473 of file ethernet_component.cpp.
|
staticprotected |
Definition at line 457 of file ethernet_component.cpp.
bool esphome::ethernet::EthernetComponent::is_connected | ( | ) |
Definition at line 558 of file ethernet_component.cpp.
|
protected |
Set RMII Reference Clock Select
bit for KSZ8081.
Definition at line 680 of file ethernet_component.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 267 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 660 of file ethernet_component.cpp.
void esphome::ethernet::EthernetComponent::set_clk_mode | ( | emac_rmii_clock_mode_t | clk_mode | ) |
Definition at line 617 of file ethernet_component.cpp.
void esphome::ethernet::EthernetComponent::set_clk_pin | ( | uint8_t | clk_pin | ) |
Definition at line 601 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 607 of file ethernet_component.cpp.
void esphome::ethernet::EthernetComponent::set_cs_pin | ( | uint8_t | cs_pin | ) |
Definition at line 604 of file ethernet_component.cpp.
void esphome::ethernet::EthernetComponent::set_interrupt_pin | ( | uint8_t | interrupt_pin | ) |
Definition at line 605 of file ethernet_component.cpp.
void esphome::ethernet::EthernetComponent::set_manual_ip | ( | const ManualIP & | manual_ip | ) |
Definition at line 621 of file ethernet_component.cpp.
void esphome::ethernet::EthernetComponent::set_mdc_pin | ( | uint8_t | mdc_pin | ) |
Definition at line 614 of file ethernet_component.cpp.
void esphome::ethernet::EthernetComponent::set_mdio_pin | ( | uint8_t | mdio_pin | ) |
Definition at line 615 of file ethernet_component.cpp.
void esphome::ethernet::EthernetComponent::set_miso_pin | ( | uint8_t | miso_pin | ) |
Definition at line 602 of file ethernet_component.cpp.
void esphome::ethernet::EthernetComponent::set_mosi_pin | ( | uint8_t | mosi_pin | ) |
Definition at line 603 of file ethernet_component.cpp.
void esphome::ethernet::EthernetComponent::set_phy_addr | ( | uint8_t | phy_addr | ) |
Definition at line 612 of file ethernet_component.cpp.
void esphome::ethernet::EthernetComponent::set_polling_interval | ( | uint32_t | polling_interval | ) |
Definition at line 609 of file ethernet_component.cpp.
void esphome::ethernet::EthernetComponent::set_power_pin | ( | int | power_pin | ) |
Definition at line 613 of file ethernet_component.cpp.
void esphome::ethernet::EthernetComponent::set_reset_pin | ( | uint8_t | reset_pin | ) |
Definition at line 606 of file ethernet_component.cpp.
void esphome::ethernet::EthernetComponent::set_type | ( | EthernetType | type | ) |
Definition at line 620 of file ethernet_component.cpp.
void esphome::ethernet::EthernetComponent::set_use_address | ( | const std::string & | use_address | ) |
Definition at line 630 of file ethernet_component.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 56 of file ethernet_component.cpp.
|
protected |
Definition at line 489 of file ethernet_component.cpp.
|
protected |
Set arbitratry PHY registers from config.
Definition at line 707 of file ethernet_component.cpp.
|
protected |
Definition at line 127 of file ethernet_component.h.
|
protected |
Definition at line 113 of file ethernet_component.h.
|
protected |
Definition at line 120 of file ethernet_component.h.
|
protected |
Definition at line 137 of file ethernet_component.h.
|
protected |
Definition at line 143 of file ethernet_component.h.
|
protected |
Definition at line 116 of file ethernet_component.h.
|
protected |
Definition at line 151 of file ethernet_component.h.
|
protected |
Definition at line 150 of file ethernet_component.h.
|
protected |
Definition at line 144 of file ethernet_component.h.
|
protected |
Definition at line 117 of file ethernet_component.h.
|
protected |
Definition at line 146 of file ethernet_component.h.
Definition at line 136 of file ethernet_component.h.
|
protected |
Definition at line 133 of file ethernet_component.h.
|
protected |
Definition at line 134 of file ethernet_component.h.
|
protected |
Definition at line 114 of file ethernet_component.h.
|
protected |
Definition at line 115 of file ethernet_component.h.
|
protected |
Definition at line 152 of file ethernet_component.h.
|
protected |
Definition at line 132 of file ethernet_component.h.
|
protected |
Definition at line 119 of file ethernet_component.h.
|
protected |
Definition at line 128 of file ethernet_component.h.
|
protected |
Definition at line 122 of file ethernet_component.h.
|
protected |
Definition at line 126 of file ethernet_component.h.
|
protected |
Definition at line 118 of file ethernet_component.h.
|
protected |
Definition at line 142 of file ethernet_component.h.
|
protected |
Definition at line 141 of file ethernet_component.h.
|
protected |
Definition at line 140 of file ethernet_component.h.
|
protected |
Definition at line 111 of file ethernet_component.h.