Tactility/TactilityHeadless/Source/TactilityHeadlessEsp.cpp
Ken Van Hoeylandt c87200a80d
Project restructuring (fixes macOS builds) (#198)
- Create `Include/` folder for all main projects
- Fix some issues here and there (found while moving things)
- All includes are now in `Tactility/` subfolder and must be included with that prefix. This fixes issues with clashing POSIX headers (e.g. `<semaphore.h>` versus Tactility's `Semaphore.h`)
2025-02-01 18:13:20 +01:00

40 lines
784 B
C++

#ifdef ESP_PLATFORM
#include "Tactility/PartitionsEsp.h"
#include "Tactility/TactilityCore.h"
#include "esp_event.h"
#include "esp_netif.h"
#include "nvs_flash.h"
namespace tt {
#define TAG "tactility"
// Initialize NVS
static void initNvs() {
esp_err_t ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
TT_LOG_I(TAG, "nvs erasing");
ESP_ERROR_CHECK(nvs_flash_erase());
ret = nvs_flash_init();
}
ESP_ERROR_CHECK(ret);
TT_LOG_I(TAG, "nvs initialized");
}
static void initNetwork() {
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
}
void initEsp() {
initNvs();
initPartitionsEsp();
initNetwork();
}
} // namespace
#endif