# alexgyver/gyverlibs architecture

> Architecture diagram of the GitHub repository alexgyver/gyverlibs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/alexgyver/gyverlibs
- Repository: https://github.com/alexgyver/gyverlibs

## Overview

This repository isn’t a single “app” with one runtime process – it’s an archive of many modular Arduino libraries written from scratch (or modified) for hardware control, algorithmic processing, and system-level functions. In other words, the “system” is a collection of independently useful libraries that an Arduino developer can mix and match for various embedded projects.

##### Main Components
a. “Hardware / Device Control Libraries” (Железки):
– This category includes libraries for controlling physical devices and actuators. For example: GyverButton (button control), GyverEncoder (encoder processing), GyverMotor, GyverStepper, AccelMotor, GyverRGB, GyverTM1637, ServoSmooth, etc.
b. “Peripheral / MCU Control Libraries” (Периферия МК):
– Libraries that extend the raw capabilities of the microcontroller such as directADC, directTimers, GyverPWM, GyverWDT.
c. “Algorithmic & Control Libraries” (Алгоритмы):
– These include logic that “regulates” or “processes” sensor data, such as PWMrelay, GyverFilters, GyverTimer, GyverPID, and GyverRelay.
d. “Core/System & Utility Libraries” (Системное):
– Libraries that provide infrastructure features: buildTime, GyverTimers, GyverHacks, GyverPower, GyverRTOS.
e. “Lightweight/Micro Libraries” (Лёгкие библиотеки):
– Minimal libraries for sensors and communication such as microBME280, microLED, microWire, microDS3231, microLiquidCrystal_I2C, microDS18B20, GyverUART, minimLibs.

##### Dependencies and Interactions
- In many cases, the libraries are “standalone” but follow a similar API design for embedded use (for example, they often provide “tick()” methods or built‐in timers). Indicate these common design patterns using annotations (for instance, note that many of the “Hardware Control” libraries expose a periodic “tick” function that must be called within an Arduino loop or ISR, reflecting a cooperative “task scheduling” pattern).
- Libraries into “subsystems” based on their functional purpose. For instance, all display-related libraries (GyverOLED, SevenSegmentsDisp, TM1637_Gyver, TM74HC595_Gyver) can be clustered together.

##### Instructing the Principal Software Engineer
- Begin at the highest level with the overall repository and then “drill down” into categories.
– Rectangles for “Hardware Device Libraries”
– Rounded rectangles for “MCU Peripheral Libraries”
– Ovals or circles for “Algorithm & Control Utilities”
– A separate grouping for “System/RTOS and Utility Functions”
- Directional indicators for data flows when one library’s output is intended for another’s input (for example, sensor data processed in GyverFilters might feed into GyverPID or GyverRelay).

##### Capturing Essential Architectural Elements
- Be very detailed in grouping: separate the design into as many suitably named components as possible without oversimplifying.
- Acknowledge that many libraries share similar “tick” or “update” methods, suggesting that a runtime scheduler (or cooperative multitasking – as implied by GyverRTOS) could be conceptualized at the center of the system.

– The modular nature of the repository
– The clear separation of concerns by category
– The relationships (and dependencies) between common libraries
– The low-level, hardware-focused design typical in Arduino ecosystems

## Diagram (Mermaid)

```mermaid
flowchart TD
    Repo["GyverLibs Repository – Arduino Libraries Collection"]:::repo

    subgraph "Hardware / Device Control Libraries"
        h1["GyverButton\n(Device Control)"]:::hardware
        h2["GyverEncoder\n(Device Control)"]:::hardware
        h3["GyverMotor\n(Device Control)"]:::hardware
        h4["GyverStepper\n(Device Control)"]:::hardware
        h5["AccelMotor\n(Device Control)"]:::hardware
        h6["GyverRGB\n(Device Control)"]:::hardware
        h7["GyverTM1637\n(Device Control)"]:::hardware
        h8["ServoSmooth\n(Device Control)"]:::hardware
        h9["SevenSegmentsDisp\n(Device Control)"]:::hardware
    end

    subgraph "Peripheral / MCU Control Libraries"
        p1["directADC\n(MCU Control)"]:::peripheral
        p2["directTimers\n(MCU Control)"]:::peripheral
        p3["GyverPWM\n(MCU Control)"]:::peripheral
        p4["GyverWDT\n(MCU Control)"]:::peripheral
    end

    subgraph "Algorithmic & Control Libraries"
        a1["PWMrelay\n(Algorithmic)"]:::algorithm
        a2["GyverFilters\n(Algorithmic)"]:::algorithm
        a3["GyverTimer\n(Algorithmic)"]:::algorithm
        a4["GyverPID\n(Algorithmic)"]:::algorithm
        a5["GyverRelay\n(Algorithmic)"]:::algorithm
    end

    subgraph "Core/System & Utility Libraries"
        s1["buildTime\n(System Utility)"]:::system
        s2["GyverTimers\n(System Utility)"]:::system
        s3["GyverHacks\n(System Utility)"]:::system
        s4["GyverPower\n(System Utility)"]:::system
        s5["GyverRTOS\n(System Utility)"]:::system
    end

    subgraph "Lightweight/Micro Libraries"
        l1["microBME280\n(Lightweight)"]:::lightweight
        l2["microLED\n(Lightweight)"]:::lightweight
        l3["microDS3231\n(Lightweight)"]:::lightweight
        l4["microLiquidCrystal_I2C\n(Lightweight)"]:::lightweight
        l5["microWire\n(Lightweight)"]:::lightweight
        l6["GyverUART\n(Lightweight)"]:::lightweight
        l7["minimLibs\n(Lightweight)"]:::lightweight
    end

    %% Link the Repository to each category for overall context
    Repo --> h1
    Repo --> p1
    Repo --> a1
    Repo --> s1
    Repo --> l1

    %% Dependencies: microWire is required by microDS3231 and microLiquidCrystal_I2C
    l5 -->|"dependency"| l3
    l5 -->|"dependency"| l4

    %% Example annotations of common control methods (tick functions, scheduling)
    h1 ---|"tick()"| h2
    a2 ---|"tick()"| a3
    s5 ---|"scheduling"| s1

    %% Sample interactions across modules
    h3 -->|"uses"| s4
    a4 -->|"controlled_by"| s5

    %% Click events for Hardware / Device Control Libraries
    click h1 "https://github.com/alexgyver/gyverlibs/tree/master//GyverButton"
    click h2 "https://github.com/alexgyver/gyverlibs/tree/master//GyverEncoder"
    click h3 "https://github.com/alexgyver/gyverlibs/tree/master//GyverMotor"
    click h4 "https://github.com/alexgyver/gyverlibs/tree/master//GyverStepper"
    click h5 "https://github.com/alexgyver/gyverlibs/tree/master//AccelMotor"
    click h6 "https://github.com/alexgyver/gyverlibs/tree/master//GyverRGB"
    click h7 "https://github.com/alexgyver/gyverlibs/tree/master//GyverTM1637"
    click h8 "https://github.com/alexgyver/gyverlibs/tree/master//ServoSmooth"
    click h9 "https://github.com/alexgyver/gyverlibs/tree/master//SevenSegmentsDisp"

    %% Click events for Peripheral / MCU Control Libraries
    click p1 "https://github.com/alexgyver/gyverlibs/tree/master//directADC"
    click p2 "https://github.com/alexgyver/gyverlibs/tree/master//directTimers"
    click p3 "https://github.com/alexgyver/gyverlibs/tree/master//GyverPWM"
    click p4 "https://github.com/alexgyver/gyverlibs/tree/master//GyverWDT"

    %% Click events for Algorithmic & Control Libraries
    click a1 "https://github.com/alexgyver/gyverlibs/tree/master//PWMrelay"
    click a2 "https://github.com/alexgyver/gyverlibs/tree/master//GyverFilters"
    click a3 "https://github.com/alexgyver/gyverlibs/tree/master//GyverTimer"
    click a4 "https://github.com/alexgyver/gyverlibs/tree/master//GyverPID"
    click a5 "https://github.com/alexgyver/gyverlibs/tree/master//GyverRelay"

    %% Click events for Core/System & Utility Libraries
    click s1 "https://github.com/alexgyver/gyverlibs/tree/master//buildTime"
    click s2 "https://github.com/alexgyver/gyverlibs/tree/master//GyverTimers"
    click s3 "https://github.com/alexgyver/gyverlibs/tree/master//GyverHacks"
    click s4 "https://github.com/alexgyver/gyverlibs/tree/master//GyverPower"
    click s5 "https://github.com/alexgyver/gyverlibs/tree/master//GyverRTOS"

    %% Click events for Lightweight/Micro Libraries
    click l1 "https://github.com/alexgyver/gyverlibs/tree/master//GyverBME280"
    click l2 "https://github.com/alexgyver/gyverlibs/tree/master//microLED"
    click l3 "https://github.com/alexgyver/gyverlibs/tree/master//microDS3231"
    click l4 "https://github.com/alexgyver/gyverlibs/tree/master//microLiquidCrystal_I2C"
    click l5 "https://github.com/alexgyver/gyverlibs/tree/master//microWire"
    click l6 "https://github.com/alexgyver/gyverlibs/tree/master//GyverUART"
    click l7 "https://github.com/alexgyver/gyverlibs/tree/master//minimLibs"

    %% Styles
    classDef repo fill:#eeeeee,stroke:#000000,stroke-width:2px;
    classDef hardware fill:#ffefd5,stroke:#000000,stroke-width:2px;
    classDef peripheral fill:#e0ffff,stroke:#000000,stroke-width:2px;
    classDef algorithm fill:#e6ffe6,stroke:#000000,stroke-width:2px;
    classDef system fill:#ffe6cc,stroke:#000000,stroke-width:2px;
    classDef lightweight fill:#d0e0ff,stroke:#000000,stroke-width:2px;
```
