1#ifdef USE_ESP32_VARIANT_ESP32P4
9static const char *
const TAG =
"esp_ldo";
11 esp_ldo_channel_config_t config{};
13 config.voltage_mv = (int) (this->
voltage_ * 1000.0f);
15 auto err = esp_ldo_acquire_channel(&config, &this->
handle_);
20 ESP_LOGD(TAG,
"Acquired LDO channel %d with voltage %fV", this->
channel_, this->
voltage_);
24 ESP_LOGCONFIG(TAG,
"ESP LDO Channel %d:", this->
channel_);
25 ESP_LOGCONFIG(TAG,
" Voltage: %fV", this->
voltage_);
26 ESP_LOGCONFIG(TAG,
" Adjustable: %s", YESNO(this->
adjustable_));
30 if (!std::isfinite(voltage) || voltage < 0.5f || voltage > 2.7f) {
31 ESP_LOGE(TAG,
"Invalid voltage %fV for LDO channel %d", voltage, this->
channel_);
34 auto erro = esp_ldo_channel_adjust_voltage(this->
handle_, (
int) (voltage * 1000.0f));
36 ESP_LOGE(TAG,
"Failed to adjust LDO channel %d to voltage %fV: %s", this->
channel_, voltage, esp_err_to_name(erro));
virtual void mark_failed()
Mark this component as failed.
void adjust_voltage(float voltage)
void dump_config() override
esp_ldo_channel_handle_t handle_
Providing packet encoding functions for exchanging data with a remote host.
std::string str_sprintf(const char *fmt,...)