# qitech-industries/hardwarecontrol architecture

> Architecture diagram of the GitHub repository qitech-industries/hardwarecontrol, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/qitech-industries/hardwarecontrol
- Repository: https://github.com/qitech-industries/hardwarecontrol

## Overview

Hardware Control is an embedded C++ library for controlling maker hardware through component-specific APIs. The principal documented workflow is to configure and initialize a controller, issue movement or temperature targets, and repeatedly call its handler to apply control. Stepper commands are exercised by the sampled firmware entry point; heater regulation and DC-motor control are separate library capabilities. The sampled code also shows shared controller validation and logging. The README documents broader hardware ambitions, but those future capabilities are not represented as implemented modules here.

Main entry points: [`src/controller/heater/HeatController.cpp`](https://github.com/qitech-industries/hardwarecontrol/blob/main/src/controller/heater/HeatController.cpp) (PID heater control), [`src/controller/stepper/Stepper.cpp`](https://github.com/qitech-industries/hardwarecontrol/blob/main/src/controller/stepper/Stepper.cpp) (Stepper control), [`src/validator/McValidator.cpp`](https://github.com/qitech-industries/hardwarecontrol/blob/main/src/validator/McValidator.cpp) (Pin validation API), [`src/controller/BaseController.cpp`](https://github.com/qitech-industries/hardwarecontrol/blob/main/src/controller/BaseController.cpp) (Controller base)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Firmware runtime"]
  node_firmware["Serial command firmware<br/>[main.cpp]"]
end

subgraph group_controllers["Hardware controllers"]
  node_stepper["Stepper control<br/>[Stepper.cpp]"]
  node_stepper_util["Stepper calibration utilities<br/>[StepperTest.cpp]"]
  node_heater["PID heater control<br/>[HeatController.cpp]"]
  node_dc_motor["DC motor control<br/>[DcMotor.cpp]"]
end

subgraph group_shared["Shared services"]
  node_base["Controller base<br/>[BaseController.cpp]"]
  node_validator["Pin validation API<br/>[McValidator.cpp]"]
  node_esp_validator["ESP32 pin validation"]
  node_logging["Logging<br/>[logging.cpp]"]
end

node_maker(("Maker"))
node_stepper_libs["Stepper driver libraries"]
node_hardware["Connected hardware"]

node_maker -->|"sends commands"| node_firmware
node_firmware -->|"issues movement commands"| node_stepper
node_stepper -->|"uses drivers"| node_stepper_libs
node_stepper -->|"controls steppers"| node_hardware
node_heater -->|"checks pins"| node_validator
node_heater -->|"writes logs"| node_logging
node_heater -->|"reads sensor and switches heater"| node_hardware
node_dc_motor -->|"controls DC motor"| node_hardware
node_base -->|"holds validator"| node_validator
node_base -->|"holds logging level"| node_logging
node_esp_validator -->|"extends API"| node_validator

click node_firmware "https://github.com/qitech-industries/hardwarecontrol/blob/main/src/main.cpp"
click node_stepper "https://github.com/qitech-industries/hardwarecontrol/blob/main/src/controller/stepper/Stepper.cpp"
click node_stepper_util "https://github.com/qitech-industries/hardwarecontrol/blob/main/src/controller/stepper/StepperTest.cpp"
click node_heater "https://github.com/qitech-industries/hardwarecontrol/blob/main/src/controller/heater/HeatController.cpp"
click node_dc_motor "https://github.com/qitech-industries/hardwarecontrol/blob/main/src/controller/dcmotor/DcMotor.cpp"
click node_base "https://github.com/qitech-industries/hardwarecontrol/blob/main/src/controller/BaseController.cpp"
click node_validator "https://github.com/qitech-industries/hardwarecontrol/blob/main/src/validator/McValidator.cpp"
click node_esp_validator "https://github.com/qitech-industries/hardwarecontrol/blob/main/src/validator/McValidatorEsp32.cpp"
click node_logging "https://github.com/qitech-industries/hardwarecontrol/blob/main/src/logger/logging.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_firmware toneBlue
class node_stepper,node_stepper_util,node_heater,node_dc_motor toneAmber
class node_base,node_validator,node_esp_validator,node_logging toneMint
class node_maker,node_stepper_libs,node_hardware toneIndigo
```

## Components

### Firmware runtime

- [Serial command firmware](https://github.com/qitech-industries/hardwarecontrol/blob/main/src/main.cpp): `src/main.cpp`

### Hardware controllers

- [Stepper control](https://github.com/qitech-industries/hardwarecontrol/blob/main/src/controller/stepper/Stepper.cpp): `src/controller/stepper/Stepper.cpp`
- [Stepper calibration utilities](https://github.com/qitech-industries/hardwarecontrol/blob/main/src/controller/stepper/StepperTest.cpp): `src/controller/stepper/StepperTest.cpp`
- [PID heater control](https://github.com/qitech-industries/hardwarecontrol/blob/main/src/controller/heater/HeatController.cpp): `src/controller/heater/HeatController.cpp`
- [DC motor control](https://github.com/qitech-industries/hardwarecontrol/blob/main/src/controller/dcmotor/DcMotor.cpp): `src/controller/dcmotor/DcMotor.cpp`

### Shared services

- [Controller base](https://github.com/qitech-industries/hardwarecontrol/blob/main/src/controller/BaseController.cpp): `src/controller/BaseController.cpp`
- [Pin validation API](https://github.com/qitech-industries/hardwarecontrol/blob/main/src/validator/McValidator.cpp): `src/validator/McValidator.cpp`
- [ESP32 pin validation](https://github.com/qitech-industries/hardwarecontrol/blob/main/src/validator/McValidatorEsp32.cpp): `src/validator/McValidatorEsp32.cpp`
- [Logging](https://github.com/qitech-industries/hardwarecontrol/blob/main/src/logger/logging.cpp): `src/logger/logging.cpp`

### Other components

- **Maker**
- **Stepper driver libraries**
- **Connected hardware**

## Connections

- Maker → Serial command firmware: sends commands (evidence: `README.md`)
- Serial command firmware → Stepper control: issues movement commands (evidence: `src/main.cpp`)
- Stepper control → Stepper driver libraries: uses drivers
- Stepper control → Connected hardware: controls steppers (evidence: `README.md`)
- PID heater control → Pin validation API: checks pins (evidence: `src/controller/heater/HeatController.cpp`)
- PID heater control → Logging: writes logs (evidence: `src/controller/heater/HeatController.cpp`)
- PID heater control → Connected hardware: reads sensor and switches heater (evidence: `src/controller/heater/HeatController.cpp`)
- DC motor control → Connected hardware: controls DC motor (evidence: `README.md`)
- Controller base → Pin validation API: holds validator
- Controller base → Logging: holds logging level
- ESP32 pin validation → Pin validation API: extends API
