Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include "freertos/FreeRTOS.h"
- #include "freertos/task.h"
- #include "freertos/timers.h"
- #include "esp_system.h"
- #include "esp_spi_flash.h"
- #include "driver/gpio.h"
- #include "esp_err.h"
- #include "power_monitor/power_monitor.h"
- #include "esp_log.h"
- static const char* TAG = "main";
- void app_main()
- {
- ESP_LOGI(TAG, "System boot!");
- // Get chip information and output it
- esp_chip_info_t chip_info;
- esp_chip_info(&chip_info);
- ESP_LOGI(TAG, "ESP32 with %d CPU cores. Revision %d.",
- chip_info.cores,
- chip_info.revision);
- // Flash information
- ESP_LOGI(TAG, "%dMB %s flash\n", spi_flash_get_chip_size() / (1024 * 1024),
- (chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external");
- fflush(stdout);
- esp_err_t err = ESP_OK;
- ESP_LOGI(TAG, "Initializing systems");
- // Install gpio isr service
- gpio_install_isr_service(ESP_INTR_FLAG_IRAM);
- // Give some time to circuits to power-up
- vTaskDelay(pdMS_TO_TICKS(500));
- err = power_monitor_init();
- ESP_LOGI(TAG, "RAM left %d bytes", esp_get_free_heap_size());
- if(err == ESP_OK)
- {
- ESP_LOGI(TAG, "Systems ready!");
- }
- else
- {
- ESP_LOGE(TAG, "System init failed!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement