mirror of
https://github.com/esphome/esphome.git
synced 2025-11-19 00:05:43 +00:00
Add ethernet powerdown (fixes esphome/issues#4420) (#4706)
* Add ethernet powerdown * Add on_shutdown (fixes esphome/issues#4420 * Sync dev and clang-tidy fix * fix typo and trainling space * Initialize phy_ member Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com> * Use `this` pointer Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com> * Member initialized at declaration Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com> * Use `this` pointer Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com> * Use `this` pointer --------- Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
@@ -45,6 +45,7 @@ class EthernetComponent : public Component {
|
||||
void dump_config() override;
|
||||
float get_setup_priority() const override;
|
||||
bool can_proceed() override;
|
||||
void on_shutdown() override { powerdown(); }
|
||||
bool is_connected();
|
||||
|
||||
void set_phy_addr(uint8_t phy_addr);
|
||||
@@ -58,6 +59,7 @@ class EthernetComponent : public Component {
|
||||
network::IPAddress get_ip_address();
|
||||
std::string get_use_address() const;
|
||||
void set_use_address(const std::string &use_address);
|
||||
bool powerdown();
|
||||
|
||||
protected:
|
||||
static void eth_event_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data);
|
||||
@@ -82,6 +84,7 @@ class EthernetComponent : public Component {
|
||||
uint32_t connect_begin_;
|
||||
esp_netif_t *eth_netif_{nullptr};
|
||||
esp_eth_handle_t eth_handle_;
|
||||
esp_eth_phy_t *phy_{nullptr};
|
||||
};
|
||||
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
|
||||
Reference in New Issue
Block a user