# crazydw4rf/dfplayer-esp32 architecture

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

- Interactive diagram: https://gitdiagram.com/crazydw4rf/dfplayer-esp32
- Repository: https://github.com/crazydw4rf/dfplayer-esp32

## Overview

This small Rust library lets an application issue playback and configuration commands to a DFPlayer Mini over ESP-IDF UART. The main path is: application calls the DfPlayer API, command variants are encoded into parameters and a protocol frame, and the frame is written to UART. Query commands are explicitly still TODO. The graph reflects the sampled runtime source; it does not model unsampled behavior.

Main entry points: [`src/lib.rs`](https://github.com/crazydw4rf/dfplayer-esp32/blob/main/src/lib.rs) (DfPlayer API), [`src/command.rs`](https://github.com/crazydw4rf/dfplayer-esp32/blob/main/src/command.rs) (Command encoding), [`src/error.rs`](https://github.com/crazydw4rf/dfplayer-esp32/blob/main/src/error.rs) (Errors), [`src/parameter.rs`](https://github.com/crazydw4rf/dfplayer-esp32/blob/main/src/parameter.rs) (Parameter types)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_application(("Application"))
node_player["DfPlayer API<br/>[lib.rs]"]
node_command["Command encoding<br/>[command.rs]"]
node_parameter["Parameter types<br/>[parameter.rs]"]
node_errors["Errors<br/>[error.rs]"]
node_uart["ESP-IDF UART"]
node_module["DFPlayer Mini"]

node_application -->|"calls API"| node_player
node_player -->|"encodes command"| node_command
node_command -->|"builds parameters"| node_parameter
node_command -->|"returns validation errors"| node_errors
node_player -->|"returns send errors"| node_errors
node_player -->|"writes frame"| node_uart
node_uart -->|"transfers bytes"| node_module

click node_player "https://github.com/crazydw4rf/dfplayer-esp32/blob/main/src/lib.rs"
click node_command "https://github.com/crazydw4rf/dfplayer-esp32/blob/main/src/command.rs"
click node_parameter "https://github.com/crazydw4rf/dfplayer-esp32/blob/main/src/parameter.rs"
click node_errors "https://github.com/crazydw4rf/dfplayer-esp32/blob/main/src/error.rs"

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_application,node_uart,node_module toneIndigo
class node_player toneMint
class node_command,node_parameter,node_errors toneTeal
```

## Components

### Other components

- **Application**
- [DfPlayer API](https://github.com/crazydw4rf/dfplayer-esp32/blob/main/src/lib.rs): `src/lib.rs`
- [Command encoding](https://github.com/crazydw4rf/dfplayer-esp32/blob/main/src/command.rs): `src/command.rs`
- [Parameter types](https://github.com/crazydw4rf/dfplayer-esp32/blob/main/src/parameter.rs): `src/parameter.rs`
- [Errors](https://github.com/crazydw4rf/dfplayer-esp32/blob/main/src/error.rs): `src/error.rs`
- **ESP-IDF UART**
- **DFPlayer Mini**

## Connections

- Application → DfPlayer API: calls API
- DfPlayer API → Command encoding: encodes command
- Command encoding → Parameter types: builds parameters
- Command encoding → Errors: returns validation errors
- DfPlayer API → Errors: returns send errors
- DfPlayer API → ESP-IDF UART: writes frame
- ESP-IDF UART → DFPlayer Mini: transfers bytes
