Merge TactilityHeadless into Tactility (#263)
There currently is no practical use to have TactilityHeadless as a subproject. I'm merging it with the Tactility project.
This commit is contained in:
committed by
GitHub
parent
d0ca3b16f8
commit
d72852a6e2
@@ -0,0 +1,34 @@
|
||||
#include "Tactility/network/NtpPrivate.h"
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
#include <Tactility/kernel/SystemEvents.h>
|
||||
#include <Tactility/TactilityCore.h>
|
||||
#include <esp_netif_sntp.h>
|
||||
#include <esp_sntp.h>
|
||||
#endif
|
||||
|
||||
#define TAG "ntp"
|
||||
|
||||
namespace tt::network::ntp {
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
static void onTimeSynced(struct timeval* tv) {
|
||||
TT_LOG_I(TAG, "Time synced (%llu)", tv->tv_sec);
|
||||
kernel::systemEventPublish(kernel::SystemEvent::Time);
|
||||
}
|
||||
|
||||
void init() {
|
||||
esp_sntp_config_t config = ESP_NETIF_SNTP_DEFAULT_CONFIG("pool.ntp.org");
|
||||
config.sync_cb = onTimeSynced;
|
||||
esp_netif_sntp_init(&config);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void init() {
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user