mirror of
https://github.com/esphome/esphome.git
synced 2025-09-13 00:32:20 +01:00
23 lines
674 B
Python
23 lines
674 B
Python
from esphome.components import esp32
|
|
import esphome.config_validation as cv
|
|
|
|
CODEOWNERS = ["@jesserockz"]
|
|
|
|
|
|
def validate_clock_resolution():
|
|
def _validator(value):
|
|
cv.only_on_esp32(value)
|
|
value = cv.int_(value)
|
|
variant = esp32.get_esp32_variant()
|
|
if variant == esp32.const.VARIANT_ESP32H2 and value > 32000000:
|
|
raise cv.Invalid(
|
|
f"ESP32 variant {variant} has a max clock_resolution of 32000000."
|
|
)
|
|
if value > 80000000:
|
|
raise cv.Invalid(
|
|
f"ESP32 variant {variant} has a max clock_resolution of 80000000."
|
|
)
|
|
return value
|
|
|
|
return _validator
|