mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	[esp_ldo] Component schema; default priority (#9479)
This commit is contained in:
		| @@ -20,6 +20,7 @@ adjusted_ids = set() | ||||
|  | ||||
| CONFIG_SCHEMA = cv.All( | ||||
|     cv.ensure_list( | ||||
|         cv.COMPONENT_SCHEMA.extend( | ||||
|             { | ||||
|                 cv.GenerateID(): cv.declare_id(EspLdo), | ||||
|                 cv.Required(CONF_VOLTAGE): cv.All( | ||||
| @@ -28,6 +29,7 @@ CONFIG_SCHEMA = cv.All( | ||||
|                 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]), | ||||
|   | ||||
| @@ -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_; | ||||
|   | ||||
| @@ -6,6 +6,7 @@ esp_ldo: | ||||
|   - id: ldo_4 | ||||
|     channel: 4 | ||||
|     voltage: 2.0V | ||||
|     setup_priority: 900 | ||||
|  | ||||
| esphome: | ||||
|   on_boot: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user