Exemplos do livro Microcontroladores ESP32 como projetos PlatformIO
Compilar exemplos / esp32 (push) Canceled after 21m59s
Compilar exemplos / esp32c2 (push) Canceled after 0s
Compilar exemplos / esp32c3 (push) Canceled after 0s
Compilar exemplos / esp32c5 (push) Canceled after 0s
Compilar exemplos / esp32c6 (push) Canceled after 0s
Compilar exemplos / esp32c61 (push) Canceled after 0s
Compilar exemplos / esp32h2 (push) Canceled after 0s
Compilar exemplos / esp32p4 (push) Canceled after 0s
Compilar exemplos / esp32s2 (push) Canceled after 0s
Compilar exemplos / esp32s3 (push) Canceled after 0s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas RayanandClaude Opus 5.5 committed 2026-11-10 12:10:42 -03:00
commit 5f5506c55c
592 files changed
+12559

No files matched your search

@@ -0,0 +1,3 @@
cmake_minimum_required(VERSION 3.16)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(dados_fabrica)
@@ -0,0 +1,2 @@
idf_component_register(SRCS "main.c"
INCLUDE_DIRS ".")
@@ -0,0 +1,42 @@
#include <stdio.h>
#include <inttypes.h>
#include "esp_mac.h"
#include "esp_chip_info.h"
#include "esp_flash.h"
#include "esp_app_desc.h"
#include "nvs_flash.h"
#include "nvs.h"
static bool le_texto(nvs_handle_t h, const char *chave, char *buf, size_t tam)
{
size_t n = tam;
return nvs_get_str(h, chave, buf, &n) == ESP_OK;
}
void app_main(void)
{
char serie[16] = "?", lote[8] = "?", modelo[16] = "?";
uint8_t hw = 0;
bool ok = false;
nvs_handle_t h;
if (nvs_flash_init_partition("fabrica") == ESP_OK &&
nvs_open_from_partition("fabrica", "fab", NVS_READONLY, &h) == ESP_OK) {
ok = le_texto(h, "serie", serie, sizeof(serie)) &&
le_texto(h, "lote", lote, sizeof(lote)) &&
le_texto(h, "modelo", modelo, sizeof(modelo)) &&
nvs_get_u8(h, "hw_rev", &hw) == ESP_OK;
nvs_close(h);
}
uint8_t mac[6];
esp_efuse_mac_get_default(mac);
uint32_t flash = 0;
esp_flash_get_physical_size(NULL, &flash);
esp_chip_info_t chip;
esp_chip_info(&chip);
/* Uma linha só, fácil de a estação de teste ler e arquivar. */
printf("FAB;%s;%s;%s;hw%u;" MACSTR ";rev%u;%" PRIu32 "MB;fw%s;%s\n",
serie, lote, modelo, hw, MAC2STR(mac), chip.revision, flash >> 20,
esp_app_get_description()->version, ok ? "PASSOU" : "FALHOU");
}
@@ -0,0 +1,5 @@
# Nome, Tipo, Subtipo, Offset, Tamanho
nvs, data, nvs, 0x9000, 0x6000
phy_init, data, phy, 0xf000, 0x1000
fabrica, data, nvs, 0x10000, 0x6000
factory, app, factory, 0x20000, 1M
1 # Nome Tipo Subtipo Offset Tamanho
2 nvs data nvs 0x9000 0x6000
3 phy_init data phy 0xf000 0x1000
4 fabrica data nvs 0x10000 0x6000
5 factory app factory 0x20000 1M
@@ -0,0 +1,31 @@
; Projeto PlatformIO. Compile com: pio run -e <série>
; Grave e abra o monitor: pio run -e <série> -t upload -t monitor
[platformio]
default_envs = esp32
src_dir = main
[env]
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.312/platform-espressif32.zip
framework = espidf
monitor_speed = 115200
[env:esp32]
board = esp32dev
[env:esp32s3]
board = esp32-s3-devkitc-1
[env:esp32c2]
board = esp32-c2-devkitm-1
[env:esp32c3]
board = esp32-c3-devkitm-1
[env:esp32c6]
board = esp32-c6-devkitc-1
[env:esp32h2]
board = esp32-h2-devkitm-1
[env:esp32p4]
board = esp32-p4-evboard
@@ -0,0 +1,2 @@
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"