# alvarowolfx/esp32qrcodereader architecture

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

- Interactive diagram: https://gitdiagram.com/alvarowolfx/esp32qrcodereader
- Repository: https://github.com/alvarowolfx/esp32qrcodereader

## Overview

ESP32 QR Code Reader is an Arduino library that captures camera frames, detects and decodes QR codes, and exposes payloads through a task-backed reader API. Applications configure a supported camera, call setup/start, then receive valid or invalid QR results. The bundled Quirc implementation supplies recognition and decoding; OpenMV-derived collections and math support recognition internals. Internal Quirc call relationships are not established by the sampled excerpts, so those links are omitted. The README documents PSRAM and supported camera requirements.

Main entry points: [`src/ESP32QRCodeReader.cpp`](https://github.com/alvarowolfx/esp32qrcodereader/blob/master/src/ESP32QRCodeReader.cpp) (Reader task and API), [`src/quirc/quirc_internal.h`](https://github.com/alvarowolfx/esp32qrcodereader/blob/master/src/quirc/quirc_internal.h) (Recognizer structures), [`src/quirc/identify.c`](https://github.com/alvarowolfx/esp32qrcodereader/blob/master/src/quirc/identify.c) (QR identification), [`src/openmv/collections.c`](https://github.com/alvarowolfx/esp32qrcodereader/blob/master/src/openmv/collections.c) (LIFO collections)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_reader["Reader API"]
  node_reader_api["Reader task and API"]
end

subgraph group_capture["Camera Capture"]
  node_camera_pins["Camera pin models<br/>[ESP32CameraPins.h]"]
  node_camera_driver["ESP32 camera"]
end

subgraph group_quirc["QR Processing"]
  node_quirc_api["Quirc API<br/>[quirc.h]"]
  node_quirc_core["Recognizer core<br/>[quirc.c]"]
  node_qr_identify["QR identification<br/>[identify.c]"]
  node_qr_decode["QR decoding<br/>[decode.c]"]
  node_qr_versions["Version and ECC data<br/>[version_db.c]"]
  node_quirc_internal["Recognizer structures<br/>[quirc_internal.h]"]
end

subgraph group_support["Processing Support"]
  node_openmv_collections["LIFO collections<br/>[collections.c]"]
  node_openmv_headers["Collection declarations<br/>[collections.h]"]
  node_openmv_math["Fast math helpers<br/>[fmath.h]"]
end

node_application(("Arduino application"))
node_application_result["QR payload"]

node_application -->|"configures and starts"| node_reader_api
node_reader_api -->|"uses pin mapping"| node_camera_pins
node_reader_api -->|"initializes and captures"| node_camera_driver
node_reader_api -->|"processes frames"| node_quirc_api
node_reader_api -->|"returns QR data"| node_application_result
node_qr_identify -->|"uses structures"| node_quirc_internal
node_qr_decode -->|"uses structures"| node_quirc_internal
node_quirc_core -->|"uses structures"| node_quirc_internal
node_qr_versions -->|"defines version data"| node_quirc_internal
node_qr_identify -->|"uses LIFO"| node_openmv_collections
node_openmv_collections -->|"implements declarations"| node_openmv_headers
node_qr_identify -->|"uses math helpers"| node_openmv_math

click node_reader_api "https://github.com/alvarowolfx/esp32qrcodereader/blob/master/src/ESP32QRCodeReader.cpp"
click node_camera_pins "https://github.com/alvarowolfx/esp32qrcodereader/blob/master/include/ESP32CameraPins.h"
click node_quirc_api "https://github.com/alvarowolfx/esp32qrcodereader/blob/master/src/quirc/quirc.h"
click node_quirc_core "https://github.com/alvarowolfx/esp32qrcodereader/blob/master/src/quirc/quirc.c"
click node_qr_identify "https://github.com/alvarowolfx/esp32qrcodereader/blob/master/src/quirc/identify.c"
click node_qr_decode "https://github.com/alvarowolfx/esp32qrcodereader/blob/master/src/quirc/decode.c"
click node_qr_versions "https://github.com/alvarowolfx/esp32qrcodereader/blob/master/src/quirc/version_db.c"
click node_quirc_internal "https://github.com/alvarowolfx/esp32qrcodereader/blob/master/src/quirc/quirc_internal.h"
click node_openmv_collections "https://github.com/alvarowolfx/esp32qrcodereader/blob/master/src/openmv/collections.c"
click node_openmv_headers "https://github.com/alvarowolfx/esp32qrcodereader/blob/master/src/openmv/collections.h"
click node_openmv_math "https://github.com/alvarowolfx/esp32qrcodereader/blob/master/src/openmv/fmath.h"

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_reader_api toneBlue
class node_camera_pins,node_camera_driver toneAmber
class node_quirc_api,node_quirc_core,node_qr_identify,node_qr_decode,node_qr_versions,node_quirc_internal toneMint
class node_openmv_collections,node_openmv_headers,node_openmv_math toneRose
class node_application,node_application_result toneIndigo
```

## Components

### Reader API

- [Reader task and API](https://github.com/alvarowolfx/esp32qrcodereader/blob/master/src/ESP32QRCodeReader.cpp): `src/ESP32QRCodeReader.cpp`

### Camera Capture

- [Camera pin models](https://github.com/alvarowolfx/esp32qrcodereader/blob/master/include/ESP32CameraPins.h): `include/ESP32CameraPins.h`
- **ESP32 camera**

### QR Processing

- [Quirc API](https://github.com/alvarowolfx/esp32qrcodereader/blob/master/src/quirc/quirc.h): `src/quirc/quirc.h`
- [Recognizer core](https://github.com/alvarowolfx/esp32qrcodereader/blob/master/src/quirc/quirc.c): `src/quirc/quirc.c`
- [QR identification](https://github.com/alvarowolfx/esp32qrcodereader/blob/master/src/quirc/identify.c): `src/quirc/identify.c`
- [QR decoding](https://github.com/alvarowolfx/esp32qrcodereader/blob/master/src/quirc/decode.c): `src/quirc/decode.c`
- [Version and ECC data](https://github.com/alvarowolfx/esp32qrcodereader/blob/master/src/quirc/version_db.c): `src/quirc/version_db.c`
- [Recognizer structures](https://github.com/alvarowolfx/esp32qrcodereader/blob/master/src/quirc/quirc_internal.h): `src/quirc/quirc_internal.h`

### Processing Support

- [LIFO collections](https://github.com/alvarowolfx/esp32qrcodereader/blob/master/src/openmv/collections.c): `src/openmv/collections.c`
- [Collection declarations](https://github.com/alvarowolfx/esp32qrcodereader/blob/master/src/openmv/collections.h): `src/openmv/collections.h`
- [Fast math helpers](https://github.com/alvarowolfx/esp32qrcodereader/blob/master/src/openmv/fmath.h): `src/openmv/fmath.h`

### Other components

- **Arduino application**
- **QR payload**

## Connections

- Arduino application → Reader task and API: configures and starts (evidence: `README.md`)
- Reader task and API → Camera pin models: uses pin mapping
- Reader task and API → ESP32 camera: initializes and captures (evidence: `src/ESP32QRCodeReader.cpp`)
- Reader task and API → Quirc API: processes frames (evidence: `src/ESP32QRCodeReader.cpp`)
- Reader task and API → QR payload: returns QR data (evidence: `README.md`)
- QR identification → Recognizer structures: uses structures (evidence: `src/quirc/identify.c`)
- QR decoding → Recognizer structures: uses structures (evidence: `src/quirc/decode.c`)
- Recognizer core → Recognizer structures: uses structures (evidence: `src/quirc/quirc.c`)
- Version and ECC data → Recognizer structures: defines version data (evidence: `src/quirc/version_db.c`)
- QR identification → LIFO collections: uses LIFO (evidence: `src/quirc/identify.c`)
- LIFO collections → Collection declarations: implements declarations (evidence: `src/openmv/collections.c`)
- QR identification → Fast math helpers: uses math helpers (evidence: `src/quirc/identify.c`)
