mirror of
https://github.com/esphome/esphome.git
synced 2025-11-19 08:15:49 +00:00
[ethernet] Add config option to set arbitrary PHY register values (#6836)
This commit is contained in:
@@ -35,6 +35,12 @@ struct ManualIP {
|
||||
network::IPAddress dns2; ///< The second DNS server. 0.0.0.0 for default.
|
||||
};
|
||||
|
||||
struct PHYRegister {
|
||||
uint32_t address;
|
||||
uint32_t value;
|
||||
uint32_t page;
|
||||
};
|
||||
|
||||
enum class EthernetComponentState {
|
||||
STOPPED,
|
||||
CONNECTING,
|
||||
@@ -66,6 +72,7 @@ class EthernetComponent : public Component {
|
||||
void set_mdc_pin(uint8_t mdc_pin);
|
||||
void set_mdio_pin(uint8_t mdio_pin);
|
||||
void set_clk_mode(emac_rmii_clock_mode_t clk_mode, emac_rmii_clock_gpio_t clk_gpio);
|
||||
void add_phy_register(PHYRegister register_value);
|
||||
#endif
|
||||
void set_type(EthernetType type);
|
||||
void set_manual_ip(const ManualIP &manual_ip);
|
||||
@@ -91,8 +98,8 @@ class EthernetComponent : public Component {
|
||||
void dump_connect_params_();
|
||||
/// @brief Set `RMII Reference Clock Select` bit for KSZ8081.
|
||||
void ksz8081_set_clock_reference_(esp_eth_mac_t *mac);
|
||||
/// @brief Set `RMII Mode Setting Register` for RTL8201.
|
||||
void rtl8201_set_rmii_mode_(esp_eth_mac_t *mac);
|
||||
/// @brief Set arbitratry PHY registers from config.
|
||||
void write_phy_register_(esp_eth_mac_t *mac, PHYRegister register_data);
|
||||
|
||||
std::string use_address_;
|
||||
#ifdef USE_ETHERNET_SPI
|
||||
@@ -111,6 +118,7 @@ class EthernetComponent : public Component {
|
||||
uint8_t mdio_pin_{18};
|
||||
emac_rmii_clock_mode_t clk_mode_{EMAC_CLK_EXT_IN};
|
||||
emac_rmii_clock_gpio_t clk_gpio_{EMAC_CLK_IN_GPIO};
|
||||
std::vector<PHYRegister> phy_registers_{};
|
||||
#endif
|
||||
EthernetType type_{ETHERNET_TYPE_UNKNOWN};
|
||||
optional<ManualIP> manual_ip_{};
|
||||
|
||||
Reference in New Issue
Block a user