Function esp_idf_svc::sys::nvs_get_i8
source · pub unsafe extern "C" fn nvs_get_i8(
handle: u32,
key: *const i8,
out_value: *mut i8,
) -> i32
Expand description
@{*/ /** @brief get int8_t value for given key
These functions retrieve value for the key, given its name. If \c key does not exist, or the requested variable type doesn’t match the type which was used when setting a value, an error is returned.
In case of any error, out_value is not modified.
\c out_value has to be a pointer to an already allocated variable of the given type.
\code{c} // Example of using nvs_get_i32: int32_t max_buffer_size = 4096; // default value esp_err_t err = nvs_get_i32(my_handle, “max_buffer_size”, &max_buffer_size); assert(err == ESP_OK || err == ESP_ERR_NVS_NOT_FOUND); // if ESP_ERR_NVS_NOT_FOUND was returned, max_buffer_size will still // have its default value.
\endcode
@param[in] handle Handle obtained from nvs_open function. @param[in] key Key name. Maximum length is (NVS_KEY_NAME_MAX_SIZE-1) characters. Shouldn’t be empty. @param out_value Pointer to the output value. May be NULL for nvs_get_str and nvs_get_blob, in this case required length will be returned in length argument.
@return - ESP_OK if the value was retrieved successfully - ESP_FAIL if there is an internal error; most likely due to corrupted NVS partition (only if NVS assertion checks are disabled) - ESP_ERR_NVS_NOT_FOUND if the requested key doesn’t exist - ESP_ERR_NVS_INVALID_HANDLE if handle has been closed or is NULL - ESP_ERR_NVS_INVALID_NAME if key name doesn’t satisfy constraints - ESP_ERR_NVS_INVALID_LENGTH if length is not sufficient to store data