2020-01-29 20:51:49 +00:00
|
|
|
#include <time.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <sys/fcntl.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include "esp_system.h"
|
|
|
|
#include "driver/gpio.h"
|
|
|
|
#include "esp_system.h"
|
|
|
|
#include "esp_heap_alloc_caps.h"
|
|
|
|
|
2020-01-31 19:54:19 +00:00
|
|
|
#include "esp_log.h"
|
|
|
|
static const char *TAG = "main";
|
2020-01-29 20:51:49 +00:00
|
|
|
|
2020-02-02 00:04:10 +00:00
|
|
|
#include "core/common.h"
|
2020-01-31 19:54:19 +00:00
|
|
|
#include "config.h"
|
2020-02-02 00:04:10 +00:00
|
|
|
#include "core/buttons.h"
|
|
|
|
#include "core/storage.h"
|
|
|
|
#include "core/display.h"
|
|
|
|
|
|
|
|
#include "modes/ModeRunner.h"
|
|
|
|
#include "modes/BootMode.h"
|
2020-02-02 15:08:37 +00:00
|
|
|
#include "modes/MainMenuMode.h"
|
2020-01-29 22:50:03 +00:00
|
|
|
|
2020-01-29 21:50:57 +00:00
|
|
|
|
2020-01-29 20:51:49 +00:00
|
|
|
static struct tm* tm_info;
|
|
|
|
static char tmp_buff[128];
|
|
|
|
static time_t time_now, time_last = 0;
|
|
|
|
static const char *file_fonts[3] = {"/spiffs/fonts/DotMatrix_M.fon", "/spiffs/fonts/Ubuntu.fon", "/spiffs/fonts/Grotesk24x48.fon"};
|
|
|
|
static const char tag[] = "[LilyBook]";
|
|
|
|
esp_err_t ret;
|
|
|
|
|
|
|
|
extern "C" void app_main()
|
|
|
|
{
|
2020-01-31 19:54:19 +00:00
|
|
|
printf("\n LilyBook v%s\n\n", APP_VERSION);
|
2020-01-29 22:50:03 +00:00
|
|
|
|
2020-01-31 19:54:19 +00:00
|
|
|
storage_init();
|
|
|
|
buttons_init();
|
2020-01-29 20:51:49 +00:00
|
|
|
display_init();
|
|
|
|
spi_init();
|
|
|
|
|
2020-02-02 00:04:10 +00:00
|
|
|
delay(500);
|
2020-01-29 20:51:49 +00:00
|
|
|
|
|
|
|
display_connect();
|
2020-01-31 05:46:35 +00:00
|
|
|
|
|
|
|
printf("==== START ====\r\n\n");
|
2020-01-29 21:50:57 +00:00
|
|
|
|
2020-02-02 00:04:10 +00:00
|
|
|
getModeRunner()->init();
|
|
|
|
getModeRunner()->startMainMode(new BootMode());
|
2020-02-02 15:08:37 +00:00
|
|
|
|
2020-01-29 21:50:57 +00:00
|
|
|
while (1) {
|
2020-02-02 00:04:10 +00:00
|
|
|
getModeRunner()->loop();
|
2020-01-29 20:51:49 +00:00
|
|
|
}
|
|
|
|
}
|