# fh-stece2023-org/fh-stece2023 architecture

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

- Interactive diagram: https://gitdiagram.com/fh-stece2023-org/fh-stece2023
- Repository: https://github.com/fh-stece2023-org/fh-stece2023

## Overview

This repository implements a GPIO-controlled door system: inputs and analog sensing inform a door state machine, which selects motor behavior. The tree and excerpts also show hardware and mock implementations, event-loop utilities, and I2C sensor support. The main executable’s wiring was not shown, so links from it to runtime components are left unverified; unsampled subsystems are included only where their paths and roles are supported by the tree or README.

Main entry points: [`src/door/analog_stuff/sensor/analog-sensor.h`](https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/analog_stuff/sensor/analog-sensor.h) (Analog sensor interface), [`src/door/motor/motor.h`](https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/motor/motor.h) (Motor interface), [`src/door/statemachine/door.cpp`](https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/statemachine/door.cpp) (Door state machine), [`bin/run-door.cpp`](https://github.com/fh-stece2023-org/fh-stece2023/blob/main/bin/run-door.cpp) (Door executable)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Door control"]
  node_door["Door state machine<br/>[door.cpp]"]
  node_inputs["Input collection<br/>[inputs.cpp]"]
  node_control_types["Control event types<br/>[structs.h]"]
end

subgraph group_sensing["Inputs and sensing"]
  node_input_switch["Input switch<br/>[input-switch.h]"]
  node_gpio_input["GPIO input"]
  node_edge_event["GPIO edge events"]
  node_analog_event["Analog event generator"]
  node_analog_sensor["Analog sensor interface<br/>[analog-sensor.h]"]
  node_ads1115["ADS1115 converter<br/>[adc-ads1115.cpp]"]
  node_bmp280["BMP280 pressure sensor"]
  node_mock_inputs["Input mock"]
  node_mock_sensor["Analog sensor mock"]
end

subgraph group_hardware["Hardware interfaces"]
  node_motor["Motor interface<br/>[motor.h]"]
  node_stepper["Stepper motor<br/>[motor-stepper.cpp]"]
  node_motor_led["Motor LED<br/>[motorLED.cpp]"]
  node_output_switch["Output switch<br/>[output-switch.h]"]
  node_gpio_output["GPIO output"]
  node_mock_outputs["Output mock"]
  node_mock_motor["Motor mock<br/>[motor-mock.cpp]"]
end

subgraph group_runtime["Runtime utilities"]
  node_i2c["I2C access<br/>[i2c.cpp]"]
  node_eventloop["Event loop<br/>[eventloop.cpp]"]
  node_timer["One-shot timer<br/>[one-shot-timer.cpp]"]
  node_file_io["Sysfs file access"]
end

node_operator(("Door user"))
node_runner["Door executable<br/>[run-door.cpp]"]

node_operator -.->|"uses"| node_runner
node_runner -.->|"starts"| node_door
node_inputs -.->|"reads"| node_input_switch
node_inputs -.->|"collects events"| node_analog_event
node_door -->|"selects direction"| node_motor
node_door -->|"uses events"| node_control_types
node_gpio_input -->|"implements"| node_input_switch
node_edge_event -->|"registers with"| node_eventloop
node_edge_event -->|"configures GPIO"| node_file_io
node_analog_event -->|"reads"| node_analog_sensor
node_ads1115 -->|"implements"| node_analog_sensor
node_ads1115 -->|"reads conversion"| node_i2c
node_bmp280 -->|"reads pressure"| node_i2c
node_bmp280 -->|"implements"| node_analog_sensor
node_stepper -->|"implements"| node_motor
node_stepper -->|"sets GPIO"| node_output_switch
node_motor_led -->|"uses interface"| node_motor
node_gpio_output -->|"implements"| node_output_switch
node_gpio_output -->|"writes GPIO"| node_file_io
node_timer -->|"uses"| node_eventloop
node_timer -.->|"scheduling role"| node_runner
node_mock_inputs -->|"implements"| node_input_switch
node_mock_outputs -->|"implements"| node_output_switch
node_mock_motor -->|"implements"| node_motor
node_mock_sensor -->|"implements"| node_analog_sensor

click node_runner "https://github.com/fh-stece2023-org/fh-stece2023/blob/main/bin/run-door.cpp"
click node_door "https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/statemachine/door.cpp"
click node_inputs "https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/statemachine/inputs.cpp"
click node_control_types "https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/statemachine/structs.h"
click node_input_switch "https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/input_output_switch/input/input-switch.h"
click node_gpio_input "https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/input_output_switch/input/input-switch-gpio-sysfs.cpp"
click node_edge_event "https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/input_output_switch/input/input-edge-event.cpp"
click node_analog_event "https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/analog_stuff/sensor/analog-sensor-event-generator.cpp"
click node_analog_sensor "https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/analog_stuff/sensor/analog-sensor.h"
click node_ads1115 "https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/analog_stuff/adc/adc-ads1115.cpp"
click node_bmp280 "https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/analog_stuff/sensor/pressure-sensor-bmp280.cpp"
click node_motor "https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/motor/motor.h"
click node_stepper "https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/motor/motor-stepper.cpp"
click node_motor_led "https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/motor/motorLED.cpp"
click node_output_switch "https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/input_output_switch/output/output-switch.h"
click node_gpio_output "https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/input_output_switch/output/output-switch-gpio-sysfs.cpp"
click node_i2c "https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/utilities/i2c.cpp"
click node_eventloop "https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/utilities/eventloop.cpp"
click node_timer "https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/utilities/one-shot-timer.cpp"
click node_file_io "https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/utilities/small_file_handling.cpp"
click node_mock_inputs "https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/input_output_switch/input/input-switch-mock.cpp"
click node_mock_outputs "https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/input_output_switch/output/output-switch-mock.cpp"
click node_mock_motor "https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/motor/motor-mock.cpp"
click node_mock_sensor "https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/analog_stuff/sensor/analog-sensor-mock.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_door,node_inputs,node_control_types,node_operator toneBlue
class node_input_switch,node_gpio_input,node_edge_event,node_analog_event,node_analog_sensor,node_ads1115,node_bmp280,node_mock_inputs,node_mock_sensor toneAmber
class node_motor,node_stepper,node_motor_led,node_output_switch,node_gpio_output,node_mock_outputs,node_mock_motor toneMint
class node_i2c,node_eventloop,node_timer,node_file_io toneRose
class node_runner toneTeal
```

## Components

### Door control

- [Door state machine](https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/statemachine/door.cpp): `src/door/statemachine/door.cpp`
- [Input collection](https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/statemachine/inputs.cpp): `src/door/statemachine/inputs.cpp`
- [Control event types](https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/statemachine/structs.h): `src/door/statemachine/structs.h`

### Inputs and sensing

- [Input switch](https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/input_output_switch/input/input-switch.h): `src/door/input_output_switch/input/input-switch.h`
- [GPIO input](https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/input_output_switch/input/input-switch-gpio-sysfs.cpp): `src/door/input_output_switch/input/input-switch-gpio-sysfs.cpp`
- [GPIO edge events](https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/input_output_switch/input/input-edge-event.cpp): `src/door/input_output_switch/input/input-edge-event.cpp`
- [Analog event generator](https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/analog_stuff/sensor/analog-sensor-event-generator.cpp): `src/door/analog_stuff/sensor/analog-sensor-event-generator.cpp`
- [Analog sensor interface](https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/analog_stuff/sensor/analog-sensor.h): `src/door/analog_stuff/sensor/analog-sensor.h`
- [ADS1115 converter](https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/analog_stuff/adc/adc-ads1115.cpp): `src/door/analog_stuff/adc/adc-ads1115.cpp`
- [BMP280 pressure sensor](https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/analog_stuff/sensor/pressure-sensor-bmp280.cpp): `src/door/analog_stuff/sensor/pressure-sensor-bmp280.cpp`
- [Input mock](https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/input_output_switch/input/input-switch-mock.cpp): `src/door/input_output_switch/input/input-switch-mock.cpp`
- [Analog sensor mock](https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/analog_stuff/sensor/analog-sensor-mock.cpp): `src/door/analog_stuff/sensor/analog-sensor-mock.cpp`

### Hardware interfaces

- [Motor interface](https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/motor/motor.h): `src/door/motor/motor.h`
- [Stepper motor](https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/motor/motor-stepper.cpp): `src/door/motor/motor-stepper.cpp`
- [Motor LED](https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/motor/motorLED.cpp): `src/door/motor/motorLED.cpp`
- [Output switch](https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/input_output_switch/output/output-switch.h): `src/door/input_output_switch/output/output-switch.h`
- [GPIO output](https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/input_output_switch/output/output-switch-gpio-sysfs.cpp): `src/door/input_output_switch/output/output-switch-gpio-sysfs.cpp`
- [Output mock](https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/input_output_switch/output/output-switch-mock.cpp): `src/door/input_output_switch/output/output-switch-mock.cpp`
- [Motor mock](https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/motor/motor-mock.cpp): `src/door/motor/motor-mock.cpp`

### Runtime utilities

- [I2C access](https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/utilities/i2c.cpp): `src/door/utilities/i2c.cpp`
- [Event loop](https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/utilities/eventloop.cpp): `src/door/utilities/eventloop.cpp`
- [One-shot timer](https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/utilities/one-shot-timer.cpp): `src/door/utilities/one-shot-timer.cpp`
- [Sysfs file access](https://github.com/fh-stece2023-org/fh-stece2023/blob/main/src/door/utilities/small_file_handling.cpp): `src/door/utilities/small_file_handling.cpp`

### Other components

- **Door user**
- [Door executable](https://github.com/fh-stece2023-org/fh-stece2023/blob/main/bin/run-door.cpp): `bin/run-door.cpp`

## Connections

- Door user → Door executable: uses
- Door executable → Door state machine: starts
- Input collection → Input switch: reads
- Input collection → Analog event generator: collects events
- Door state machine → Motor interface: selects direction (evidence: `src/door/statemachine/door.cpp`)
- Door state machine → Control event types: uses events (evidence: `src/door/statemachine/door.cpp`)
- GPIO input → Input switch: implements
- GPIO edge events → Event loop: registers with (evidence: `src/door/input_output_switch/input/input-edge-event.cpp`)
- GPIO edge events → Sysfs file access: configures GPIO (evidence: `src/door/input_output_switch/input/input-edge-event.cpp`)
- Analog event generator → Analog sensor interface: reads
- ADS1115 converter → Analog sensor interface: implements
- ADS1115 converter → I2C access: reads conversion (evidence: `src/door/analog_stuff/adc/adc-ads1115.cpp`)
- BMP280 pressure sensor → I2C access: reads pressure (evidence: `src/door/analog_stuff/sensor/pressure-sensor-bmp280.cpp`)
- BMP280 pressure sensor → Analog sensor interface: implements
- Stepper motor → Motor interface: implements
- Stepper motor → Output switch: sets GPIO (evidence: `src/door/motor/motor-stepper.cpp`)
- Motor LED → Motor interface: uses interface
- GPIO output → Output switch: implements
- GPIO output → Sysfs file access: writes GPIO (evidence: `src/door/input_output_switch/output/output-switch-gpio-sysfs.cpp`)
- One-shot timer → Event loop: uses
- One-shot timer → Door executable: scheduling role
- Input mock → Input switch: implements
- Output mock → Output switch: implements
- Motor mock → Motor interface: implements (evidence: `src/door/motor/motor-mock.cpp`)
- Analog sensor mock → Analog sensor interface: implements
