feat(platform): adapt GPIO configuration to new board
This commit is contained in:
@@ -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 = {
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
#define PLATFORM_IO_EFFECTS_TASK_CORE ((BaseType_t)CONFIG_TQ_LOCAL_TASK_CORE)
|
||||
#endif
|
||||
|
||||
/* GPIO4、GPIO5和22颗灯珠来自当前 PCB 布线/灯带布局,换板时必须同步核对原理图。 */
|
||||
/* 旧板外接 GPIO4/5 与22颗灯珠方案;新板已将这两脚分配给 LCD,
|
||||
* 平台初始化不再调用本模块。保留实现供历史参考,不作为新板马达驱动。 */
|
||||
#define PLATFORM_RMT_GPIO GPIO_NUM_4
|
||||
#define PLATFORM_PULSE_GPIO GPIO_NUM_5
|
||||
|
||||
|
||||
@@ -283,10 +283,8 @@ esp_err_t platform_init(void)
|
||||
|
||||
platform_power_hold_init();
|
||||
|
||||
esp_err_t io_effects_err = platform_io_effects_init();
|
||||
if (io_effects_err != ESP_OK) {
|
||||
ESP_LOGW(TAG, "IO effects init failed: %s", esp_err_to_name(io_effects_err));
|
||||
}
|
||||
/* 新板 GPIO4/5 分别为 LCD BLK/CS;不启动旧灯带和脉冲任务。
|
||||
* GPIO10 摇臂驱动尚未接入,保持硬件下拉关断。 */
|
||||
|
||||
#if CONFIG_TQ_STEPPER_ENABLE
|
||||
err = platform_stepper_driver_init();
|
||||
|
||||
Reference in New Issue
Block a user