mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-09 20:41:14 +00:00
adc: update adc calibration efuse version
ADC calibration scheme and algorithm are not changed. Only the eFuse bit BLOCK1_VERSION is changed. This MR updated the logic to recognize the adc efuse version
This commit is contained in:
@@ -19,20 +19,15 @@
|
||||
|
||||
int esp_efuse_rtc_calib_get_ver(void)
|
||||
{
|
||||
uint32_t blk1_version = 0;
|
||||
uint32_t blk2_version = 0;
|
||||
ESP_ERROR_CHECK(esp_efuse_read_field_blob(ESP_EFUSE_BLOCK1_VERSION, &blk1_version, ESP_EFUSE_BLOCK1_VERSION[0]->bit_count));
|
||||
ESP_ERROR_CHECK(esp_efuse_read_field_blob(ESP_EFUSE_BLOCK2_VERSION, &blk2_version, ESP_EFUSE_BLOCK2_VERSION[0]->bit_count));
|
||||
uint32_t blk_ver_major = 0;
|
||||
ESP_ERROR_CHECK(esp_efuse_read_field_blob(ESP_EFUSE_BLK_VER_MAJOR, &blk_ver_major, ESP_EFUSE_BLK_VER_MAJOR[0]->bit_count));
|
||||
|
||||
if (blk1_version == blk2_version) {
|
||||
return blk1_version;
|
||||
} else {
|
||||
blk1_version = 0;
|
||||
blk2_version = 0;
|
||||
uint32_t cali_version_v1 = (blk_ver_major == 1) ? 1 : 0;
|
||||
if (!cali_version_v1) {
|
||||
ESP_LOGW("eFuse", "calibration efuse version does not match, set default version: %d", 0);
|
||||
}
|
||||
|
||||
return blk2_version;
|
||||
return cali_version_v1;
|
||||
}
|
||||
|
||||
uint16_t esp_efuse_rtc_calib_get_init_code(int version, uint32_t adc_unit, int atten)
|
||||
|
Reference in New Issue
Block a user