Initial code import

This commit is contained in:
2021-10-03 17:51:12 +02:00
parent c2deb42b10
commit 08e62500ea
25 changed files with 1248 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
#include "configwrapperinterface.h"
#include "sdkconfig.h"
#define LOG_LOCAL_LEVEL CONFIG_LOG_LOCAL_LEVEL_CONFIG
// system includes
#include <cstring>
#include <cassert>
// esp-idf includes
#include <esp_log.h>
#include <nvs.h>
namespace espconfig {
namespace {
constexpr const char * const TAG = "CONFIG";
} // namespace
ConfigWrapperInterface::ConfigWrapperInterface(AllowReset allowReset, const char *nvsName) :
m_allowReset{allowReset == AllowReset::DoReset},
m_nvsName{nvsName}
{
{
const auto length = std::strlen(nvsName);
if (length >= NVS_KEY_NAME_MAX_SIZE)
ESP_LOGE(TAG, "invalid nvs key %s (too long %zd)", nvsName, length);
assert(length < NVS_KEY_NAME_MAX_SIZE);
}
}
} // namespace espconfig