60 lines
1.3 KiB
C
60 lines
1.3 KiB
C
#include <stdio.h>
|
|
|
|
#include "freertos/FreeRTOS.h"
|
|
#include "freertos/task.h"
|
|
#include "freertos/queue.h"
|
|
|
|
#include "esp_log.h"
|
|
|
|
#include "app_lib_wifi_impl.h"
|
|
#include "app_lib_fs_impl.h"
|
|
#include "app_lib_pm_impl.h"
|
|
|
|
#include "user_board.h"
|
|
|
|
#include "app_task.h"
|
|
|
|
void app_lib_i2c_system_init(void);
|
|
|
|
static const char *TAG = "APP_MAIN";
|
|
|
|
void app_main(void) {
|
|
// Init system peripherals.
|
|
app_lib_i2c_system_init();
|
|
|
|
//app_lib_pm_init();
|
|
|
|
app_lib_init_wifi();
|
|
app_lib_start_wifi();
|
|
|
|
app_lib_fs_init();
|
|
|
|
ESP_LOGI(TAG, "System initialized, starting tasks.");
|
|
|
|
// Init tasks
|
|
if(xTaskCreate(vTaskLEDs, "TASK_LEDs", 1024, NULL, 4, &xTaskLEDsHandle) != pdPASS) {
|
|
ESP_LOGE(TAG, "Task LED creation failed.");
|
|
for(;;) {
|
|
vTaskSuspend(NULL);
|
|
}
|
|
}
|
|
if(xTaskCreate(vTasBatteryExample, "TASK_BAT", 2048, NULL, 4, &xTaskBatteryExampleHandle) != pdPASS) {
|
|
ESP_LOGE(TAG, "Task BAT creation failed.");
|
|
for(;;) {
|
|
vTaskSuspend(NULL);
|
|
}
|
|
}
|
|
if(xTaskCreate(vTaskEPDExample, "TASK_EPD", 2048, NULL, 4, &xTaskEPDExampleHandle) != pdPASS) {
|
|
ESP_LOGE(TAG, "Task EPD creation failed.");
|
|
for(;;) {
|
|
vTaskSuspend(NULL);
|
|
}
|
|
}
|
|
|
|
ESP_LOGI(TAG, "Task created, suspending current task.");
|
|
|
|
for(;;) {
|
|
vTaskSuspend(NULL);
|
|
}
|
|
}
|