# cornellcollegecomputingclub/c4-sign architecture

> Architecture diagram of the GitHub repository cornellcollegecomputingclub/c4-sign, 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/cornellcollegecomputingclub/c4-sign
- Repository: https://github.com/cornellcollegecomputingclub/c4-sign

## Overview

##### Main Components

a) Core System Components:
- Main Application Controller
- Screen Manager
- Task Loading System
- Drivers Layer
- Task Management System
- Update System

b) Hardware Interfaces:
- 32x32 LED Matrix Display
- 16x2 LCD Character Display
- I2C Interface
- NeoPixel Controller

c) Simulation Components:
- Web-based Simulator
- Browser Interface

**[Web Browser Interface (Simulator)] -----> [Main Application Controller]**

**[Screen Manager] <---> [Task Loading System]**

**[Task Management System]**

**[Graphics Library]**

**[Display Drivers]**
- /           \
**[LED Matrix]  [LCD Display]**

##### Key Relationships to Highlight

a) Task System:
- How screen_tasks connect to the base_task.py
- Task loading and execution flow
- Relationship between tasks and the screen manager

b) System:
- Abstraction layers between physical and simulated displays
- How the graphics library interfaces with both modes

##### Important Implementation Details

- File structure organization (/c4_sign/lib, /c4_sign/screen_tasks)
- Configuration flow from consts.py
- Update system's periodic execution path
- Emulator's web interface components

##### Specific Components to Detail

**[Screen Manager]**
- Task scheduling
- Display management
- State handling

**[Graphics Library]**
- Canvas operations
- Drawing primitives
- Font rendering

**[Hardware Abstraction Layer]**
- Physical drivers
- Simulator interface
- I2C communication

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Interface
        Browser["Web Browser Interface"]:::simulator
        click Browser "https://github.com/CornellCollegeComputingClub/c4-sign/blob/main/c4_sign/emulator/templates/index.html"
    end

    subgraph Core["Core Application Layer"]
        MainApp["Main Application Controller"]:::core
        ScreenMgr["Screen Manager"]:::core
        TaskLoader["Task Loading System"]:::core
        TaskMgr["Task Management System"]:::core
        UpdateSys["Update System"]:::core
        BaseTask["Base Task Framework"]:::core
        Config["Configuration"]:::utility

        click MainApp "https://github.com/CornellCollegeComputingClub/c4-sign/blob/main/c4_sign/__main__.py"
        click ScreenMgr "https://github.com/CornellCollegeComputingClub/c4-sign/blob/main/c4_sign/ScreenManager.py"
        click TaskLoader "https://github.com/CornellCollegeComputingClub/c4-sign/blob/main/c4_sign/loading_manager.py"
        click TaskMgr "https://github.com/CornellCollegeComputingClub/c4-sign/blob/main/c4_sign/tasks.py"
        click UpdateSys "https://github.com/CornellCollegeComputingClub/c4-sign/blob/main/c4_sign/update.py"
        click BaseTask "https://github.com/CornellCollegeComputingClub/c4-sign/blob/main/c4_sign/base_task.py"
        click Config "https://github.com/CornellCollegeComputingClub/c4-sign/blob/main/c4_sign/consts.py"
    end

    subgraph Graphics["Graphics System"]
        GraphicsLib["Graphics Library"]:::graphics
        Canvas["Canvas System"]:::graphics

        click GraphicsLib "https://github.com/CornellCollegeComputingClub/c4-sign/blob/main/c4_sign/lib/graphics.py"
        click Canvas "https://github.com/CornellCollegeComputingClub/c4-sign/blob/main/c4_sign/lib/canvas.py"
    end

    subgraph Display["Display Layer"]
        DisplayDrivers["Display Drivers"]:::driver
        click DisplayDrivers "https://github.com/CornellCollegeComputingClub/c4-sign/tree/main/c4_sign/lib/screen/"

        subgraph Hardware["Hardware Interfaces"]
            LEDMatrix["LED Matrix Driver"]:::hardware
            I2C["I2C Interface"]:::hardware
            NeoPixel["NeoPixel Controller"]:::hardware

            click LEDMatrix "https://github.com/CornellCollegeComputingClub/c4-sign/blob/main/c4_sign/lib/screen/physical/driver.py"
            click I2C "https://github.com/CornellCollegeComputingClub/c4-sign/blob/main/c4_sign/lib/screen/physical/i2c_lib.py"
            click NeoPixel "https://github.com/CornellCollegeComputingClub/c4-sign/blob/main/c4_sign/lib/screen/physical/neopixel.py"
        end

        subgraph Simulation["Simulation Layer"]
            WebSim["Web Simulator"]:::simulator
            click WebSim "https://github.com/CornellCollegeComputingClub/c4-sign/tree/main/c4_sign/emulator/"
        end
    end

    subgraph Tasks["Task Collection"]
        ScreenTasks["Screen Tasks"]:::task
        click ScreenTasks "https://github.com/CornellCollegeComputingClub/c4-sign/tree/main/c4_sign/screen_tasks/"
    end

    %% Relationships
    Browser --> WebSim
    MainApp --> ScreenMgr
    MainApp --> TaskLoader
    MainApp --> UpdateSys
    ScreenMgr --> TaskMgr
    TaskMgr --> BaseTask
    TaskLoader --> ScreenTasks
    ScreenTasks --> BaseTask
    TaskMgr --> GraphicsLib
    GraphicsLib --> Canvas
    Canvas --> DisplayDrivers
    DisplayDrivers --> Hardware
    DisplayDrivers --> WebSim
    Config --> MainApp

    %% Styles
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef hardware fill:#2ecc71,stroke:#27ae60,color:white
    classDef simulator fill:#e67e22,stroke:#d35400,color:white
    classDef utility fill:#9b59b6,stroke:#8e44ad,color:white
    classDef graphics fill:#1abc9c,stroke:#16a085,color:white
    classDef driver fill:#34495e,stroke:#2c3e50,color:white
    classDef task fill:#f1c40f,stroke:#f39c12,color:black

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Hardware Interfaces"]:::hardware
        L3["Simulation Components"]:::simulator
        L4["Utility Services"]:::utility
        L5["Graphics System"]:::graphics
        L6["Drivers"]:::driver
        L7["Tasks"]:::task
    end
```
