# taifur20/line_follower_v1 architecture

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

- Interactive diagram: https://gitdiagram.com/taifur20/line_follower_v1
- Repository: https://github.com/taifur20/line_follower_v1

## Overview

This is STM32F103 firmware for a sensor-guided line-following robot. Its main application combines line-position/PID motor control with button-operated stop and calibration modes; calibration also visualizes sensor values on an SSD1306 display. The display driver and font data are distinct internal layers, backed by STM32 HAL and CMSIS vendor code. The excerpts show motor GPIO writes and display calls, but omit much of initialization and sensor acquisition; uncertain hardware links are therefore dashed and uncited.

Main entry points: [`Core/Src/main.c`](https://github.com/taifur20/line_follower_v1/blob/main/Core/Src/main.c) (Robot control), [`Core/Src/ssd1306.c`](https://github.com/taifur20/line_follower_v1/blob/main/Core/Src/ssd1306.c) (Display driver), [`Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c`](https://github.com/taifur20/line_follower_v1/blob/main/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c) (STM32 HAL), [`Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h`](https://github.com/taifur20/line_follower_v1/blob/main/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h) (STM32F103 registers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_application["Robot firmware"]
  node_firmware["Robot control<br/>[main.c]"]
end

subgraph group_display["Display"]
  node_displaydriver["Display driver<br/>[ssd1306.c]"]
  node_fontdata["Font data<br/>[fonts.c]"]
end

subgraph group_platform["MCU platform"]
  node_hal["STM32 HAL<br/>[stm32f1xx_hal.c]"]
  node_i2chal["I2C HAL"]
  node_device["STM32F103 registers<br/>[stm32f103xb.h]"]
  node_cmsiscore["CMSIS core<br/>[core_cm3.h]"]
end

node_operator(("Operator"))
node_sensors{{"Line sensors"}}
node_motors{{"Drive motors"}}
node_oled{{"SSD1306 display"}}

node_operator -.->|"operates"| node_firmware
node_sensors -.->|"provides readings"| node_firmware
node_firmware -->|"sets GPIO"| node_motors
node_firmware -->|"draws and updates"| node_displaydriver
node_displaydriver -.->|"updates screen"| node_oled
node_displaydriver -->|"uses fonts"| node_fontdata
node_firmware -->|"initializes HAL"| node_hal
node_firmware -.->|"uses I2C"| node_i2chal
node_hal -.->|"accesses registers"| node_device
node_device -.->|"uses core definitions"| node_cmsiscore

click node_firmware "https://github.com/taifur20/line_follower_v1/blob/main/Core/Src/main.c"
click node_displaydriver "https://github.com/taifur20/line_follower_v1/blob/main/Core/Src/ssd1306.c"
click node_fontdata "https://github.com/taifur20/line_follower_v1/blob/main/Core/Src/fonts.c"
click node_hal "https://github.com/taifur20/line_follower_v1/blob/main/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c"
click node_i2chal "https://github.com/taifur20/line_follower_v1/blob/main/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c"
click node_device "https://github.com/taifur20/line_follower_v1/blob/main/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h"
click node_cmsiscore "https://github.com/taifur20/line_follower_v1/blob/main/Drivers/CMSIS/Include/core_cm3.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_firmware toneBlue
class node_displaydriver,node_fontdata toneAmber
class node_hal,node_i2chal,node_device,node_cmsiscore toneMint
class node_operator,node_sensors,node_motors,node_oled toneIndigo
```

## Components

### Robot firmware

- [Robot control](https://github.com/taifur20/line_follower_v1/blob/main/Core/Src/main.c): `Core/Src/main.c`

### Display

- [Display driver](https://github.com/taifur20/line_follower_v1/blob/main/Core/Src/ssd1306.c): `Core/Src/ssd1306.c`
- [Font data](https://github.com/taifur20/line_follower_v1/blob/main/Core/Src/fonts.c): `Core/Src/fonts.c`

### MCU platform

- [STM32 HAL](https://github.com/taifur20/line_follower_v1/blob/main/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c): `Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c`
- [I2C HAL](https://github.com/taifur20/line_follower_v1/blob/main/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c): `Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c`
- [STM32F103 registers](https://github.com/taifur20/line_follower_v1/blob/main/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h): `Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h`
- [CMSIS core](https://github.com/taifur20/line_follower_v1/blob/main/Drivers/CMSIS/Include/core_cm3.h): `Drivers/CMSIS/Include/core_cm3.h`

### Other components

- **Operator**
- **Line sensors**
- **Drive motors**
- **SSD1306 display**

## Connections

- Operator → Robot control: operates
- Line sensors → Robot control: provides readings
- Robot control → Drive motors: sets GPIO (evidence: `Core/Src/main.c`)
- Robot control → Display driver: draws and updates (evidence: `Core/Src/main.c`)
- Display driver → SSD1306 display: updates screen
- Display driver → Font data: uses fonts
- Robot control → STM32 HAL: initializes HAL (evidence: `Core/Src/main.c`)
- Robot control → I2C HAL: uses I2C
- STM32 HAL → STM32F103 registers: accesses registers
- STM32F103 registers → CMSIS core: uses core definitions
