feat(platform): adapt GPIO configuration to new board

This commit is contained in:
chenjintao
2026-10-23 15:37:22 +08:00
parent 6d103938ab
commit aede687dc9
10 changed files with 801 additions and 421 deletions
@@ -147,7 +147,7 @@ esp_err_t platform_battery_init(void)
};
esp_err_t gpio_err = gpio_config(&charge_config);
if (gpio_err != ESP_OK) {
ESP_LOGE(TAG, "Configure TP4057 status GPIO failed: %s", esp_err_to_name(gpio_err));
ESP_LOGE(TAG, "Configure charger status GPIO failed: %s", esp_err_to_name(gpio_err));
unlock_adc();
return gpio_err;
}
@@ -158,13 +158,15 @@ esp_err_t platform_battery_init(void)
esp_err_t err = adc_oneshot_io_to_channel(CONFIG_TQ_BATTERY_ADC_GPIO,
&unit,
&channel);
if (err != ESP_OK || unit != ADC_UNIT_1) {
/* 新板 GPIO17 属于 ADC2;通道和校准均使用 IDF 返回的实际单元。
* ADC2 仲裁/读取失败继续向上传播,不能把失败样本当作低电量。 */
if (err != ESP_OK) {
ESP_LOGE(TAG,
"Battery ADC GPIO%d is not a supported ADC1 input: %s",
"Battery ADC GPIO%d is not a supported ADC input: %s",
CONFIG_TQ_BATTERY_ADC_GPIO,
esp_err_to_name(err));
unlock_adc();
return err != ESP_OK ? err : ESP_ERR_NOT_SUPPORTED;
return err;
}
adc_oneshot_unit_init_cfg_t unit_config = {