[esp_ldo] Component schema; default priority (#9479)

This commit is contained in:
Clyde Stubbs 2025-07-14 09:47:52 +10:00 committed by Jesse Hills
parent c13317f807
commit 9207bf97f3
No known key found for this signature in database
GPG Key ID: BEAAE804EFD8E83A
3 changed files with 14 additions and 8 deletions

View File

@ -20,14 +20,16 @@ adjusted_ids = set()
CONFIG_SCHEMA = cv.All(
cv.ensure_list(
{
cv.GenerateID(): cv.declare_id(EspLdo),
cv.Required(CONF_VOLTAGE): cv.All(
cv.voltage, cv.float_range(min=0.5, max=2.7)
),
cv.Required(CONF_CHANNEL): cv.one_of(*CHANNELS, int=True),
cv.Optional(CONF_ADJUSTABLE, default=False): cv.boolean,
}
cv.COMPONENT_SCHEMA.extend(
{
cv.GenerateID(): cv.declare_id(EspLdo),
cv.Required(CONF_VOLTAGE): cv.All(
cv.voltage, cv.float_range(min=0.5, max=2.7)
),
cv.Required(CONF_CHANNEL): cv.one_of(*CHANNELS, int=True),
cv.Optional(CONF_ADJUSTABLE, default=False): cv.boolean,
}
)
),
cv.only_with_esp_idf,
only_on_variant(supported=[VARIANT_ESP32P4]),

View File

@ -17,6 +17,9 @@ class EspLdo : public Component {
void set_adjustable(bool adjustable) { this->adjustable_ = adjustable; }
void set_voltage(float voltage) { this->voltage_ = voltage; }
void adjust_voltage(float voltage);
float get_setup_priority() const override {
return setup_priority::BUS; // LDO setup should be done early
}
protected:
int channel_;

View File

@ -6,6 +6,7 @@ esp_ldo:
- id: ldo_4
channel: 4
voltage: 2.0V
setup_priority: 900
esphome:
on_boot: