mirror of
https://github.com/esphome/esphome.git
synced 2025-07-29 06:36:45 +00:00
[esp_ldo] Component schema; default priority (#9479)
This commit is contained in:
parent
c13317f807
commit
9207bf97f3
@ -20,14 +20,16 @@ adjusted_ids = set()
|
|||||||
|
|
||||||
CONFIG_SCHEMA = cv.All(
|
CONFIG_SCHEMA = cv.All(
|
||||||
cv.ensure_list(
|
cv.ensure_list(
|
||||||
{
|
cv.COMPONENT_SCHEMA.extend(
|
||||||
cv.GenerateID(): cv.declare_id(EspLdo),
|
{
|
||||||
cv.Required(CONF_VOLTAGE): cv.All(
|
cv.GenerateID(): cv.declare_id(EspLdo),
|
||||||
cv.voltage, cv.float_range(min=0.5, max=2.7)
|
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.Required(CONF_CHANNEL): cv.one_of(*CHANNELS, int=True),
|
||||||
}
|
cv.Optional(CONF_ADJUSTABLE, default=False): cv.boolean,
|
||||||
|
}
|
||||||
|
)
|
||||||
),
|
),
|
||||||
cv.only_with_esp_idf,
|
cv.only_with_esp_idf,
|
||||||
only_on_variant(supported=[VARIANT_ESP32P4]),
|
only_on_variant(supported=[VARIANT_ESP32P4]),
|
||||||
|
@ -17,6 +17,9 @@ class EspLdo : public Component {
|
|||||||
void set_adjustable(bool adjustable) { this->adjustable_ = adjustable; }
|
void set_adjustable(bool adjustable) { this->adjustable_ = adjustable; }
|
||||||
void set_voltage(float voltage) { this->voltage_ = voltage; }
|
void set_voltage(float voltage) { this->voltage_ = voltage; }
|
||||||
void adjust_voltage(float voltage);
|
void adjust_voltage(float voltage);
|
||||||
|
float get_setup_priority() const override {
|
||||||
|
return setup_priority::BUS; // LDO setup should be done early
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int channel_;
|
int channel_;
|
||||||
|
@ -6,6 +6,7 @@ esp_ldo:
|
|||||||
- id: ldo_4
|
- id: ldo_4
|
||||||
channel: 4
|
channel: 4
|
||||||
voltage: 2.0V
|
voltage: 2.0V
|
||||||
|
setup_priority: 900
|
||||||
|
|
||||||
esphome:
|
esphome:
|
||||||
on_boot:
|
on_boot:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user