Skip to content
This repository was archived by the owner on Dec 29, 2023. It is now read-only.

Commit 7016951

Browse files
Leonid KabanovLeonid Kabanov
Leonid Kabanov
authored and
Leonid Kabanov
committed
Add missing functions
1 parent 55a56bd commit 7016951

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

CPPNVS.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ int NVS::get(std::string key, uint32_t& value) {
101101
return ::nvs_get_u32(m_handle, key.c_str(), &value);
102102
} // get - uint32_t
103103

104+
int NVS::get(std::string key, int32_t& value) {
105+
return ::nvs_get_i32(m_handle, key.c_str(), &value);
106+
} // get - int32_t
107+
108+
int NVS::get(std::string key, uint8_t& value) {
109+
return ::nvs_get_u8(m_handle, key.c_str(), &value);
110+
} // get - int32_t
104111

105112
int NVS::get(std::string key, uint8_t* result, size_t& length) {
106113
ESP_LOGD(LOG_TAG, ">> get: key: %s, blob: inputSize: %d", key.c_str(), length);
@@ -137,6 +144,18 @@ void NVS::set(std::string key, uint32_t value) {
137144
ESP_LOGD(LOG_TAG, "<< set");
138145
} // set - uint32_t
139146

147+
void NVS::set(std::string key, int32_t value) {
148+
ESP_LOGD(LOG_TAG, ">> set: key: %s, i32: value=%d", key.c_str(), value);
149+
::nvs_set_i32(m_handle, key.c_str(), value);
150+
ESP_LOGD(LOG_TAG, "<< set");
151+
} // set - int32_t
152+
153+
void NVS::set(std::string key, uint8_t value) {
154+
ESP_LOGD(LOG_TAG, ">> set: key: %s, u8: value=%d", key.c_str(), value);
155+
::nvs_set_u8(m_handle, key.c_str(), value);
156+
ESP_LOGD(LOG_TAG, "<< set");
157+
} // set - uint8_t
158+
140159

141160
void NVS::set(std::string key, uint8_t* data, size_t length) {
142161
ESP_LOGD(LOG_TAG, ">> set: key: %s, blob: length=%d", key.c_str(), length);

CPPNVS.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@ class NVS {
2424
int get(std::string key, std::string* result, bool isBlob = false);
2525
int get(std::string key, uint8_t* result, size_t& length);
2626
int get(std::string key, uint32_t& value);
27+
int get(std::string key, int32_t& value);
28+
int get(std::string key, uint8_t& value);
2729
void set(std::string key, std::string data, bool isBlob = false);
2830
void set(std::string key, uint32_t value);
31+
void set(std::string key, int32_t value);
32+
void set(std::string key, uint8_t value);
2933
void set(std::string key, uint8_t* data, size_t length);
3034

3135
private:

0 commit comments

Comments
 (0)