# stm32duino/x-nucleo-ihm01a1 architecture

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

- Interactive diagram: https://gitdiagram.com/stm32duino/x-nucleo-ihm01a1
- Repository: https://github.com/stm32duino/x-nucleo-ihm01a1

## Overview

This Arduino library exposes a stepper-motor interface backed by the L6474 driver on the X-NUCLEO-IHM01A1 board. The principal workflow is an application issuing motion or configuration operations through the motor API; the driver handles device commands and communicates over SPI. The README also documents a one-motor positioning example. Source excerpts show the API wrappers and SPI transfer implementation; details of the example’s calls and some internal behavior were not sampled.

Main entry points: [`src/L6474.cpp`](https://github.com/stm32duino/x-nucleo-ihm01a1/blob/main/src/L6474.cpp) (Command and motion driver), [`src/L6474_def.h`](https://github.com/stm32duino/x-nucleo-ihm01a1/blob/main/src/L6474_def.h) (Register and device types), [`src/L6474.h`](https://github.com/stm32duino/x-nucleo-ihm01a1/blob/main/src/L6474.h) (L6474 component), [`src/motor_def.h`](https://github.com/stm32duino/x-nucleo-ihm01a1/blob/main/src/motor_def.h) (Motor types and vtable)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Motor API"]
  node_motor_api["Stepper interface<br/>[StepperMotor.h]"]
  node_l6474_class["L6474 component<br/>[L6474.h]"]
  node_component_class["Generic component interface<br/>[Component.h]"]
end

subgraph group_driver["L6474 Driver"]
  node_driver_core["Command and motion driver<br/>[L6474.cpp]"]
end

subgraph group_defs["Configuration and Types"]
  node_driver_defs["Register and device types<br/>[L6474_def.h]"]
  node_target_config["Device defaults<br/>[L6474_config.h]"]
  node_motor_defs["Motor types and vtable<br/>[motor_def.h]"]
  node_component_defs["Component types<br/>[component_def.h]"]
end

node_application(("Arduino application"))
node_spi["SPI instance"]
node_motor_board["Stepper motor board"]

node_application -.->|"issues motion commands"| node_motor_api
node_l6474_class -->|"implements"| node_motor_api
node_l6474_class -->|"calls driver functions"| node_driver_core
node_driver_core -->|"transfers commands"| node_spi
node_driver_core -.->|"controls motor"| node_motor_board
node_driver_core -->|"uses device definitions"| node_driver_defs
node_driver_core -->|"loads defaults"| node_target_config
node_driver_defs -->|"references configuration"| node_target_config
node_driver_defs -->|"references motor types"| node_motor_defs
node_motor_defs -->|"references component types"| node_component_defs

click node_motor_api "https://github.com/stm32duino/x-nucleo-ihm01a1/blob/main/src/StepperMotor.h"
click node_l6474_class "https://github.com/stm32duino/x-nucleo-ihm01a1/blob/main/src/L6474.h"
click node_driver_core "https://github.com/stm32duino/x-nucleo-ihm01a1/blob/main/src/L6474.cpp"
click node_driver_defs "https://github.com/stm32duino/x-nucleo-ihm01a1/blob/main/src/L6474_def.h"
click node_target_config "https://github.com/stm32duino/x-nucleo-ihm01a1/blob/main/src/L6474_config.h"
click node_motor_defs "https://github.com/stm32duino/x-nucleo-ihm01a1/blob/main/src/motor_def.h"
click node_component_defs "https://github.com/stm32duino/x-nucleo-ihm01a1/blob/main/src/component_def.h"
click node_component_class "https://github.com/stm32duino/x-nucleo-ihm01a1/blob/main/src/Component.h"

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_motor_api,node_l6474_class,node_component_class toneBlue
class node_driver_core toneAmber
class node_driver_defs,node_target_config,node_motor_defs,node_component_defs toneMint
class node_application,node_spi,node_motor_board toneIndigo
```

## Components

### Motor API

- [Stepper interface](https://github.com/stm32duino/x-nucleo-ihm01a1/blob/main/src/StepperMotor.h): `src/StepperMotor.h`
- [L6474 component](https://github.com/stm32duino/x-nucleo-ihm01a1/blob/main/src/L6474.h): `src/L6474.h`
- [Generic component interface](https://github.com/stm32duino/x-nucleo-ihm01a1/blob/main/src/Component.h): `src/Component.h`

### L6474 Driver

- [Command and motion driver](https://github.com/stm32duino/x-nucleo-ihm01a1/blob/main/src/L6474.cpp): `src/L6474.cpp`

### Configuration and Types

- [Register and device types](https://github.com/stm32duino/x-nucleo-ihm01a1/blob/main/src/L6474_def.h): `src/L6474_def.h`
- [Device defaults](https://github.com/stm32duino/x-nucleo-ihm01a1/blob/main/src/L6474_config.h): `src/L6474_config.h`
- [Motor types and vtable](https://github.com/stm32duino/x-nucleo-ihm01a1/blob/main/src/motor_def.h): `src/motor_def.h`
- [Component types](https://github.com/stm32duino/x-nucleo-ihm01a1/blob/main/src/component_def.h): `src/component_def.h`

### Other components

- **Arduino application**
- **SPI instance**
- **Stepper motor board**

## Connections

- Arduino application → Stepper interface: issues motion commands (evidence: `README.md`)
- L6474 component → Stepper interface: implements (evidence: `src/L6474.h`)
- L6474 component → Command and motion driver: calls driver functions (evidence: `src/L6474.h`)
- Command and motion driver → SPI instance: transfers commands
- Command and motion driver → Stepper motor board: controls motor (evidence: `README.md`)
- Command and motion driver → Register and device types: uses device definitions (evidence: `src/L6474.cpp`)
- Command and motion driver → Device defaults: loads defaults (evidence: `src/L6474.cpp`)
- Register and device types → Device defaults: references configuration (evidence: `src/L6474_def.h`)
- Register and device types → Motor types and vtable: references motor types (evidence: `src/L6474_def.h`)
- Motor types and vtable → Component types: references component types (evidence: `src/motor_def.h`)
