import Header from "@/components/Header";
import Footer from "@/components/Footer";
import BookCover from "@/components/BookCover";
import Link from "next/link";
import seriesDataPt from "@/public/series.json";
import frameworksDataPt from "@/public/frameworks.json";
import seriesDataEn from "@/data/en/series.json";
import frameworksDataEn from "@/data/en/frameworks.json";
import { SITE } from "@/lib/seo";
import { getLocalizedHref } from "@/i18n/links";
import {
AlertTriangle,
ArrowRight,
ArrowUpRight,
BookOpen,
Box,
Cpu,
Scale,
SlidersHorizontal,
Terminal,
} from "lucide-react";
const FEATURED = ["ESP32", "ESP32-S3", "ESP32-C6", "ESP32-C3", "ESP32-P4", "ESP32-H2"];
const TOOLS_PT = [
{
href: "/seletor",
title: "Seletor inteligente",
desc: "Responda oito perguntas sobre o projeto e receba os chips mais compatíveis, com justificativa técnica.",
icon: SlidersHorizontal,
action: "Encontrar meu chip",
},
{
href: "/comparacao",
title: "Comparador de séries",
desc: "Coloque até quatro modelos lado a lado e compare núcleos, rádio, memória, periféricos e segurança.",
icon: Scale,
action: "Comparar agora",
},
{
href: "/diagnostico",
title: "Diagnóstico de falhas",
desc: "Causas e correções para brownout, bootloop, Guru Meditation, watchdog e falhas de flash.",
icon: AlertTriangle,
action: "Abrir diagnóstico",
},
{
href: "/componentes",
title: "Component Registry",
desc: "Drivers, bibliotecas e BSPs do registro oficial da Espressif, com manifesto pronto para o projeto.",
icon: Box,
action: "Explorar componentes",
},
{
href: "/frameworks",
title: "Frameworks e SDKs",
desc: "ESP-IDF, Arduino, Rust, Matter, MicroPython e as ferramentas que ficam em volta do chip.",
icon: Terminal,
action: "Ver frameworks",
},
{
href: "/catalogo",
title: "Catálogo de placas",
desc: "DevKits e módulos reais, com interface USB, sensores integrados e link para a loja oficial.",
icon: Cpu,
action: "Ver placas",
},
];
const TOOLS_EN = [
{
href: "/seletor",
title: "Smart Selector",
desc: "Answer eight questions about your project and find recommended chips, backed by technical rationale.",
icon: SlidersHorizontal,
action: "Find my chip",
},
{
href: "/comparacao",
title: "Series Comparator",
desc: "Place up to four models side by side and compare cores, radio, memory, peripherals, and security.",
icon: Scale,
action: "Compare now",
},
{
href: "/diagnostico",
title: "Fault Diagnostics",
desc: "Root causes and fixes for brownout, bootloop, Guru Meditation, watchdog, and flash errors.",
icon: AlertTriangle,
action: "Open diagnostics",
},
{
href: "/componentes",
title: "Component Registry",
desc: "Drivers, libraries and BSPs from the official Espressif registry, with ready-to-use manifests.",
icon: Box,
action: "Explore components",
},
{
href: "/frameworks",
title: "Frameworks & SDKs",
desc: "ESP-IDF, Arduino, Rust, Matter, MicroPython and the tools built around the silicon.",
icon: Terminal,
action: "View frameworks",
},
{
href: "/catalogo",
title: "Board Catalog",
desc: "Real DevKits and modules, with USB interfaces, integrated sensors and direct store links.",
icon: Cpu,
action: "View boards",
},
];
const ERRORS_PT = [
{
code: "Brownout detector was triggered",
cause: "Queda de tensão na inicialização do rádio.",
fix: "Capacitor de 10–100 µF junto ao chip e fonte de 5 V com corrente suficiente.",
},
{
code: "Guru Meditation Error",
cause: "Ponteiro inválido, stack overflow ou uso incorreto de interrupção.",
fix: "Leia o backtrace com addr2line e dimensione a stack da task no FreeRTOS.",
},
{
code: "ADC2 indisponível com Wi-Fi",
cause: "O controlador de rádio reserva o ADC2 enquanto está ativo.",
fix: "Use os pinos do ADC1 para sensores analógicos que convivem com o Wi-Fi.",
},
{
code: "Flash Read err / bootloader",
cause: "Tensão ou modo de flash incorretos, ou pino de strapping preso no boot.",
fix: "Confira 3,3 V, pull-ups de boot e a configuração de flash no esptool.",
},
];
const ERRORS_EN = [
{
code: "Brownout detector was triggered",
cause: "Voltage sag upon radio startup.",
fix: "10–100 µF capacitor close to chip and a 5 V supply with sufficient current.",
},
{
code: "Guru Meditation Error",
cause: "Invalid pointer, stack overflow, or improper ISR usage.",
fix: "Inspect backtrace with addr2line and properly size FreeRTOS task stacks.",
},
{
code: "ADC2 indisponível com Wi-Fi",
cause: "Internal radio controller reserves ADC2 while active.",
fix: "Use ADC1 pins for analog sensors operating alongside Wi-Fi.",
},
{
code: "Flash Read err / bootloader",
cause: "Incorrect flash voltage/mode or strapping pin pulled during boot.",
fix: "Check 3.3 V rail, boot pull-ups, and flash configuration in esptool.",
},
];
export default async function Home({ params }) {
const { locale } = await params;
const isPt = locale === "pt";
const getLinkHref = (href) => getLocalizedHref(`/${locale}${href}`, locale);
const seriesData = isPt ? seriesDataPt : seriesDataEn;
const frameworksData = isPt ? frameworksDataPt : frameworksDataEn;
const tools = isPt ? TOOLS_PT : TOOLS_EN;
const errors = isPt ? ERRORS_PT : ERRORS_EN;
const seriesCount = Object.keys(seriesData).length;
const frameworkCount = Object.keys(frameworksData).length;
const featured = FEATURED.map((key) => [key, seriesData[key]]).filter(([, serie]) => Boolean(serie));
return (
{isPt ? "Documentação aberta do ESP32" : "Open ESP32 documentation"}
{isPt ? (
<>
O ESP32,
sem ruído.
>
) : (
<>
The ESP32,
without noise.
>
)}
{isPt
? "Especificações, pinagem, comparações e diagnóstico em uma leitura só. Menos tradução de datasheet, mais tempo com o protótipo na bancada."
: "Specifications, pinouts, comparisons and diagnostics in a single read. Less datasheet translation, more workbench time."}
{isPt ? "Escolher meu chip" : "Choose my chip"}
{isPt ? (
<>Explorar as {seriesCount} séries>
) : (
<>Explore the {seriesCount} series>
)}
{seriesCount} {isPt ? "séries" : "series"}·{frameworkCount} frameworks
{isPt ? (
<>
·78 capítulos no livro·100% em português
>
) : (
<>
·100% in English
>
)}
{isPt ? "Séries em destaque" : "Featured series"}
{isPt ? "O essencial de cada família, antes de abrir o datasheet." : "The essentials of each family before opening the datasheet."}
Um percurso completo pelo hardware e pelo firmware do ESP32: da arquitetura do chip
à implantação de produtos conectados. São 12 partes e 78 capítulos sobre Arduino,
ESP-IDF, FreeRTOS, Wi-Fi, BLE, Thread e Matter, periféricos, depuração, baixo consumo
e segurança.
{isPt ? "Comece pelo problema." : "Start with the problem."}
{isPt
? "Cada ferramenta resolve uma etapa concreta do projeto, sem cadastro e sem rodeio."
: "Each tool addresses a concrete development phase, with no sign-ups and zero fluff."}
{isPt ? "O primeiro boot não precisa virar noite." : "First boot doesn't have to take all night."}
{isPt
? "Os erros mais comuns têm causa conhecida. O guia parte da mensagem no terminal e chega ao ajuste de hardware ou firmware."
: "Common errors have known causes. This guide starts with the serial terminal log and leads to the hardware or firmware adjustment."}
{isPt ? "Abrir os 30+ diagnósticos" : "Open the 30+ diagnostics"}
boot.log
{isPt ? "4 exemplos de 30+" : "4 examples of 30+"}
{isPt ? "Feito para consultar no meio do projeto." : "Built for quick lookup mid-project."}
{isPt
? "O ESPDocs organiza dados públicos da Espressif e aponta sempre para a fonte oficial. Para decisões críticas, o datasheet e o Technical Reference Manual continuam sendo a palavra final."
: "ESPDocs organizes public Espressif data and points directly to official sources. For critical engineering decisions, the datasheet and Technical Reference Manual remain the definitive authority."}
{isPt ? "Glossário" : "Glossary"}
{isPt ? "Sobre o projeto" : "About the project"}