SimovaTrack V4.7.0
Simova Track codebase, written for testing and deployment for Simova
Loading...
Searching...
No Matches
entrypoint_esp32dev.h
Go to the documentation of this file.
1#pragma once
2#warning "Entrypoint ESP32 Dev"
3
4#include <Arduino.h>
5#include "esp_log.h"
6#include <string>
7
8
9String getResetReason(esp_reset_reason_t reason)
10{
11 switch (reason)
12 {
13 case ESP_RST_UNKNOWN:
14 return "Unknown";
15 case ESP_RST_POWERON:
16 return "Power on";
17 case ESP_RST_EXT:
18 return "External";
19 case ESP_RST_SW:
20 return "Software";
21 case ESP_RST_PANIC:
22 return "Exception/panic";
23 case ESP_RST_INT_WDT:
24 return "Interrupt watchdog";
25 case ESP_RST_TASK_WDT:
26 return "Task watchdog";
27 case ESP_RST_WDT:
28 return "Other watchdog";
29 case ESP_RST_DEEPSLEEP:
30 return "Deep sleep";
31 case ESP_RST_BROWNOUT:
32 return "Brownout";
33 case ESP_RST_SDIO:
34 return "SDIO";
35 default:
36 return "Unknown";
37 }
38}
39
41{
42 /* Print chip information */
43 esp_chip_info_t chip_info;
44 uint32_t flash_size;
45 esp_chip_info(&chip_info);
46 unsigned major_rev = chip_info.revision / 100;
47 unsigned minor_rev = chip_info.revision % 100;
48
49 ESP_LOGI("INFO",
50 "This is %s chip with %d CPU core(s), " // Chip type and core count
51 "%s" // WiFi capability
52 "%s" // Bluetooth Classic capability
53 "%s" // BLE capability
54 "%s, " // IEEE 802.15.4 (Zigbee/Thread) capability
55 "silicon revision v%d.%d", // Silicon revision
56 CONFIG_IDF_TARGET, // Chip type (e.g., ESP32)
57 chip_info.cores, // Number of CPU cores
58 (chip_info.features & CHIP_FEATURE_WIFI_BGN) ? "WiFi/" : "", // WiFi support
59 (chip_info.features & CHIP_FEATURE_BT) ? "BT" : "", // Bluetooth Classic support
60 (chip_info.features & CHIP_FEATURE_BLE) ? "BLE" : "", // BLE support
61 (chip_info.features & CHIP_FEATURE_IEEE802154) ? ", 802.15.4 (Zigbee/Thread)" : "", // IEEE 802.15.4 support
62 major_rev, minor_rev); // Major and minor silicon revision numbers
63
64 if (esp_flash_get_size(NULL, &flash_size) != ESP_OK)
65 {
66 ESP_LOGE("INFO", "Get flash size failed");
67 }
68 else
69 {
70 ESP_LOGI("INFO", "%" PRIu32 "MB %s flash", flash_size / (uint32_t)(1024 * 1024),
71 (chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external");
72 }
73
74 ESP_LOGI("INFO", "Minimum free heap size now: %" PRIu32 " bytes", esp_get_minimum_free_heap_size());
75
76 ESP_LOGI("INFO", "CPU FREQ %d | SDK VERSION %s", getCpuFrequencyMhz(),
77 esp_get_idf_version());
78
79 esp_reset_reason_t reset_reason = esp_reset_reason();
80 String reset_cause = getResetReason(reset_reason);
81 ESP_LOGI("INFO", "LAST RESET REASON: %s", reset_cause.c_str());
82 ESP_LOGI("AUTHOR", "github/italocjs");
83}
84
86{
87 Serial.begin(115200);
88 Serial.println("Hello from ESP32 Dev setup"); //using arduino function to demonstrate accessibility to Arduino Framework
89 ESP_LOGI("SETUP", "Hello from ESP32 Dev setup"); //using esp_log function to demonstrate accessibility to ESP-IDF
91}
92
94{
95 Serial.println("Hello from ESP32 Dev loop"); //using arduino function to demonstrate accessibility to Arduino Framework
96 ESP_LOGI("LOOP", "Hello from ESP32 Dev loop"); //using esp_log function to demonstrate accessibility to ESP-IDF
97 delay(1000);
98}
99
void abstracted_loop()
Definition entrypoint_esp32dev.h:93
String getResetReason(esp_reset_reason_t reason)
Definition entrypoint_esp32dev.h:9
void print_device_information()
Definition entrypoint_esp32dev.h:40
void abstracted_setup()
Definition entrypoint_esp32dev.h:85