# llunohodl/esp32_lan8742 architecture

> Architecture diagram of the GitHub repository llunohodl/esp32_lan8742, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/llunohodl/esp32_lan8742
- Repository: https://github.com/llunohodl/esp32_lan8742

## Overview

This is a small ESP32 Ethernet PHY driver and network-initialization example. The user supplies IP settings to app_net_ini(), which initializes the Ethernet interface, installs and starts the driver, and tracks connectivity through an event-group bit that the application can poll. The LAN8742A component implements the ESP-IDF PHY interface and reports link state through its mediator. The excerpts support these main calls; additional PHY internals and event wiring are not fully shown.

Main entry points: [`net_app.c`](https://github.com/llunohodl/esp32_lan8742/blob/master/net_app.c) (Network setup), [`esp_eth_phy_lan8742a.c`](https://github.com/llunohodl/esp32_lan8742/blob/master/esp_eth_phy_lan8742a.c) (LAN8742A PHY), [`net_app.h`](https://github.com/llunohodl/esp32_lan8742/blob/master/net_app.h) (IP configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Network app"]
  node_netinit["Network setup<br/>[net_app.c]"]
  node_ipconfig["IP configuration<br/>[net_app.h]"]
  node_connectivity["Connection status<br/>[net_app.h]"]
  node_eth_events["Ethernet and IP events<br/>[net_app.c]"]
end

subgraph group_phy["LAN8742A driver"]
  node_lan8742a["LAN8742A PHY"]
end

subgraph group_platform["ESP-IDF platform"]
  node_esp_eth["ESP Ethernet driver"]
  node_tcpip["TCP/IP adapter"]
  node_eventloop["ESP event loop"]
end

node_caller(("Application"))

node_caller -->|"calls"| node_netinit
node_caller -->|"provides"| node_ipconfig
node_netinit -->|"reads"| node_ipconfig
node_netinit -->|"clears"| node_connectivity
node_eth_events -->|"sets or clears"| node_connectivity
node_netinit -->|"registers"| node_eth_events
node_netinit -->|"configures"| node_tcpip
node_netinit -->|"registers handlers"| node_eventloop
node_netinit -->|"installs and starts"| node_esp_eth
node_netinit -->|"constructs"| node_lan8742a
node_lan8742a -->|"reports link state"| node_esp_eth

click node_netinit "https://github.com/llunohodl/esp32_lan8742/blob/master/net_app.c"
click node_ipconfig "https://github.com/llunohodl/esp32_lan8742/blob/master/net_app.h"
click node_connectivity "https://github.com/llunohodl/esp32_lan8742/blob/master/net_app.h"
click node_eth_events "https://github.com/llunohodl/esp32_lan8742/blob/master/net_app.c"
click node_lan8742a "https://github.com/llunohodl/esp32_lan8742/blob/master/esp_eth_phy_lan8742a.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_netinit,node_ipconfig,node_connectivity,node_eth_events toneBlue
class node_lan8742a toneAmber
class node_esp_eth,node_tcpip,node_eventloop toneMint
class node_caller toneIndigo
```

## Components

### Network app

- [Network setup](https://github.com/llunohodl/esp32_lan8742/blob/master/net_app.c): `net_app.c`
- [IP configuration](https://github.com/llunohodl/esp32_lan8742/blob/master/net_app.h): `net_app.h`
- [Connection status](https://github.com/llunohodl/esp32_lan8742/blob/master/net_app.h): `net_app.h`
- [Ethernet and IP events](https://github.com/llunohodl/esp32_lan8742/blob/master/net_app.c): `net_app.c`

### LAN8742A driver

- [LAN8742A PHY](https://github.com/llunohodl/esp32_lan8742/blob/master/esp_eth_phy_lan8742a.c): `esp_eth_phy_lan8742a.c`

### ESP-IDF platform

- **ESP Ethernet driver**
- **TCP/IP adapter**
- **ESP event loop**

### Other components

- **Application**

## Connections

- Application → Network setup: calls (evidence: `README.md`)
- Application → IP configuration: provides (evidence: `README.md`)
- Network setup → IP configuration: reads (evidence: `net_app.c`)
- Network setup → Connection status: clears (evidence: `net_app.c`)
- Ethernet and IP events → Connection status: sets or clears (evidence: `net_app.c`)
- Network setup → Ethernet and IP events: registers (evidence: `net_app.c`)
- Network setup → TCP/IP adapter: configures (evidence: `net_app.c`)
- Network setup → ESP event loop: registers handlers (evidence: `net_app.c`)
- Network setup → ESP Ethernet driver: installs and starts (evidence: `net_app.c`)
- Network setup → LAN8742A PHY: constructs (evidence: `net_app.c`)
- LAN8742A PHY → ESP Ethernet driver: reports link state (evidence: `esp_eth_phy_lan8742a.c`)
