Merge branch 'doc/RF_calibration' into 'master'

doc: add documentation for RF calibration

See merge request idf/esp-idf!3828
This commit is contained in:
Jiang Jiang Jian
2018-11-30 21:50:29 +08:00
6 changed files with 99 additions and 1 deletions

View File

@@ -156,6 +156,18 @@ esp_err_t esp_phy_load_cal_data_from_nvs(esp_phy_calibration_data_t* out_cal_dat
*/
esp_err_t esp_phy_store_cal_data_to_nvs(const esp_phy_calibration_data_t* cal_data);
/**
* @brief Erase PHY calibration data which is stored in the NVS
*
* This is a function which can be used to trigger full calibration as a last-resort remedy
* if partial calibration is used. It can be called in the application based on some conditions
* (e.g. an option provided in some diagnostic mode).
*
* @return ESP_OK on success
* @return others on fail. Please refer to NVS API return value error number.
*/
esp_err_t esp_phy_erase_cal_data_in_nvs(void);
/**
* @brief Initialize PHY and RF module
*

View File

@@ -471,6 +471,30 @@ esp_err_t esp_phy_store_cal_data_to_nvs(const esp_phy_calibration_data_t* cal_da
}
}
esp_err_t esp_phy_erase_cal_data_in_nvs(void)
{
nvs_handle handle;
esp_err_t err = nvs_open(PHY_NAMESPACE, NVS_READWRITE, &handle);
if (err != ESP_OK) {
ESP_LOGE(TAG, "%s: failed to open NVS phy namespace (0x%x)", __func__, err);
return err;
}
else {
err = nvs_erase_all(handle);
if (err != ESP_OK) {
ESP_LOGE(TAG, "%s: failed to erase NVS phy namespace (0x%x)", __func__, err);
}
else {
err = nvs_commit(handle);
if (err != ESP_OK) {
ESP_LOGE(TAG, "%s: failed to commit NVS phy namespace (0x%x)", __func__, err);
}
}
}
nvs_close(handle);
return err;
}
static esp_err_t load_cal_data_from_nvs_handle(nvs_handle handle,
esp_phy_calibration_data_t* out_cal_data)
{