# jpearman/convex architecture

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

## Overview

##### Main Components

a. Hardware Layer:
- STM32 Processor
- VEX Cortex Microcontroller peripherals (Motors, Sensors, LCD, etc.)
- Board-specific components (OLIMEX_STM32_P103 and VEX_STM32_CORTEX)

b. Software Layers:
- ChibiOS/RT Core (Base RTOS)
- ConVEX Firmware Layer
- Optional Features Layer
- User Applications Layer

##### Component Organization

**[User Applications] (Top Layer)**
- ↑
**[Optional Features]**
- ↑
**[ConVEX Firmware]**
- ↑
**[ChibiOS/RT Core]**
- ↑
**[Hardware Layer] (Bottom Layer)**

##### Detailed Component Breakdown

- STM32 processor
- Peripheral interfaces (Digital I/O, Analog, Motors, etc.)
- Board-specific interfaces

- Thread Management
- Scheduling
- Memory Management
- I/O Systems

c. ConVEX Firmware (Use rounded rectangles):
- Motor Control Module (vexmotor.c)
- Sensor Interface (vexsensor.c)
- LCD Control (vexlcd.c)
- Digital/Analog I/O (vexdigital.c, vexanalog.c)
- Audio System (vexaudio.c)
- Shell Interface (vexshell.c)

- SmartMotor Library
- Apollo Real-time Display
- VEX Gyro
- PID Library
- ROBOTC Compatibility Layer

- Test Projects
- Custom User Code

##### Additional Elements

Callouts showing:
- Thread management (128 priority levels)
- Memory management systems
- I/O interfaces
- Communication protocols (SPI, etc.)

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef hardware fill:#e6e6e6,stroke:#333
    classDef chibios fill:#b3d9ff,stroke:#333
    classDef convex fill:#99ff99,stroke:#333
    classDef optional fill:#ffffb3,stroke:#333
    classDef user fill:#ffffff,stroke:#333
    
    %% Hardware Layer
    subgraph Hardware
        STM32[STM32 Processor]
        OLIMEX[OLIMEX Board]
        VEXCORTEX[VEX Cortex Board]
        PERIPHERALS[Peripherals<br/>Motors, Sensors, LCD]
    end
    
    %% ChibiOS Layer
    subgraph ChibiOS
        RTOS[ChibiOS/RT Core]
        THREAD[Thread Management]
        MEMORY[Memory Management]
        IO[I/O Systems]
    end
    
    %% ConVEX Firmware Layer
    subgraph ConVEX
        MOTOR[Motor Control]
        SENSOR[Sensor Interface]
        LCD[LCD Control]
        DIGITAL[Digital I/O]
        ANALOG[Analog I/O]
        AUDIO[Audio System]
        SHELL[Shell Interface]
        SPI[SPI Interface]
        ENCODER[Encoder Interface]
        CONFIG[System Config]
        CORE[Core Control]
    end
    
    %% Optional Features Layer
    subgraph Optional
        SMARTMOTOR[SmartMotor Library]
        APOLLO[Apollo Display]
        GYRO[VEX Gyro]
        PID[PID Library]
        ROBOTC[ROBOTC Compatibility]
    end
    
    %% User Applications Layer
    subgraph Applications
        TEST_DEFAULT[Default Test]
        TEST_AUDIO[Audio Test]
        TEST_GYRO[Gyro Test]
        TEST_CLAW[Clawbot Test]
        TEST_LED[LED Test]
    end
    
    %% Connections
    RTOS --> STM32
    THREAD & MEMORY & IO --> RTOS
    
    MOTOR & SENSOR & LCD & DIGITAL & ANALOG & AUDIO & SHELL --> RTOS
    SPI & ENCODER & CONFIG & CORE --> RTOS
    
    SMARTMOTOR & APOLLO & GYRO & PID & ROBOTC --> CORE
    
    TEST_DEFAULT & TEST_AUDIO & TEST_GYRO & TEST_CLAW & TEST_LED --> Optional
    
    %% Component Styling
    class STM32,OLIMEX,VEXCORTEX,PERIPHERALS hardware
    class RTOS,THREAD,MEMORY,IO chibios
    class MOTOR,SENSOR,LCD,DIGITAL,ANALOG,AUDIO,SHELL,SPI,ENCODER,CONFIG,CORE convex
    class SMARTMOTOR,APOLLO,GYRO,PID,ROBOTC optional
    class TEST_DEFAULT,TEST_AUDIO,TEST_GYRO,TEST_CLAW,TEST_LED user
    
    %% Click Events
    click OLIMEX "https://github.com/jpearman/convex/tree/master/convex/cortex/boards/OLIMEX_STM32_P103/"
    click VEXCORTEX "https://github.com/jpearman/convex/tree/master/convex/cortex/boards/VEX_STM32_CORTEX/"
    click MOTOR "https://github.com/jpearman/convex/blob/master/convex/cortex/fw/vexmotor.c"
    click SENSOR "https://github.com/jpearman/convex/blob/master/convex/cortex/fw/vexsensor.c"
    click LCD "https://github.com/jpearman/convex/blob/master/convex/cortex/fw/vexlcd.c"
    click DIGITAL "https://github.com/jpearman/convex/blob/master/convex/cortex/fw/vexdigital.c"
    click ANALOG "https://github.com/jpearman/convex/blob/master/convex/cortex/fw/vexanalog.c"
    click AUDIO "https://github.com/jpearman/convex/blob/master/convex/cortex/fw/vexaudio.c"
    click SHELL "https://github.com/jpearman/convex/blob/master/convex/cortex/fw/vexshell.c"
    click SMARTMOTOR "https://github.com/jpearman/convex/blob/master/convex/cortex/opt/smartmotor.c"
    click APOLLO "https://github.com/jpearman/convex/blob/master/convex/cortex/opt/apollo.c"
    click GYRO "https://github.com/jpearman/convex/blob/master/convex/cortex/opt/vexgyro.c"
    click PID "https://github.com/jpearman/convex/blob/master/convex/cortex/opt/pidlib.c"
    click ROBOTC "https://github.com/jpearman/convex/blob/master/convex/cortex/opt/robotc_glue.c"
    click TEST_DEFAULT "https://github.com/jpearman/convex/tree/master/convex/cortex/projects/TestProject-Default/"
    click TEST_AUDIO "https://github.com/jpearman/convex/tree/master/convex/cortex/projects/TestProject-Audio/"
    click TEST_GYRO "https://github.com/jpearman/convex/tree/master/convex/cortex/projects/TestProject-Gyro/"
    click TEST_CLAW "https://github.com/jpearman/convex/tree/master/convex/cortex/projects/TestProject-Clawbot/"
    click TEST_LED "https://github.com/jpearman/convex/tree/master/convex/cortex/projects/TestProject-Leds/"
    click SPI "https://github.com/jpearman/convex/blob/master/convex/cortex/fw/vexspi.c"
    click ENCODER "https://github.com/jpearman/convex/blob/master/convex/cortex/fw/vexencoder.c"
    click CONFIG "https://github.com/jpearman/convex/blob/master/convex/cortex/fw/vexconfig.c"
    click CORE "https://github.com/jpearman/convex/blob/master/convex/cortex/fw/vexctl.c"
```
