# thelastoutpostworkshop/gpio_viewer architecture

> Architecture diagram of the GitHub repository thelastoutpostworkshop/gpio_viewer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thelastoutpostworkshop/gpio_viewer
- Repository: https://github.com/thelastoutpostworkshop/gpio_viewer

## Overview

##### Main System Components

The system architecture should be represented with these key components:

a) ESP32 Microcontroller Layer:
- GPIO Interface Module
- WiFi Communication Module
- Pin Monitoring System

b) Web Server Layer:
- AsyncWebServer Component
- WebSocket Handler
- Real-time Data Stream Manager

c) Client Layer:
- Web Browser Interface
- Real-time Visualization Component
- Board Selection Interface

**[ESP32 Device]**

- GPIO Management
- Digital Pins
- Analog Pins
- PWM Pins
- ADC Pins

- Network Layer
- WiFi Connection
- AsyncWebServer (Port 8080)

- Data Processing
- Pin State Monitoring
- Sampling System (100ms default)

- ▼
**[Web Application]**

- External Assets (GitHub Pages)
- Board Images

- Real-time Interface
- WebSocket Client
- Pin Visualization
- Board Selection

##### Implementation Notes

- Notes about the 50KB library size
- WiFi mode restrictions (WIFI_STA only)
- Supported board variations
- Performance considerations

##### Technical Details

- HTTP port configuration (default 8080)
- Sampling interval options (25-100ms)
- WiFi connection requirements
- Supported GPIO types
- Browser cache considerations

##### Integration Points

- Library initialization flow
- Setup() sequence requirements
- Configuration points (port, sampling interval)
- External dependency connections

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph ESP32["ESP32 Microcontroller Layer"]
        GPIO["GPIO Interface Module"]
        WiFiMod["WiFi Communication Module"]
        PinMon["Pin Monitoring System"]
        
        subgraph GPIOManage["GPIO Management"]
            DigitalPins["Digital Pins"]
            AnalogPins["Analog Pins"]
            PWMPins["PWM Pins"]
            ADCPins["ADC Pins"]
        end
        
        subgraph NetLayer["Network Layer"]
            WiFiConn["WiFi Connection"]
            AsyncServer["AsyncWebServer<br/>(Port 8080)"]
        end
        
        subgraph DataProc["Data Processing"]
            PinState["Pin State Monitoring"]
            Sampling["Sampling System<br/>(100ms default)"]
        end
    end
    
    subgraph WebApp["Web Application Layer"]
        subgraph ExtAssets["External Assets"]
            BoardImg["Board Images"]
            PinoutDiag["Pinout Diagrams"]
        end
        
        subgraph RTInterface["Real-time Interface"]
            WSClient["WebSocket Client"]
            PinVis["Pin Visualization"]
            BoardSel["Board Selection"]
        end
    end
    
    %% Relationships
    GPIO --> GPIOManage
    GPIOManage --> PinMon
    WiFiMod --> WiFiConn
    WiFiConn --> AsyncServer
    PinMon --> Sampling
    Sampling --> AsyncServer
    AsyncServer --> WSClient
    WSClient --> PinVis
    BoardSel --> PinVis
    ExtAssets --> PinVis
    
    %% Styles
    classDef esp32 fill:#a8d5ff,stroke:#333,stroke-width:2px
    classDef network fill:#90EE90,stroke:#333,stroke-width:2px
    classDef webapp fill:#FFB347,stroke:#333,stroke-width:2px
    classDef external fill:#DDA0DD,stroke:#333,stroke-width:2px
    classDef dataflow fill:#FF6B6B,stroke:#333,stroke-width:2px
    
    class ESP32,GPIO,WiFiMod,PinMon,GPIOManage esp32
    class NetLayer,WiFiConn,AsyncServer network
    class WebApp,RTInterface,WSClient,PinVis,BoardSel webapp
    class ExtAssets,BoardImg,PinoutDiag external
    class DataProc,PinState,Sampling dataflow
    
    %% Click Events
    click GPIO "https://github.com/thelastoutpostworkshop/gpio_viewer/blob/main/src/gpio_viewer.h"
    click WiFiMod "https://github.com/thelastoutpostworkshop/gpio_viewer/blob/main/examples/platformio/src/_secrets.h"
    click PinMon "https://github.com/thelastoutpostworkshop/gpio_viewer/blob/main/examples/platformio/src/main.cpp"
    click AsyncServer "https://github.com/thelastoutpostworkshop/gpio_viewer/blob/main/examples/gpioviewer/gpioviewer.ino"
    click DataProc "https://github.com/thelastoutpostworkshop/gpio_viewer/blob/main/examples/platformio/platformio.ini"
    click WebApp "https://github.com/thelastoutpostworkshop/gpio_viewer/blob/main/library.properties"
```
