# mccdaq/daqhats architecture

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

- Interactive diagram: https://gitdiagram.com/mccdaq/daqhats
- Repository: https://github.com/mccdaq/daqhats

## Overview

daqhats is a Raspberry Pi library for discovering MCC DAQ HATs and reading or controlling five board families through C and Python APIs. A typical workflow discovers boards, opens a board-specific interface, then performs measurements, scans, or output/control operations. The graph also preserves the documented board-management and firmware-update tools. Source excerpts are partial, so some internal transport and tool-to-library relationships are omitted where the evidence does not establish them.

Main entry points: [`daqhats/hats.py`](https://github.com/mccdaq/daqhats/blob/master/daqhats/hats.py) (Board discovery), [`include/daqhats.h`](https://github.com/mccdaq/daqhats/blob/master/include/daqhats.h) (Shared C API), [`lib/mcc128.c`](https://github.com/mccdaq/daqhats/blob/master/lib/mcc128.c) (MCC 128 driver), [`lib/mcc134.c`](https://github.com/mccdaq/daqhats/blob/master/lib/mcc134.c) (MCC 134 driver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_py["Python API"]
  node_discover["Board discovery<br/>[hats.py]"]
  node_py118["MCC 118 Python<br/>[mcc118.py]"]
  node_py128["MCC 128 Python<br/>[mcc128.py]"]
  node_py134["MCC 134 Python<br/>[mcc134.py]"]
  node_py152["MCC 152 Python<br/>[mcc152.py]"]
  node_py172["MCC 172 Python<br/>[mcc172.py]"]
end

subgraph group_capi["C Board APIs"]
  node_cbase["Shared C API<br/>[daqhats.h]"]
  node_h118["MCC 118 API<br/>[mcc118.h]"]
  node_h128["MCC 128 API<br/>[mcc128.h]"]
  node_h134["MCC 134 API<br/>[mcc134.h]"]
  node_h152["MCC 152 API<br/>[mcc152.h]"]
  node_h172["MCC 172 API<br/>[mcc172.h]"]
  node_c118["MCC 118 driver<br/>[mcc118.c]"]
  node_c128["MCC 128 driver<br/>[mcc128.c]"]
  node_c134["MCC 134 driver<br/>[mcc134.c]"]
  node_c152["MCC 152 driver<br/>[mcc152.c]"]
  node_c172["MCC 172 driver<br/>[mcc172.c]"]
end

subgraph group_internal["Shared Internals"]
  node_util["System utilities<br/>[util.c]"]
  node_gpio["GPIO control<br/>[gpio.h]"]
  node_json["JSON parser<br/>[cJSON.c]"]
  node_nist["NIST conversions<br/>[nist.c]"]
end

subgraph group_tools["Board Utilities"]
  node_manager["DAQ HAT Manager<br/>[daqhats_manager.c]"]
  node_list["Board listing"]
  node_fw118["MCC 118 updater"]
  node_fw128["MCC 128 updater"]
  node_fw172["MCC 172 updater"]
end

node_user(("Application user"))

node_user -->|"discovers boards"| node_discover
node_user -->|"uses board API"| node_py118
node_user -.->|"uses board API"| node_py128
node_user -.->|"uses board API"| node_py134
node_user -.->|"uses board API"| node_py152
node_user -.->|"uses board API"| node_py172
node_discover -.->|"selects board"| node_py118
node_discover -.->|"selects board"| node_py128
node_discover -.->|"selects board"| node_py134
node_discover -.->|"selects board"| node_py152
node_discover -.->|"selects board"| node_py172
node_py118 -->|"imports shared API"| node_discover
node_py128 -->|"imports shared API"| node_discover
node_py134 -->|"imports shared API"| node_discover
node_py152 -->|"imports shared API"| node_discover
node_py172 -->|"imports shared API"| node_discover
node_c118 -->|"uses utilities"| node_util
node_c128 -->|"uses utilities"| node_util
node_c134 -->|"uses utilities"| node_util
node_c172 -->|"uses utilities"| node_util
node_c118 -->|"parses calibration"| node_json
node_c128 -->|"parses calibration"| node_json
node_c134 -->|"parses calibration"| node_json
node_c172 -->|"parses calibration"| node_json
node_c134 -->|"uses conversions"| node_nist
node_c128 -->|"uses GPIO"| node_gpio
node_c172 -->|"uses GPIO"| node_gpio
node_c118 -.->|"implements API"| node_h118
node_c128 -.->|"implements API"| node_h128
node_c134 -.->|"implements API"| node_h134
node_c152 -.->|"implements API"| node_h152
node_c172 -.->|"implements API"| node_h172
node_cbase -->|"includes declarations"| node_h118
node_cbase -->|"includes declarations"| node_h128
node_cbase -->|"includes declarations"| node_h134
node_cbase -->|"includes declarations"| node_h152
node_cbase -->|"includes declarations"| node_h172
node_user -->|"manages stack"| node_manager
node_user -->|"lists boards"| node_list
node_user -->|"updates firmware"| node_fw118
node_user -->|"updates firmware"| node_fw128
node_user -->|"updates firmware"| node_fw172
node_fw118 -->|"calls device API"| node_h118
node_fw128 -.->|"calls device API"| node_h128
node_fw172 -.->|"calls device API"| node_h172

click node_discover "https://github.com/mccdaq/daqhats/blob/master/daqhats/hats.py"
click node_py118 "https://github.com/mccdaq/daqhats/blob/master/daqhats/mcc118.py"
click node_py128 "https://github.com/mccdaq/daqhats/blob/master/daqhats/mcc128.py"
click node_py134 "https://github.com/mccdaq/daqhats/blob/master/daqhats/mcc134.py"
click node_py152 "https://github.com/mccdaq/daqhats/blob/master/daqhats/mcc152.py"
click node_py172 "https://github.com/mccdaq/daqhats/blob/master/daqhats/mcc172.py"
click node_cbase "https://github.com/mccdaq/daqhats/blob/master/include/daqhats.h"
click node_h118 "https://github.com/mccdaq/daqhats/blob/master/include/mcc118.h"
click node_h128 "https://github.com/mccdaq/daqhats/blob/master/include/mcc128.h"
click node_h134 "https://github.com/mccdaq/daqhats/blob/master/include/mcc134.h"
click node_h152 "https://github.com/mccdaq/daqhats/blob/master/include/mcc152.h"
click node_h172 "https://github.com/mccdaq/daqhats/blob/master/include/mcc172.h"
click node_c118 "https://github.com/mccdaq/daqhats/blob/master/lib/mcc118.c"
click node_c128 "https://github.com/mccdaq/daqhats/blob/master/lib/mcc128.c"
click node_c134 "https://github.com/mccdaq/daqhats/blob/master/lib/mcc134.c"
click node_c152 "https://github.com/mccdaq/daqhats/blob/master/lib/mcc152.c"
click node_c172 "https://github.com/mccdaq/daqhats/blob/master/lib/mcc172.c"
click node_util "https://github.com/mccdaq/daqhats/blob/master/lib/util.c"
click node_gpio "https://github.com/mccdaq/daqhats/blob/master/lib/gpio.h"
click node_json "https://github.com/mccdaq/daqhats/blob/master/lib/cJSON.c"
click node_nist "https://github.com/mccdaq/daqhats/blob/master/lib/nist.c"
click node_manager "https://github.com/mccdaq/daqhats/blob/master/tools/applications/daqhats_manager.c"
click node_list "https://github.com/mccdaq/daqhats/blob/master/tools/daqhats_list_boards.c"
click node_fw118 "https://github.com/mccdaq/daqhats/blob/master/tools/mcc118_firmware_update.c"
click node_fw128 "https://github.com/mccdaq/daqhats/blob/master/tools/mcc128_firmware_update.c"
click node_fw172 "https://github.com/mccdaq/daqhats/blob/master/tools/mcc172_firmware_update.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_discover,node_py118,node_py128,node_py134,node_py152,node_py172,node_user toneBlue
class node_cbase,node_h118,node_h128,node_h134,node_h152,node_h172,node_c118,node_c128,node_c134,node_c152,node_c172 toneAmber
class node_util,node_gpio,node_json,node_nist toneMint
class node_manager,node_list,node_fw118,node_fw128,node_fw172 toneRose
```

## Components

### Python API

- [Board discovery](https://github.com/mccdaq/daqhats/blob/master/daqhats/hats.py): `daqhats/hats.py`
- [MCC 118 Python](https://github.com/mccdaq/daqhats/blob/master/daqhats/mcc118.py): `daqhats/mcc118.py`
- [MCC 128 Python](https://github.com/mccdaq/daqhats/blob/master/daqhats/mcc128.py): `daqhats/mcc128.py`
- [MCC 134 Python](https://github.com/mccdaq/daqhats/blob/master/daqhats/mcc134.py): `daqhats/mcc134.py`
- [MCC 152 Python](https://github.com/mccdaq/daqhats/blob/master/daqhats/mcc152.py): `daqhats/mcc152.py`
- [MCC 172 Python](https://github.com/mccdaq/daqhats/blob/master/daqhats/mcc172.py): `daqhats/mcc172.py`

### C Board APIs

- [Shared C API](https://github.com/mccdaq/daqhats/blob/master/include/daqhats.h): `include/daqhats.h`
- [MCC 118 API](https://github.com/mccdaq/daqhats/blob/master/include/mcc118.h): `include/mcc118.h`
- [MCC 128 API](https://github.com/mccdaq/daqhats/blob/master/include/mcc128.h): `include/mcc128.h`
- [MCC 134 API](https://github.com/mccdaq/daqhats/blob/master/include/mcc134.h): `include/mcc134.h`
- [MCC 152 API](https://github.com/mccdaq/daqhats/blob/master/include/mcc152.h): `include/mcc152.h`
- [MCC 172 API](https://github.com/mccdaq/daqhats/blob/master/include/mcc172.h): `include/mcc172.h`
- [MCC 118 driver](https://github.com/mccdaq/daqhats/blob/master/lib/mcc118.c): `lib/mcc118.c`
- [MCC 128 driver](https://github.com/mccdaq/daqhats/blob/master/lib/mcc128.c): `lib/mcc128.c`
- [MCC 134 driver](https://github.com/mccdaq/daqhats/blob/master/lib/mcc134.c): `lib/mcc134.c`
- [MCC 152 driver](https://github.com/mccdaq/daqhats/blob/master/lib/mcc152.c): `lib/mcc152.c`
- [MCC 172 driver](https://github.com/mccdaq/daqhats/blob/master/lib/mcc172.c): `lib/mcc172.c`

### Shared Internals

- [System utilities](https://github.com/mccdaq/daqhats/blob/master/lib/util.c): `lib/util.c`
- [GPIO control](https://github.com/mccdaq/daqhats/blob/master/lib/gpio.h): `lib/gpio.h`
- [JSON parser](https://github.com/mccdaq/daqhats/blob/master/lib/cJSON.c): `lib/cJSON.c`
- [NIST conversions](https://github.com/mccdaq/daqhats/blob/master/lib/nist.c): `lib/nist.c`

### Board Utilities

- [DAQ HAT Manager](https://github.com/mccdaq/daqhats/blob/master/tools/applications/daqhats_manager.c): `tools/applications/daqhats_manager.c`
- [Board listing](https://github.com/mccdaq/daqhats/blob/master/tools/daqhats_list_boards.c): `tools/daqhats_list_boards.c`
- [MCC 118 updater](https://github.com/mccdaq/daqhats/blob/master/tools/mcc118_firmware_update.c): `tools/mcc118_firmware_update.c`
- [MCC 128 updater](https://github.com/mccdaq/daqhats/blob/master/tools/mcc128_firmware_update.c): `tools/mcc128_firmware_update.c`
- [MCC 172 updater](https://github.com/mccdaq/daqhats/blob/master/tools/mcc172_firmware_update.c): `tools/mcc172_firmware_update.c`

### Other components

- **Application user**

## Connections

- Application user → Board discovery: discovers boards (evidence: `README.md`)
- Application user → MCC 118 Python: uses board API (evidence: `README.md`)
- Application user → MCC 128 Python: uses board API
- Application user → MCC 134 Python: uses board API
- Application user → MCC 152 Python: uses board API
- Application user → MCC 172 Python: uses board API
- Board discovery → MCC 118 Python: selects board (evidence: `daqhats/mcc118.py`)
- Board discovery → MCC 128 Python: selects board (evidence: `daqhats/mcc128.py`)
- Board discovery → MCC 134 Python: selects board (evidence: `daqhats/mcc134.py`)
- Board discovery → MCC 152 Python: selects board (evidence: `daqhats/mcc152.py`)
- Board discovery → MCC 172 Python: selects board (evidence: `daqhats/mcc172.py`)
- MCC 118 Python → Board discovery: imports shared API (evidence: `daqhats/mcc118.py`)
- MCC 128 Python → Board discovery: imports shared API (evidence: `daqhats/mcc128.py`)
- MCC 134 Python → Board discovery: imports shared API (evidence: `daqhats/mcc134.py`)
- MCC 152 Python → Board discovery: imports shared API (evidence: `daqhats/mcc152.py`)
- MCC 172 Python → Board discovery: imports shared API (evidence: `daqhats/mcc172.py`)
- MCC 118 driver → System utilities: uses utilities (evidence: `lib/mcc118.c`)
- MCC 128 driver → System utilities: uses utilities (evidence: `lib/mcc128.c`)
- MCC 134 driver → System utilities: uses utilities (evidence: `lib/mcc134.c`)
- MCC 172 driver → System utilities: uses utilities (evidence: `lib/mcc172.c`)
- MCC 118 driver → JSON parser: parses calibration (evidence: `lib/mcc118.c`)
- MCC 128 driver → JSON parser: parses calibration (evidence: `lib/mcc128.c`)
- MCC 134 driver → JSON parser: parses calibration (evidence: `lib/mcc134.c`)
- MCC 172 driver → JSON parser: parses calibration (evidence: `lib/mcc172.c`)
- MCC 134 driver → NIST conversions: uses conversions (evidence: `lib/mcc134.c`)
- MCC 128 driver → GPIO control: uses GPIO (evidence: `lib/mcc128.c`)
- MCC 172 driver → GPIO control: uses GPIO (evidence: `lib/mcc172.c`)
- MCC 118 driver → MCC 118 API: implements API
- MCC 128 driver → MCC 128 API: implements API
- MCC 134 driver → MCC 134 API: implements API
- MCC 152 driver → MCC 152 API: implements API
- MCC 172 driver → MCC 172 API: implements API
- Shared C API → MCC 118 API: includes declarations (evidence: `include/daqhats.h`)
- Shared C API → MCC 128 API: includes declarations (evidence: `include/daqhats.h`)
- Shared C API → MCC 134 API: includes declarations (evidence: `include/daqhats.h`)
- Shared C API → MCC 152 API: includes declarations (evidence: `include/daqhats.h`)
- Shared C API → MCC 172 API: includes declarations (evidence: `include/daqhats.h`)
- Application user → DAQ HAT Manager: manages stack (evidence: `README.md`)
- Application user → Board listing: lists boards (evidence: `README.md`)
- Application user → MCC 118 updater: updates firmware (evidence: `README.md`)
- Application user → MCC 128 updater: updates firmware (evidence: `README.md`)
- Application user → MCC 172 updater: updates firmware (evidence: `README.md`)
- MCC 118 updater → MCC 118 API: calls device API (evidence: `tools/mcc118_firmware_update.c`)
- MCC 128 updater → MCC 128 API: calls device API
- MCC 172 updater → MCC 172 API: calls device API
