bt: call nvs_flash_init in examples, show error if NVS is not initialized

NVS is used to store PHY calibration data, WiFi configuration, and BT
configuration. Previously BT examples did not call nvs_flash_init,
relying on the fact that it is called during PHY init. However PHY init
did not handle possible NVS initialization errors.

This change moves PHY init procedure into the application, and adds
diagnostic messages to BT config management routines if NVS is not
initialized.
This commit is contained in:
Ivan Grokhotkov
2017-07-13 23:46:19 +08:00
parent 1ed4eadfab
commit 979fce0df5
17 changed files with 132 additions and 31 deletions
+13
View File
@@ -18,6 +18,8 @@
extern "C" {
#endif
#include "nvs.h"
/**
* @brief Initialize NVS flash storage with layout given in the partition table.
*
@@ -30,6 +32,17 @@ extern "C" {
esp_err_t nvs_flash_init(void);
/**
* @brief Erase NVS partition
*
* This function erases all contents of NVS partition
*
* @return
* - ESP_OK on success
* - ESP_ERR_NOT_FOUND if there is no NVS partition in the partition table
*/
esp_err_t nvs_flash_erase(void);
#ifdef __cplusplus
}
#endif