# iotready/esp32_firmware_base architecture

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

- Interactive diagram: https://gitdiagram.com/iotready/esp32_firmware_base
- Repository: https://github.com/iotready/esp32_firmware_base

## Overview

This repository is an ESP32 C firmware library offering reusable Wi-Fi, provisioning, device-status, and GPIO APIs. The principal documented workflow starts when a device exposes a Wi-Fi hotspot; a user submits network credentials through REST, and the device switches to station mode to connect to the chosen access point. The README also describes BLE configuration and ESP-IDF provisioning alongside independent GPIO and system-statistics capabilities. Relationships among sampled modules are limited to references recorded in the source index; other links below are documented in the README.

Main entry points: [`lib/wifi_config_rest/wifi_config_rest.c`](https://github.com/iotready/esp32_firmware_base/blob/master/lib/wifi_config_rest/wifi_config_rest.c) (REST Wi-Fi setup), [`lib/wifi_station/wifi_station.c`](https://github.com/iotready/esp32_firmware_base/blob/master/lib/wifi_station/wifi_station.c) (Wi-Fi station), [`lib/wifi_softap/wifi_softap.c`](https://github.com/iotready/esp32_firmware_base/blob/master/lib/wifi_softap/wifi_softap.c) (Wi-Fi hotspot), [`lib/utilities/utilities.c`](https://github.com/iotready/esp32_firmware_base/blob/master/lib/utilities/utilities.c) (Error utilities)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_wifi["Wi-Fi connectivity"]
  node_softap["Wi-Fi hotspot<br/>[wifi_softap.c]"]
  node_station["Wi-Fi station<br/>[wifi_station.c]"]
end

subgraph group_config["Device configuration"]
  node_rest["REST Wi-Fi setup<br/>[wifi_config_rest.c]"]
  node_ble["BLE Wi-Fi setup<br/>[wifi_config_ble.c]"]
  node_provision["Wi-Fi provisioning<br/>[wifi_prov.c]"]
end

subgraph group_device["Device APIs"]
  node_gpio["GPIO interface<br/>[gpio_interface.c]"]
  node_stats["System statistics<br/>[system_stats.c]"]
end

subgraph group_shared["Shared utilities"]
  node_common["Common device helpers<br/>[common.c]"]
  node_utilities["Error utilities<br/>[utilities.c]"]
end

node_user(("Phone or computer user"))
node_network(("User Wi-Fi access point"))

node_user -->|"joins hotspot"| node_softap
node_user -->|"submits credentials"| node_rest
node_rest -->|"uses hotspot"| node_softap
node_rest -->|"configures connection"| node_station
node_station -->|"connects to"| node_network
node_ble -->|"references API"| node_station
node_station -->|"references helper"| node_utilities
node_softap -->|"references helper"| node_utilities
node_rest -->|"references helper"| node_utilities
node_provision -->|"references helper"| node_common
node_stats -->|"references helper"| node_common

click node_softap "https://github.com/iotready/esp32_firmware_base/blob/master/lib/wifi_softap/wifi_softap.c"
click node_station "https://github.com/iotready/esp32_firmware_base/blob/master/lib/wifi_station/wifi_station.c"
click node_rest "https://github.com/iotready/esp32_firmware_base/blob/master/lib/wifi_config_rest/wifi_config_rest.c"
click node_ble "https://github.com/iotready/esp32_firmware_base/blob/master/lib/wifi_config_ble/wifi_config_ble.c"
click node_provision "https://github.com/iotready/esp32_firmware_base/blob/master/lib/wifi_prov/src/wifi_prov.c"
click node_gpio "https://github.com/iotready/esp32_firmware_base/blob/master/lib/gpio/gpio_interface.c"
click node_stats "https://github.com/iotready/esp32_firmware_base/blob/master/lib/system_stats/src/system_stats.c"
click node_common "https://github.com/iotready/esp32_firmware_base/blob/master/lib/common/common.c"
click node_utilities "https://github.com/iotready/esp32_firmware_base/blob/master/lib/utilities/utilities.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_softap,node_station,node_user,node_network toneBlue
class node_rest,node_ble,node_provision toneAmber
class node_gpio,node_stats toneMint
class node_common,node_utilities toneRose
```

## Components

### Wi-Fi connectivity

- [Wi-Fi hotspot](https://github.com/iotready/esp32_firmware_base/blob/master/lib/wifi_softap/wifi_softap.c): `lib/wifi_softap/wifi_softap.c`
- [Wi-Fi station](https://github.com/iotready/esp32_firmware_base/blob/master/lib/wifi_station/wifi_station.c): `lib/wifi_station/wifi_station.c`

### Device configuration

- [REST Wi-Fi setup](https://github.com/iotready/esp32_firmware_base/blob/master/lib/wifi_config_rest/wifi_config_rest.c): `lib/wifi_config_rest/wifi_config_rest.c`
- [BLE Wi-Fi setup](https://github.com/iotready/esp32_firmware_base/blob/master/lib/wifi_config_ble/wifi_config_ble.c): `lib/wifi_config_ble/wifi_config_ble.c`
- [Wi-Fi provisioning](https://github.com/iotready/esp32_firmware_base/blob/master/lib/wifi_prov/src/wifi_prov.c): `lib/wifi_prov/src/wifi_prov.c`

### Device APIs

- [GPIO interface](https://github.com/iotready/esp32_firmware_base/blob/master/lib/gpio/gpio_interface.c): `lib/gpio/gpio_interface.c`
- [System statistics](https://github.com/iotready/esp32_firmware_base/blob/master/lib/system_stats/src/system_stats.c): `lib/system_stats/src/system_stats.c`

### Shared utilities

- [Common device helpers](https://github.com/iotready/esp32_firmware_base/blob/master/lib/common/common.c): `lib/common/common.c`
- [Error utilities](https://github.com/iotready/esp32_firmware_base/blob/master/lib/utilities/utilities.c): `lib/utilities/utilities.c`

### Other components

- **Phone or computer user**
- **User Wi-Fi access point**

## Connections

- Phone or computer user → Wi-Fi hotspot: joins hotspot (evidence: `README.md`)
- Phone or computer user → REST Wi-Fi setup: submits credentials (evidence: `README.md`)
- REST Wi-Fi setup → Wi-Fi hotspot: uses hotspot (evidence: `README.md`)
- REST Wi-Fi setup → Wi-Fi station: configures connection (evidence: `README.md`)
- Wi-Fi station → User Wi-Fi access point: connects to (evidence: `README.md`)
- BLE Wi-Fi setup → Wi-Fi station: references API (evidence: `lib/wifi_config_ble/wifi_config_ble.c`)
- Wi-Fi station → Error utilities: references helper (evidence: `lib/wifi_station/wifi_station.c`)
- Wi-Fi hotspot → Error utilities: references helper (evidence: `lib/wifi_softap/wifi_softap.c`)
- REST Wi-Fi setup → Error utilities: references helper (evidence: `lib/wifi_config_rest/wifi_config_rest.c`)
- Wi-Fi provisioning → Common device helpers: references helper (evidence: `lib/wifi_prov/src/wifi_prov.c`)
- System statistics → Common device helpers: references helper (evidence: `lib/system_stats/src/system_stats.c`)
