Added espstrutils

This commit is contained in:
2021-04-07 22:22:55 +02:00
parent a00a39a8f4
commit d8af81ddd9
3 changed files with 31 additions and 0 deletions

View File

@ -1,6 +1,7 @@
set(headers
src/espcrc32builder.h
src/esprandom.h
src/espstrutils.h
src/lockhelper.h
src/lockingqueue.h
src/recursivelockhelper.h
@ -18,6 +19,7 @@ set(headers
set(sources
src/espchrono_impl.cpp
src/espstrutils.cpp
src/taskutils.cpp
)

16
src/espstrutils.cpp Normal file
View File

@ -0,0 +1,16 @@
#include "espstrutils.h"
namespace espcpputils {
std::string toString(sntp_sync_mode_t val)
{
switch (val)
{
case SNTP_SYNC_MODE_IMMED: return "SNTP_SYNC_MODE_IMMED";
case SNTP_SYNC_MODE_SMOOTH: return "SNTP_SYNC_MODE_SMOOTH";
}
return std::string{"Unknown sntp_sync_mode_t("} + std::to_string(int(val)) + ')';
}
} // namespace espcpputils

13
src/espstrutils.h Normal file
View File

@ -0,0 +1,13 @@
#pragma once
// system includes
#include <string>
// esp-idf includes
#include <esp_sntp.h>
namespace espcpputils {
std::string toString(sntp_sync_mode_t val);
} // namespace espcpputils