Files
mains-frequency-counter-esp32/src/main/app_main.c
2021-03-09 20:01:22 +01:00

48 lines
932 B
C

#include <stdio.h>
#include <string.h>
#include "network_mngr.h"
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include <freertos/event_groups.h>
#include <esp_log.h>
#include <esp_wifi.h>
#include <esp_event.h>
#include <nvs_flash.h>
#include "gpio.h"
#include "counter.h"
static const char *TAG = "app";
void deviceInit() {
/* Initialize NVS partition */
esp_err_t ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
/* NVS partition was truncated
* and needs to be erased */
ESP_ERROR_CHECK(nvs_flash_erase());
/* Retry nvs_flash_init */
ESP_ERROR_CHECK(nvs_flash_init());
}
}
void app_main(void)
{
deviceInit();
counterInit();
gpioInit();
networkInit(isGpioForceProv());
/* Start main application now */
while (1) {
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}