# maru006/contrib architecture

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

- Interactive diagram: https://gitdiagram.com/maru006/contrib
- Repository: https://github.com/maru006/contrib

## Overview

This repository is a collection of Raspberry Pi hardware contributions rather than one integrated product: GPIO sensor readers and two servo-control programs. The principal workflows are sensor signal acquisition and interpretation, or user input translated into servo movement. The sampled code supports the GPIO and wired-servo flows; the BLE utility excerpt shows controller discovery and event handling, though its complete implementation was not sampled.

Main entry points: [`dht11/main.c`](https://github.com/maru006/contrib/blob/master/dht11/main.c) (DHT11 Reader), [`lasersensor/main.c`](https://github.com/maru006/contrib/blob/master/lasersensor/main.c) (Laser Counter), [`servo/servo_ble/utils.c`](https://github.com/maru006/contrib/blob/master/servo/servo_ble/utils.c) (Bluetooth / Servo Helpers), [`servo/servo_c/main.c`](https://github.com/maru006/contrib/blob/master/servo/servo_c/main.c) (Keyboard Servo)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sensors["GPIO Sensors"]
  node_dht_app["DHT11 Reader<br/>[main.c]"]
  node_dht_utils["GPIO Helpers<br/>[utils.c]"]
  node_dht_result["Humidity / Temperature<br/>[main.c]"]
  node_laser_app["Laser Counter<br/>[main.c]"]
  node_laser_utils["GPIO Helpers<br/>[utils.c]"]
  node_hit_count["Hit Count<br/>[main.c]"]
end

subgraph group_servo["Servo Control"]
  node_keyboard_app["Keyboard Servo<br/>[main.c]"]
  node_keyboard_utils["Servo / I2C Helpers<br/>[utils.c]"]
  node_ble_app["BLE Servo<br/>[main.c]"]
  node_ble_utils["Bluetooth / Servo Helpers<br/>[utils.c]"]
end

subgraph group_support["Hardware Interfaces"]
  node_dht_sensor["DHT11 Sensor"]
  node_laser_sensor["Laser Sensor"]
  node_controller["8BitDo Controller"]
  node_bluez["BlueZ / D-Bus"]
  node_input_device["Linux Input Device"]
  node_i2c["I²C Servo Hardware"]
  node_gpio["GPIO Hardware"]
end

node_operator(("Operator"))

node_operator -->|"starts read"| node_dht_app
node_dht_app -->|"requests lines"| node_dht_utils
node_dht_app -->|"drives / reads"| node_gpio
node_dht_utils -->|"configures lines"| node_gpio
node_dht_sensor -->|"signals"| node_gpio
node_dht_app -->|"decodes pulses"| node_dht_result
node_operator -->|"starts counting"| node_laser_app
node_laser_app -->|"requests / snapshots"| node_laser_utils
node_laser_app -->|"powers / reads"| node_gpio
node_laser_utils -->|"configures lines"| node_gpio
node_laser_sensor -->|"signals hits"| node_gpio
node_laser_app -->|"counts detections"| node_hit_count
node_operator -->|"presses keys"| node_keyboard_app
node_keyboard_app -->|"sets / moves angles"| node_keyboard_utils
node_keyboard_app -->|"selects mux channel"| node_keyboard_utils
node_keyboard_utils -->|"writes PWM / mux"| node_i2c
node_operator -->|"starts control"| node_ble_app
node_ble_app -->|"discovers / reads events"| node_ble_utils
node_ble_app -->|"pairs / connects"| node_bluez
node_ble_utils -->|"queries / disconnects"| node_bluez
node_controller -.->|"advertises"| node_bluez
node_ble_utils -->|"finds / reads events"| node_input_device
node_ble_utils -->|"writes PWM / mux"| node_i2c

click node_dht_app "https://github.com/maru006/contrib/blob/master/dht11/main.c"
click node_dht_utils "https://github.com/maru006/contrib/blob/master/dht11/utils.c"
click node_dht_result "https://github.com/maru006/contrib/blob/master/dht11/main.c"
click node_laser_app "https://github.com/maru006/contrib/blob/master/lasersensor/main.c"
click node_laser_utils "https://github.com/maru006/contrib/blob/master/lasersensor/utils.c"
click node_hit_count "https://github.com/maru006/contrib/blob/master/lasersensor/main.c"
click node_keyboard_app "https://github.com/maru006/contrib/blob/master/servo/servo_c/main.c"
click node_keyboard_utils "https://github.com/maru006/contrib/blob/master/servo/servo_c/utils.c"
click node_ble_app "https://github.com/maru006/contrib/blob/master/servo/servo_ble/main.c"
click node_ble_utils "https://github.com/maru006/contrib/blob/master/servo/servo_ble/utils.c"

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_dht_app,node_dht_utils,node_dht_result,node_laser_app,node_laser_utils,node_hit_count toneBlue
class node_keyboard_app,node_keyboard_utils,node_ble_app,node_ble_utils toneAmber
class node_dht_sensor,node_laser_sensor,node_controller,node_bluez,node_input_device,node_i2c,node_gpio toneMint
class node_operator toneIndigo
```

## Components

### GPIO Sensors

- [DHT11 Reader](https://github.com/maru006/contrib/blob/master/dht11/main.c): `dht11/main.c`
- [GPIO Helpers](https://github.com/maru006/contrib/blob/master/dht11/utils.c): `dht11/utils.c`
- [Humidity / Temperature](https://github.com/maru006/contrib/blob/master/dht11/main.c): `dht11/main.c`
- [Laser Counter](https://github.com/maru006/contrib/blob/master/lasersensor/main.c): `lasersensor/main.c`
- [GPIO Helpers](https://github.com/maru006/contrib/blob/master/lasersensor/utils.c): `lasersensor/utils.c`
- [Hit Count](https://github.com/maru006/contrib/blob/master/lasersensor/main.c): `lasersensor/main.c`

### Servo Control

- [Keyboard Servo](https://github.com/maru006/contrib/blob/master/servo/servo_c/main.c): `servo/servo_c/main.c`
- [Servo / I2C Helpers](https://github.com/maru006/contrib/blob/master/servo/servo_c/utils.c): `servo/servo_c/utils.c`
- [BLE Servo](https://github.com/maru006/contrib/blob/master/servo/servo_ble/main.c): `servo/servo_ble/main.c`
- [Bluetooth / Servo Helpers](https://github.com/maru006/contrib/blob/master/servo/servo_ble/utils.c): `servo/servo_ble/utils.c`

### Hardware Interfaces

- **DHT11 Sensor**
- **Laser Sensor**
- **8BitDo Controller**
- **BlueZ / D-Bus**
- **Linux Input Device**
- **I²C Servo Hardware**
- **GPIO Hardware**

### Other components

- **Operator**

## Connections

- Operator → DHT11 Reader: starts read
- DHT11 Reader → GPIO Helpers: requests lines
- DHT11 Reader → GPIO Hardware: drives / reads
- GPIO Helpers → GPIO Hardware: configures lines
- DHT11 Sensor → GPIO Hardware: signals
- DHT11 Reader → Humidity / Temperature: decodes pulses
- Operator → Laser Counter: starts counting
- Laser Counter → GPIO Helpers: requests / snapshots
- Laser Counter → GPIO Hardware: powers / reads
- GPIO Helpers → GPIO Hardware: configures lines
- Laser Sensor → GPIO Hardware: signals hits
- Laser Counter → Hit Count: counts detections
- Operator → Keyboard Servo: presses keys
- Keyboard Servo → Servo / I2C Helpers: sets / moves angles
- Keyboard Servo → Servo / I2C Helpers: selects mux channel
- Servo / I2C Helpers → I²C Servo Hardware: writes PWM / mux
- Operator → BLE Servo: starts control
- BLE Servo → Bluetooth / Servo Helpers: discovers / reads events
- BLE Servo → BlueZ / D-Bus: pairs / connects
- Bluetooth / Servo Helpers → BlueZ / D-Bus: queries / disconnects
- 8BitDo Controller → BlueZ / D-Bus: advertises
- Bluetooth / Servo Helpers → Linux Input Device: finds / reads events
- Bluetooth / Servo Helpers → I²C Servo Hardware: writes PWM / mux
