# 70p4z/tparse architecture

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

- Interactive diagram: https://gitdiagram.com/70p4z/tparse
- Repository: https://github.com/70p4z/tparse

## Overview

##### Main Components Identification

The system consists of three major components:
a) TParse Library Core
b) IOBridge Implementation
c) Solax-Pylontech Bridge Implementation

##### Specific Implementation Details

For the Solax-Pylontech bridge:
- CAN bus interfaces (dual CAN)
- I2C reporting interface
- Serial interface for WiFi
- Relay control
- Home Assistant integration

##### Component Relationships

**[TParse Core] ← → [Protocol Handlers]**
- ↓
**[Communication Interfaces]**
- ↓
**[Applications] ← → [External Systems]**

##### Additional Elements

Include:
- Version information
- Interface specifications
- Protocol details
- Memory constraints

##### Implementation Notes

Callouts for:
- Zero-allocation design
- Protocol conversion details
- CAN message modification (0x1877)
- Home Assistant integration

##### System extensibility

Use standardized symbols for:
- Microcontrollers
- Communication buses
- External interfaces
- Memory components
- Protocol converters

This design should clearly show how the system processes text commands, converts between protocols, and maintains efficient memory usage while providing flexible protocol bridging capabilities.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Core Layer
    subgraph Core
        TParse["TParse Parser"]
        MemMgmt["Memory Management<br/>(Zero-allocation)"]
        TextProc["Text Processing Units<br/>(Hex, Decimal, Keywords)"]
        
        TParse --- MemMgmt
        TParse --- TextProc
    end
    
    %% Protocol Bridge Layer
    subgraph ProtocolBridge
        UART["UART Interface"]:::interface
        GPIO["GPIO Interface"]:::interface
        I2C["I2C Bus Interface"]:::interface
        CAN["CAN Bus Interface"]:::interface
        ISO["ISO7816-3 T=0<br/>Interface"]:::interface
        SPI["SPI Interface<br/>(planned)"]:::planned
        ADC["ADC Interface<br/>(planned)"]:::planned
        OneWire["OneWire Interface<br/>(planned)"]:::planned
    end
    
    %% Application Layer
    subgraph Applications
        IOBridge["IOBridge<br/>Application"]:::app
        SolaxBridge["Solax-Pylontech<br/>Bridge"]:::app
        PythonLib["Python Interface<br/>Library"]:::app
    end
    
    %% External Systems
    subgraph External
        HomeAssistant["Home Assistant"]
        ExternalDevices["External Devices"]
    end
    
    %% Connections
    Core --> ProtocolBridge
    ProtocolBridge --> Applications
    Applications --> External
    
    %% Python Tools
    subgraph PythonTools
        CANTools["CAN Tools"]:::tool
        I2CTools["I2C Tools"]:::tool
        ISOTools["ISO Tools"]:::tool
        UARTTools["UART Tools"]:::tool
    end
    
    PythonLib --> PythonTools
    
    %% Legend
    classDef interface fill:#90EE90
    classDef planned fill:#D3D3D3
    classDef app fill:#FFA500
    classDef tool fill:#ADD8E6
    
    %% Click Events
    click TParse "https://github.com/70p4z/tparse/blob/master/src/tparse.c"
    click UART "https://github.com/70p4z/tparse/blob/master/example/stm32l476_io_bridge/src/intf_usart.c"
    click GPIO "https://github.com/70p4z/tparse/blob/master/example/stm32l476_io_bridge/src/intf_gpio.c"
    click I2C "https://github.com/70p4z/tparse/blob/master/example/stm32l476_io_bridge/src/intf_i2c.c"
    click CAN "https://github.com/70p4z/tparse/blob/master/example/stm32l476_io_bridge/src/intf_can.c"
    click ISO "https://github.com/70p4z/tparse/blob/master/example/stm32l476_io_bridge/src/intf_iso.c"
    click SPI "https://github.com/70p4z/tparse/blob/master/example/stm32l476_io_bridge/src/intf_spi.c"
    click IOBridge "https://github.com/70p4z/tparse/blob/master/example/stm32l476_io_bridge/src/main.c"
    click SolaxBridge "https://github.com/70p4z/tparse/blob/master/example/nucleo-f767zi_solax-pylontech/src_solax/solax_bms_interp.c"
    click PythonLib "https://github.com/70p4z/tparse/blob/master/example/stm32l476_io_bridge/python/iobridge/iobridge.py"
    click HomeAssistant "https://github.com/70p4z/tparse/blob/master/example/nucleo-f767zi_solax-pylontech/python/home_assistant/solax_bms_mqtt.py"
    click CANTools "https://github.com/70p4z/tparse/blob/master/example/stm32l476_io_bridge/python/iobridge/can_mitm.py"
    click I2CTools "https://github.com/70p4z/tparse/blob/master/example/stm32l476_io_bridge/python/iobridge/i2c_cargo.py"
    click ISOTools "https://github.com/70p4z/tparse/blob/master/example/stm32l476_io_bridge/python/iobridge/iso.py"
    click UARTTools "https://github.com/70p4z/tparse/blob/master/example/stm32l476_io_bridge/python/iobridge/usartiface.py"
```
