# yangyuanxin/bearpi_thermal_imaging architecture

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

- Interactive diagram: https://gitdiagram.com/yangyuanxin/bearpi_thermal_imaging
- Repository: https://github.com/yangyuanxin/bearpi_thermal_imaging
- Video tour (about a minute): https://gitdiagram.com/yangyuanxin/bearpi_thermal_imaging/video

## Overview

This firmware is an embedded infrared thermal-imaging application for a BearPi board and AMG8831 module. Its main workflow initializes the LCD and thermal sensor, starts an RTOS task, repeatedly obtains a thermal matrix, and displays it; the README also identifies a live color legend and minimum/maximum temperatures as display capabilities. The tree documents separate BSP, device, driver, and MCU-platform layers. App and MCU startup behavior are sampled; sensor, rendering, and lower-layer call details are inferred only from module names and the documented architecture, so uncertain links are omitted.

Main entry points: [`Firmware/APP/App.c`](https://github.com/yangyuanxin/bearpi_thermal_imaging/blob/main/Firmware/APP/App.c) (App task), [`Firmware/Bsp/AMG883x.c`](https://github.com/yangyuanxin/bearpi_thermal_imaging/blob/main/Firmware/Bsp/AMG883x.c) (AMG883x BSP), [`Firmware/Bsp/Lcd.c`](https://github.com/yangyuanxin/bearpi_thermal_imaging/blob/main/Firmware/Bsp/Lcd.c) (LCD BSP), [`Firmware/McuPlatform/Core/Src/main.c`](https://github.com/yangyuanxin/bearpi_thermal_imaging/blob/main/Firmware/McuPlatform/Core/Src/main.c) (MCU startup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_app_logic["App task<br/>[App.c]"]
  node_rtos["TencentOS-tiny"]
end

subgraph group_thermal["Thermal imaging"]
  node_thermal_sensor["AMG883x BSP<br/>[AMG883x.c]"]
  node_lcd_bsp["LCD BSP<br/>[Lcd.c]"]
  node_thermal_view["Thermal matrix<br/>[AMG883x.c]"]
  node_color_legend["Color legend<br/>[AMG883x.c]"]
  node_temperature_range["Min/max temperatures<br/>[AMG883x.c]"]
end

subgraph group_hardware["Hardware access"]
  node_thermal_device["AMG883x device"]
  node_i2c_driver["I2C driver<br/>[i2c_driver.c]"]
end

subgraph group_platform["MCU platform"]
  node_main["MCU startup<br/>[main.c]"]
  node_i2c_platform["I2C peripheral<br/>[i2c.c]"]
  node_spi_platform["SPI peripheral<br/>[spi.c]"]
  node_gpio_platform["GPIO peripheral<br/>[gpio.c]"]
end

node_amg8831(("AMG8831 module"))
node_lcd_panel(("LCD display"))

node_main -->|"calls RunApp"| node_app_logic
node_app_logic -->|"initializes LCD"| node_lcd_bsp
node_app_logic -->|"initializes sensor"| node_thermal_sensor
node_app_logic -->|"starts task"| node_rtos
node_rtos -->|"dispatches task"| node_app_logic
node_app_logic -->|"requests display"| node_thermal_sensor
node_amg8831 -->|"thermal readings"| node_thermal_device
node_lcd_bsp -->|"renders display"| node_lcd_panel
node_thermal_sensor -->|"produces matrix view"| node_thermal_view
node_thermal_sensor -->|"shows color scale"| node_color_legend
node_thermal_sensor -->|"shows extrema"| node_temperature_range

click node_main "https://github.com/yangyuanxin/bearpi_thermal_imaging/blob/main/Firmware/McuPlatform/Core/Src/main.c"
click node_app_logic "https://github.com/yangyuanxin/bearpi_thermal_imaging/blob/main/Firmware/APP/App.c"
click node_thermal_sensor "https://github.com/yangyuanxin/bearpi_thermal_imaging/blob/main/Firmware/Bsp/AMG883x.c"
click node_thermal_device "https://github.com/yangyuanxin/bearpi_thermal_imaging/blob/main/Firmware/Device/i2c_device_amg8833.c"
click node_i2c_driver "https://github.com/yangyuanxin/bearpi_thermal_imaging/blob/main/Firmware/Driver/i2c_driver.c"
click node_i2c_platform "https://github.com/yangyuanxin/bearpi_thermal_imaging/blob/main/Firmware/McuPlatform/Core/Src/i2c.c"
click node_lcd_bsp "https://github.com/yangyuanxin/bearpi_thermal_imaging/blob/main/Firmware/Bsp/Lcd.c"
click node_thermal_view "https://github.com/yangyuanxin/bearpi_thermal_imaging/blob/main/Firmware/Bsp/AMG883x.c"
click node_color_legend "https://github.com/yangyuanxin/bearpi_thermal_imaging/blob/main/Firmware/Bsp/AMG883x.c"
click node_temperature_range "https://github.com/yangyuanxin/bearpi_thermal_imaging/blob/main/Firmware/Bsp/AMG883x.c"
click node_spi_platform "https://github.com/yangyuanxin/bearpi_thermal_imaging/blob/main/Firmware/McuPlatform/Core/Src/spi.c"
click node_gpio_platform "https://github.com/yangyuanxin/bearpi_thermal_imaging/blob/main/Firmware/McuPlatform/Core/Src/gpio.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_app_logic,node_rtos toneBlue
class node_thermal_sensor,node_lcd_bsp,node_thermal_view,node_color_legend,node_temperature_range toneAmber
class node_thermal_device,node_i2c_driver toneMint
class node_main,node_i2c_platform,node_spi_platform,node_gpio_platform toneRose
class node_amg8831,node_lcd_panel toneIndigo
```

## Components

### Application

- [App task](https://github.com/yangyuanxin/bearpi_thermal_imaging/blob/main/Firmware/APP/App.c): `Firmware/APP/App.c`
- **TencentOS-tiny**

### Thermal imaging

- [AMG883x BSP](https://github.com/yangyuanxin/bearpi_thermal_imaging/blob/main/Firmware/Bsp/AMG883x.c): `Firmware/Bsp/AMG883x.c`
- [LCD BSP](https://github.com/yangyuanxin/bearpi_thermal_imaging/blob/main/Firmware/Bsp/Lcd.c): `Firmware/Bsp/Lcd.c`
- [Thermal matrix](https://github.com/yangyuanxin/bearpi_thermal_imaging/blob/main/Firmware/Bsp/AMG883x.c): `Firmware/Bsp/AMG883x.c`
- [Color legend](https://github.com/yangyuanxin/bearpi_thermal_imaging/blob/main/Firmware/Bsp/AMG883x.c): `Firmware/Bsp/AMG883x.c`
- [Min/max temperatures](https://github.com/yangyuanxin/bearpi_thermal_imaging/blob/main/Firmware/Bsp/AMG883x.c): `Firmware/Bsp/AMG883x.c`

### Hardware access

- [AMG883x device](https://github.com/yangyuanxin/bearpi_thermal_imaging/blob/main/Firmware/Device/i2c_device_amg8833.c): `Firmware/Device/i2c_device_amg8833.c`
- [I2C driver](https://github.com/yangyuanxin/bearpi_thermal_imaging/blob/main/Firmware/Driver/i2c_driver.c): `Firmware/Driver/i2c_driver.c`

### MCU platform

- [MCU startup](https://github.com/yangyuanxin/bearpi_thermal_imaging/blob/main/Firmware/McuPlatform/Core/Src/main.c): `Firmware/McuPlatform/Core/Src/main.c`
- [I2C peripheral](https://github.com/yangyuanxin/bearpi_thermal_imaging/blob/main/Firmware/McuPlatform/Core/Src/i2c.c): `Firmware/McuPlatform/Core/Src/i2c.c`
- [SPI peripheral](https://github.com/yangyuanxin/bearpi_thermal_imaging/blob/main/Firmware/McuPlatform/Core/Src/spi.c): `Firmware/McuPlatform/Core/Src/spi.c`
- [GPIO peripheral](https://github.com/yangyuanxin/bearpi_thermal_imaging/blob/main/Firmware/McuPlatform/Core/Src/gpio.c): `Firmware/McuPlatform/Core/Src/gpio.c`

### Other components

- **AMG8831 module**
- **LCD display**

## Connections

- MCU startup → App task: calls RunApp
- App task → LCD BSP: initializes LCD
- App task → AMG883x BSP: initializes sensor
- App task → TencentOS-tiny: starts task
- TencentOS-tiny → App task: dispatches task
- App task → AMG883x BSP: requests display
- AMG8831 module → AMG883x device: thermal readings
- LCD BSP → LCD display: renders display
- AMG883x BSP → Thermal matrix: produces matrix view
- AMG883x BSP → Color legend: shows color scale
- AMG883x BSP → Min/max temperatures: shows extrema
