42 lines
891 B
C
42 lines
891 B
C
#include <stdio.h>
|
|
|
|
#include "driver/gpio.h"
|
|
#include "esp_spi_flash.h"
|
|
#include "esp_system.h"
|
|
#include "nvs_flash.h"
|
|
#include "sdkconfig.h"
|
|
//
|
|
#include "freertos/FreeRTOS.h"
|
|
#include "freertos/task.h"
|
|
//
|
|
#include "impl_lvgl.h"
|
|
#include "if_standby.h"
|
|
|
|
static esp_err_t app_init_nvs(void) {
|
|
esp_err_t ret = nvs_flash_init();
|
|
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
|
ESP_ERROR_CHECK(nvs_flash_erase());
|
|
ret = nvs_flash_init();
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
static esp_err_t app_init_gpio(void) { return gpio_install_isr_service(0); }
|
|
|
|
esp_err_t impl_lvgl_init(void);
|
|
|
|
void app_main(void) {
|
|
ESP_ERROR_CHECK(app_init_nvs());
|
|
ESP_ERROR_CHECK(app_init_gpio());
|
|
|
|
ESP_ERROR_CHECK(impl_lvgl_init());
|
|
|
|
ESP_ERROR_CHECK(if_standby_init());
|
|
|
|
/* Dead loop */
|
|
for (;;) {
|
|
vTaskDelay(pdMS_TO_TICKS(60000));
|
|
}
|
|
}
|