# hyyoxhk/libeeprom architecture

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

- Interactive diagram: https://gitdiagram.com/hyyoxhk/libeeprom
- Repository: https://github.com/hyyoxhk/libeeprom

## Overview

libeeprom is a C library that reads, decodes, and optionally updates named fields in EEPROM images. An application opens an EEPROM; the library reads and validates its frame, loads the matching JSON layout, and exposes fields by name or index for formatted reads and optional writes. On close after a successful modification, it stamps and writes the image back. The graph follows the sampled calls and README-documented capabilities; Linux device details and some helper implementations were not excerpted.

Main entry points: [`eeprom.c`](https://github.com/hyyoxhk/libeeprom/blob/main/eeprom.c) (EEPROM API), [`hal.c`](https://github.com/hyyoxhk/libeeprom/blob/main/hal.c) (Hardware Access), [`layout.c`](https://github.com/hyyoxhk/libeeprom/blob/main/layout.c) (Layout Manager), [`libjson.c`](https://github.com/hyyoxhk/libeeprom/blob/main/libjson.c) (JSON Parser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Library API"]
  node_api_core["EEPROM API<br/>[eeprom.c]"]
  node_logger["Logging<br/>[log.c]"]
end

subgraph group_image["EEPROM Image Access"]
  node_hal["Hardware Access<br/>[hal.c]"]
  node_frame["Frame Validation<br/>[frame.c]"]
end

subgraph group_layout["Layout Loading"]
  node_layout_manager["Layout Manager<br/>[layout.c]"]
  node_json_parser["JSON Parser<br/>[libjson.c]"]
  node_layout_files["Layout Definitions"]
end

subgraph group_fields["Field Processing"]
  node_field_ops["Field Formatting<br/>[field.c]"]
  node_text_utils["Text Conversion<br/>[util.c]"]
end

node_application(("Application"))
node_eeprom_device[("EEPROM Device")]

node_application -->|"calls API"| node_api_core
node_api_core -->|"reads image"| node_hal
node_api_core -->|"validates frame"| node_frame
node_api_core -->|"builds layout"| node_layout_manager
node_api_core -->|"reads or writes"| node_field_ops
node_layout_manager -->|"parses layout"| node_json_parser
node_json_parser -->|"reads JSON"| node_layout_files
node_field_ops -->|"converts input"| node_text_utils
node_api_core -->|"stamps on close"| node_frame
node_api_core -->|"writes on close"| node_hal
node_hal -.->|"accesses device"| node_eeprom_device
node_application -->|"sets handler"| node_logger

click node_api_core "https://github.com/hyyoxhk/libeeprom/blob/main/eeprom.c"
click node_logger "https://github.com/hyyoxhk/libeeprom/blob/main/log.c"
click node_hal "https://github.com/hyyoxhk/libeeprom/blob/main/hal.c"
click node_frame "https://github.com/hyyoxhk/libeeprom/blob/main/frame.c"
click node_layout_manager "https://github.com/hyyoxhk/libeeprom/blob/main/layout.c"
click node_json_parser "https://github.com/hyyoxhk/libeeprom/blob/main/libjson.c"
click node_layout_files "https://github.com/hyyoxhk/libeeprom/tree/main/layout"
click node_field_ops "https://github.com/hyyoxhk/libeeprom/blob/main/field.c"
click node_text_utils "https://github.com/hyyoxhk/libeeprom/blob/main/util.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_api_core,node_logger toneBlue
class node_hal,node_frame,node_eeprom_device toneAmber
class node_layout_manager,node_json_parser,node_layout_files toneMint
class node_field_ops,node_text_utils toneRose
class node_application toneIndigo
```

## Components

### Library API

- [EEPROM API](https://github.com/hyyoxhk/libeeprom/blob/main/eeprom.c): `eeprom.c`
- [Logging](https://github.com/hyyoxhk/libeeprom/blob/main/log.c): `log.c`

### EEPROM Image Access

- [Hardware Access](https://github.com/hyyoxhk/libeeprom/blob/main/hal.c): `hal.c`
- [Frame Validation](https://github.com/hyyoxhk/libeeprom/blob/main/frame.c): `frame.c`

### Layout Loading

- [Layout Manager](https://github.com/hyyoxhk/libeeprom/blob/main/layout.c): `layout.c`
- [JSON Parser](https://github.com/hyyoxhk/libeeprom/blob/main/libjson.c): `libjson.c`
- [Layout Definitions](https://github.com/hyyoxhk/libeeprom/tree/main/layout): `layout`

### Field Processing

- [Field Formatting](https://github.com/hyyoxhk/libeeprom/blob/main/field.c): `field.c`
- [Text Conversion](https://github.com/hyyoxhk/libeeprom/blob/main/util.c): `util.c`

### Other components

- **Application**
- **EEPROM Device**

## Connections

- Application → EEPROM API: calls API (evidence: `README.md`)
- EEPROM API → Hardware Access: reads image (evidence: `eeprom.c`)
- EEPROM API → Frame Validation: validates frame (evidence: `eeprom.c`)
- EEPROM API → Layout Manager: builds layout (evidence: `eeprom.c`)
- EEPROM API → Field Formatting: reads or writes (evidence: `eeprom.c`)
- Layout Manager → JSON Parser: parses layout (evidence: `layout.c`)
- JSON Parser → Layout Definitions: reads JSON (evidence: `libjson.c`)
- Field Formatting → Text Conversion: converts input (evidence: `field.c`)
- EEPROM API → Frame Validation: stamps on close (evidence: `eeprom.c`)
- EEPROM API → Hardware Access: writes on close (evidence: `eeprom.c`)
- Hardware Access → EEPROM Device: accesses device
- Application → Logging: sets handler (evidence: `README.md`)
