# bardia-afshar/max31855-max6675-stm32 architecture

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

- Interactive diagram: https://gitdiagram.com/bardia-afshar/max31855-max6675-stm32
- Repository: https://github.com/bardia-afshar/max31855-max6675-stm32

## Overview

This repository provides STM32 HAL drivers and MicroPython ports for MAX31855 and MAX6675 thermocouple converters, plus polling and DMA example projects. In the primary workflow, an application configures a driver with SPI and chip select, starts a read, and retrieves decoded temperature and fault status; DMA reads complete asynchronously. The MicroPython classes provide a separate synchronous read-and-decode path. Relationships between the STM32 drivers and example applications are documented, but example source was not sampled, so their internal calls are not asserted.

Main entry points: [`library/max31855/max31855.c`](https://github.com/bardia-afshar/max31855-max6675-stm32/blob/master/library/max31855/max31855.c) (MAX31855 driver), [`library/max6675/max6675.c`](https://github.com/bardia-afshar/max31855-max6675-stm32/blob/master/library/max6675/max6675.c) (MAX6675 driver), [`library/micropython/max31855.py`](https://github.com/bardia-afshar/max31855-max6675-stm32/blob/master/library/micropython/max31855.py) (MAX31855 Python class), [`library/micropython/max6675.py`](https://github.com/bardia-afshar/max31855-max6675-stm32/blob/master/library/micropython/max6675.py) (MAX6675 Python class)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_stm32["STM32 HAL Drivers"]
  node_drv31855["MAX31855 driver<br/>[max31855.c]"]
  node_drv6675["MAX6675 driver<br/>[max6675.c]"]
end

subgraph group_python["MicroPython Ports"]
  node_py31855["MAX31855 Python class<br/>[max31855.py]"]
  node_py6675["MAX6675 Python class<br/>[max6675.py]"]
end

subgraph group_examples["STM32 Examples"]
  node_ex31855p["MAX31855 polling example"]
  node_ex31855d["MAX31855 DMA example"]
  node_ex6675p["MAX6675 polling example"]
  node_ex6675d["MAX6675 DMA example"]
end

node_app(("STM32 application"))
node_halspi["STM32 HAL SPI/GPIO"]
node_chip31855["MAX31855 converter"]
node_chip6675["MAX6675 converter"]
node_result["Temperature and status"]
node_runtime["MicroPython runtime"]
node_board(("MicroPython board"))

node_app -.->|"configures and reads"| node_drv31855
node_app -.->|"configures and reads"| node_drv6675
node_drv31855 -->|"transfers via"| node_halspi
node_drv6675 -->|"transfers via"| node_halspi
node_chip31855 -.->|"sends SPI frame"| node_drv31855
node_chip6675 -.->|"sends SPI frame"| node_drv6675
node_drv31855 -->|"decodes temperatures and faults"| node_result
node_drv6675 -->|"decodes temperature and fault"| node_result
node_board -.->|"runs"| node_py31855
node_board -.->|"runs"| node_py6675
node_py31855 -->|"uses Pin and SPI"| node_runtime
node_py6675 -->|"uses Pin and SPI"| node_runtime
node_py31855 -->|"returns fault and Celsius"| node_result
node_py6675 -->|"returns fault and Celsius"| node_result
node_ex31855p -.->|"uses polling driver"| node_drv31855
node_ex31855d -.->|"uses DMA driver"| node_drv31855
node_ex6675p -.->|"uses polling driver"| node_drv6675
node_ex6675d -.->|"uses DMA driver"| node_drv6675

click node_drv31855 "https://github.com/bardia-afshar/max31855-max6675-stm32/blob/master/library/max31855/max31855.c"
click node_drv6675 "https://github.com/bardia-afshar/max31855-max6675-stm32/blob/master/library/max6675/max6675.c"
click node_py31855 "https://github.com/bardia-afshar/max31855-max6675-stm32/blob/master/library/micropython/max31855.py"
click node_py6675 "https://github.com/bardia-afshar/max31855-max6675-stm32/blob/master/library/micropython/max6675.py"
click node_ex31855p "https://github.com/bardia-afshar/max31855-max6675-stm32/tree/master/examples/max31855_polling"
click node_ex31855d "https://github.com/bardia-afshar/max31855-max6675-stm32/tree/master/examples/max31855_dma"
click node_ex6675p "https://github.com/bardia-afshar/max31855-max6675-stm32/tree/master/examples/max6675_polling"
click node_ex6675d "https://github.com/bardia-afshar/max31855-max6675-stm32/tree/master/examples/max6675_dma"

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_drv31855,node_drv6675 toneBlue
class node_py31855,node_py6675 toneAmber
class node_ex31855p,node_ex31855d,node_ex6675p,node_ex6675d toneMint
class node_app,node_halspi,node_chip31855,node_chip6675,node_result,node_runtime,node_board toneIndigo
```

## Components

### STM32 HAL Drivers

- [MAX31855 driver](https://github.com/bardia-afshar/max31855-max6675-stm32/blob/master/library/max31855/max31855.c): `library/max31855/max31855.c`
- [MAX6675 driver](https://github.com/bardia-afshar/max31855-max6675-stm32/blob/master/library/max6675/max6675.c): `library/max6675/max6675.c`

### MicroPython Ports

- [MAX31855 Python class](https://github.com/bardia-afshar/max31855-max6675-stm32/blob/master/library/micropython/max31855.py): `library/micropython/max31855.py`
- [MAX6675 Python class](https://github.com/bardia-afshar/max31855-max6675-stm32/blob/master/library/micropython/max6675.py): `library/micropython/max6675.py`

### STM32 Examples

- [MAX31855 polling example](https://github.com/bardia-afshar/max31855-max6675-stm32/tree/master/examples/max31855_polling): `examples/max31855_polling`
- [MAX31855 DMA example](https://github.com/bardia-afshar/max31855-max6675-stm32/tree/master/examples/max31855_dma): `examples/max31855_dma`
- [MAX6675 polling example](https://github.com/bardia-afshar/max31855-max6675-stm32/tree/master/examples/max6675_polling): `examples/max6675_polling`
- [MAX6675 DMA example](https://github.com/bardia-afshar/max31855-max6675-stm32/tree/master/examples/max6675_dma): `examples/max6675_dma`

### Other components

- **STM32 application**
- **STM32 HAL SPI/GPIO**
- **MAX31855 converter**
- **MAX6675 converter**
- **Temperature and status**
- **MicroPython runtime**
- **MicroPython board**

## Connections

- STM32 application → MAX31855 driver: configures and reads (evidence: `README.md`)
- STM32 application → MAX6675 driver: configures and reads (evidence: `README.md`)
- MAX31855 driver → STM32 HAL SPI/GPIO: transfers via (evidence: `library/max31855/max31855.c`)
- MAX6675 driver → STM32 HAL SPI/GPIO: transfers via (evidence: `library/max6675/max6675.c`)
- MAX31855 converter → MAX31855 driver: sends SPI frame (evidence: `README.md`)
- MAX6675 converter → MAX6675 driver: sends SPI frame (evidence: `README.md`)
- MAX31855 driver → Temperature and status: decodes temperatures and faults (evidence: `library/max31855/max31855.c`)
- MAX6675 driver → Temperature and status: decodes temperature and fault (evidence: `library/max6675/max6675.c`)
- MicroPython board → MAX31855 Python class: runs (evidence: `library/micropython/max31855.py`)
- MicroPython board → MAX6675 Python class: runs (evidence: `library/micropython/max6675.py`)
- MAX31855 Python class → MicroPython runtime: uses Pin and SPI (evidence: `library/micropython/max31855.py`)
- MAX6675 Python class → MicroPython runtime: uses Pin and SPI (evidence: `library/micropython/max6675.py`)
- MAX31855 Python class → Temperature and status: returns fault and Celsius (evidence: `library/micropython/max31855.py`)
- MAX6675 Python class → Temperature and status: returns fault and Celsius (evidence: `library/micropython/max6675.py`)
- MAX31855 polling example → MAX31855 driver: uses polling driver (evidence: `README.md`)
- MAX31855 DMA example → MAX31855 driver: uses DMA driver (evidence: `README.md`)
- MAX6675 polling example → MAX6675 driver: uses polling driver (evidence: `README.md`)
- MAX6675 DMA example → MAX6675 driver: uses DMA driver (evidence: `README.md`)
