NVS Component

Installation

The component requires ESP-IDF 5.0 and higher and is installed using IDF Component Manager.

Add this to the idf_component.yml in the project main directory or in the component directory:

dependencies:
  plasmapper/pl_nvs: "^1.0.0"

Add this to the source code:

#include "pl_nvs.h"

Add extern "C" to the app_main function:

extern "C" void app_main(void) {...}

Add this to the sdkconfig.defaults in the project directory or configure the values using Project Configuration:

CONFIG_COMPILER_CXX_RTTI=y

Features

  1. PL::NvsNamespace - an NVS namespace class. It is initialized with a namespace name and a partition name (optional). A number of PL::NvsNamespace::Read() and PL::NvsNamespace::Write() functions read and write from/to the NVS. PL::NvsNamespace::Erase() functions erase one or all values. PL::NvsNamespace::Commit() writes any pending changes to the NVS.

Thread safety

Class method thread safety is implemented by having the PL::Lockable as a base class and creating the class object lock guard at the beginning of the methods.

API reference