From 2fbe80c1f78cc407d79a8d06e4c0c948f013f1ae Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Thu, 9 May 2024 12:25:57 +1200 Subject: [PATCH] [ethernet] Use constexpr instead of inline define for KSZ80XX_PC2R_REG_ADDR (#6705) --- esphome/components/ethernet/ethernet_component.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/esphome/components/ethernet/ethernet_component.cpp b/esphome/components/ethernet/ethernet_component.cpp index 243135de89..17093ffb3d 100644 --- a/esphome/components/ethernet/ethernet_component.cpp +++ b/esphome/components/ethernet/ethernet_component.cpp @@ -1,12 +1,12 @@ #include "ethernet_component.h" +#include "esphome/core/application.h" #include "esphome/core/log.h" #include "esphome/core/util.h" -#include "esphome/core/application.h" #ifdef USE_ESP32 -#include #include +#include #include "esp_event.h" #ifdef USE_ETHERNET_SPI @@ -554,9 +554,10 @@ bool EthernetComponent::powerdown() { } #ifndef USE_ETHERNET_SPI -void EthernetComponent::ksz8081_set_clock_reference_(esp_eth_mac_t *mac) { -#define KSZ80XX_PC2R_REG_ADDR (0x1F) +constexpr uint8_t KSZ80XX_PC2R_REG_ADDR = 0x1F; + +void EthernetComponent::ksz8081_set_clock_reference_(esp_eth_mac_t *mac) { esp_err_t err; uint32_t phy_control_2; @@ -581,8 +582,6 @@ void EthernetComponent::ksz8081_set_clock_reference_(esp_eth_mac_t *mac) { ESPHL_ERROR_CHECK(err, "Read PHY Control 2 failed"); ESP_LOGVV(TAG, "KSZ8081 PHY Control 2: %s", format_hex_pretty((u_int8_t *) &phy_control_2, 2).c_str()); } - -#undef KSZ80XX_PC2R_REG_ADDR } #endif