Initial commit
This commit is contained in:
5
components/common/CMakeLists.txt
Normal file
5
components/common/CMakeLists.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
idf_component_register(
|
||||
SRCS "common.c"
|
||||
INCLUDE_DIRS "include"
|
||||
PRIV_REQUIRES spi_flash
|
||||
)
|
||||
17
components/common/Kconfig
Normal file
17
components/common/Kconfig
Normal file
@@ -0,0 +1,17 @@
|
||||
menu "LoRa common options"
|
||||
|
||||
choice LORA_ROLE
|
||||
prompt "Device role"
|
||||
default LORA_ROLE_TX
|
||||
help
|
||||
Виберіть роль прошивки за замовчуванням. Для кожної збірки можна
|
||||
вказати власні sdkconfig.defaults з потрібним вибором.
|
||||
|
||||
config LORA_ROLE_TX
|
||||
bool "Transmitter"
|
||||
|
||||
config LORA_ROLE_RX
|
||||
bool "Receiver"
|
||||
endchoice
|
||||
|
||||
endmenu
|
||||
44
components/common/common.c
Normal file
44
components/common/common.c
Normal file
@@ -0,0 +1,44 @@
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "esp_chip_info.h"
|
||||
#include "esp_flash.h"
|
||||
#include "esp_system.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
#define TAG "common"
|
||||
|
||||
void common_print_boot_info(void)
|
||||
{
|
||||
esp_chip_info_t chip_info;
|
||||
uint32_t flash_size = 0;
|
||||
esp_chip_info(&chip_info);
|
||||
|
||||
ESP_LOGI(TAG, "Chip: %s, cores: %d, features: %s%s%s%s",
|
||||
CONFIG_IDF_TARGET,
|
||||
chip_info.cores,
|
||||
(chip_info.features & CHIP_FEATURE_WIFI_BGN) ? "WiFi/" : "",
|
||||
(chip_info.features & CHIP_FEATURE_BT) ? "BT" : "",
|
||||
(chip_info.features & CHIP_FEATURE_BLE) ? "BLE" : "",
|
||||
(chip_info.features & CHIP_FEATURE_IEEE802154) ? ", 802.15.4" : "");
|
||||
|
||||
unsigned major_rev = chip_info.revision / 100;
|
||||
unsigned minor_rev = chip_info.revision % 100;
|
||||
ESP_LOGI(TAG, "Revision: v%u.%u", major_rev, minor_rev);
|
||||
|
||||
if (esp_flash_get_size(NULL, &flash_size) != ESP_OK) {
|
||||
ESP_LOGW(TAG, "Cannot read flash size");
|
||||
} else {
|
||||
ESP_LOGI(TAG, "Flash: %" PRIu32 " MB %s",
|
||||
flash_size / (uint32_t)(1024 * 1024),
|
||||
(chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external");
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "Min free heap: %" PRIu32 " bytes", esp_get_minimum_free_heap_size());
|
||||
|
||||
for (int i = 3; i > 0; i--) {
|
||||
ESP_LOGI(TAG, "Start in %d...", i);
|
||||
vTaskDelay(pdMS_TO_TICKS(500));
|
||||
}
|
||||
}
|
||||
5
components/common/include/common.h
Normal file
5
components/common/include/common.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "esp_chip_info.h"
|
||||
|
||||
void common_print_boot_info(void);
|
||||
Reference in New Issue
Block a user