# elektronikaembedded/ir_gesture_apds9960 architecture

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

- Interactive diagram: https://gitdiagram.com/elektronikaembedded/ir_gesture_apds9960
- Repository: https://github.com/elektronikaembedded/ir_gesture_apds9960

## Overview

This is STM32F103 firmware demonstrating APDS-9960 infrared gesture sensing. The principal workflow initializes the board and sensor, enables gesture detection, reads sensor data when the external-interrupt flag is set, and provides LED and serial-debug support. The graph separates application control, sensor communications, board services, and STM32 support. Source excerpts show the main initialization and read path; some peripheral and interrupt relationships are supported only by the SOURCE INDEX, so uncertain runtime links are omitted.

Main entry points: [`source/application/main.c`](https://github.com/elektronikaembedded/ir_gesture_apds9960/blob/master/source/application/main.c) (Firmware loop), [`source/application/apds9960.c`](https://github.com/elektronikaembedded/ir_gesture_apds9960/blob/master/source/application/apds9960.c) (APDS9960 driver), [`source/application/utils/debug.c`](https://github.com/elektronikaembedded/ir_gesture_apds9960/blob/master/source/application/utils/debug.c) (Serial debug), [`source/application/utils/delay.c`](https://github.com/elektronikaembedded/ir_gesture_apds9960/blob/master/source/application/utils/delay.c) (Timing utilities)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_main["Firmware loop<br/>[main.c]"]
  node_interrupts["Interrupt handling<br/>[stm32f10x_it.c]"]
end

subgraph group_sensor["Gesture sensing"]
  node_apds["APDS9960 driver<br/>[apds9960.c]"]
  node_sensor_hw["Gesture sensor"]
end

subgraph group_board["Board services"]
  node_i2c_hal["I2C interface<br/>[i2c_hal.c]"]
  node_led["LED control<br/>[led.c]"]
  node_debug["Serial debug<br/>[debug.c]"]
  node_delay["Timing utilities<br/>[delay.c]"]
end

subgraph group_platform["STM32 support"]
  node_gpio["GPIO driver<br/>[stm32f10x_gpio.c]"]
  node_i2c_driver["I2C peripheral<br/>[stm32f10x_i2c.c]"]
  node_usart["USART driver<br/>[stm32f10x_usart.c]"]
  node_timer["Timer driver<br/>[stm32f10x_tim.c]"]
  node_system["System clock<br/>[system_stm32f10x.c]"]
end

node_user(("Operator"))

node_main -->|"initializes"| node_delay
node_main -->|"initializes"| node_led
node_main -->|"initializes"| node_debug
node_main -->|"initializes"| node_apds
node_main -->|"enables gestures"| node_apds
node_main -->|"configures EXTI"| node_interrupts
node_main -->|"reads gesture"| node_apds
node_apds -->|"reads and writes"| node_i2c_hal
node_i2c_hal -->|"uses peripheral"| node_i2c_driver
node_apds -->|"logs status"| node_debug
node_apds -.->|"uses timing"| node_delay
node_led -->|"controls pins"| node_gpio
node_debug -->|"transmits serial"| node_usart
node_delay -->|"uses timer"| node_timer
node_user -.->|"makes gesture"| node_sensor_hw
node_sensor_hw -.->|"provides readings"| node_apds

click node_main "https://github.com/elektronikaembedded/ir_gesture_apds9960/blob/master/source/application/main.c"
click node_interrupts "https://github.com/elektronikaembedded/ir_gesture_apds9960/blob/master/source/application/stm32f10x_it.c"
click node_apds "https://github.com/elektronikaembedded/ir_gesture_apds9960/blob/master/source/application/apds9960.c"
click node_i2c_hal "https://github.com/elektronikaembedded/ir_gesture_apds9960/blob/master/source/application/hal/i2c_hal.c"
click node_led "https://github.com/elektronikaembedded/ir_gesture_apds9960/blob/master/source/application/hardware/led.c"
click node_debug "https://github.com/elektronikaembedded/ir_gesture_apds9960/blob/master/source/application/utils/debug.c"
click node_delay "https://github.com/elektronikaembedded/ir_gesture_apds9960/blob/master/source/application/utils/delay.c"
click node_gpio "https://github.com/elektronikaembedded/ir_gesture_apds9960/blob/master/source/library/STM32F10x_StdPeriph_Driver/src/stm32f10x_gpio.c"
click node_i2c_driver "https://github.com/elektronikaembedded/ir_gesture_apds9960/blob/master/source/library/STM32F10x_StdPeriph_Driver/src/stm32f10x_i2c.c"
click node_usart "https://github.com/elektronikaembedded/ir_gesture_apds9960/blob/master/source/library/STM32F10x_StdPeriph_Driver/src/stm32f10x_usart.c"
click node_timer "https://github.com/elektronikaembedded/ir_gesture_apds9960/blob/master/source/library/STM32F10x_StdPeriph_Driver/src/stm32f10x_tim.c"
click node_system "https://github.com/elektronikaembedded/ir_gesture_apds9960/blob/master/source/CMSIS_BOOT/system_stm32f10x.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_main,node_interrupts toneBlue
class node_apds,node_sensor_hw toneAmber
class node_i2c_hal,node_led,node_debug,node_delay toneMint
class node_gpio,node_i2c_driver,node_usart,node_timer,node_system toneRose
class node_user toneIndigo
```

## Components

### Application

- [Firmware loop](https://github.com/elektronikaembedded/ir_gesture_apds9960/blob/master/source/application/main.c): `source/application/main.c`
- [Interrupt handling](https://github.com/elektronikaembedded/ir_gesture_apds9960/blob/master/source/application/stm32f10x_it.c): `source/application/stm32f10x_it.c`

### Gesture sensing

- [APDS9960 driver](https://github.com/elektronikaembedded/ir_gesture_apds9960/blob/master/source/application/apds9960.c): `source/application/apds9960.c`
- **Gesture sensor**

### Board services

- [I2C interface](https://github.com/elektronikaembedded/ir_gesture_apds9960/blob/master/source/application/hal/i2c_hal.c): `source/application/hal/i2c_hal.c`
- [LED control](https://github.com/elektronikaembedded/ir_gesture_apds9960/blob/master/source/application/hardware/led.c): `source/application/hardware/led.c`
- [Serial debug](https://github.com/elektronikaembedded/ir_gesture_apds9960/blob/master/source/application/utils/debug.c): `source/application/utils/debug.c`
- [Timing utilities](https://github.com/elektronikaembedded/ir_gesture_apds9960/blob/master/source/application/utils/delay.c): `source/application/utils/delay.c`

### STM32 support

- [GPIO driver](https://github.com/elektronikaembedded/ir_gesture_apds9960/blob/master/source/library/STM32F10x_StdPeriph_Driver/src/stm32f10x_gpio.c): `source/library/STM32F10x_StdPeriph_Driver/src/stm32f10x_gpio.c`
- [I2C peripheral](https://github.com/elektronikaembedded/ir_gesture_apds9960/blob/master/source/library/STM32F10x_StdPeriph_Driver/src/stm32f10x_i2c.c): `source/library/STM32F10x_StdPeriph_Driver/src/stm32f10x_i2c.c`
- [USART driver](https://github.com/elektronikaembedded/ir_gesture_apds9960/blob/master/source/library/STM32F10x_StdPeriph_Driver/src/stm32f10x_usart.c): `source/library/STM32F10x_StdPeriph_Driver/src/stm32f10x_usart.c`
- [Timer driver](https://github.com/elektronikaembedded/ir_gesture_apds9960/blob/master/source/library/STM32F10x_StdPeriph_Driver/src/stm32f10x_tim.c): `source/library/STM32F10x_StdPeriph_Driver/src/stm32f10x_tim.c`
- [System clock](https://github.com/elektronikaembedded/ir_gesture_apds9960/blob/master/source/CMSIS_BOOT/system_stm32f10x.c): `source/CMSIS_BOOT/system_stm32f10x.c`

### Other components

- **Operator**

## Connections

- Firmware loop → Timing utilities: initializes (evidence: `source/application/main.c`)
- Firmware loop → LED control: initializes (evidence: `source/application/main.c`)
- Firmware loop → Serial debug: initializes (evidence: `source/application/main.c`)
- Firmware loop → APDS9960 driver: initializes (evidence: `source/application/main.c`)
- Firmware loop → APDS9960 driver: enables gestures (evidence: `source/application/main.c`)
- Firmware loop → Interrupt handling: configures EXTI (evidence: `source/application/main.c`)
- Firmware loop → APDS9960 driver: reads gesture (evidence: `source/application/main.c`)
- APDS9960 driver → I2C interface: reads and writes (evidence: `source/application/apds9960.c`)
- I2C interface → I2C peripheral: uses peripheral (evidence: `source/application/hal/i2c_hal.c`)
- APDS9960 driver → Serial debug: logs status (evidence: `source/application/apds9960.c`)
- APDS9960 driver → Timing utilities: uses timing
- LED control → GPIO driver: controls pins (evidence: `source/application/hardware/led.c`)
- Serial debug → USART driver: transmits serial (evidence: `source/application/utils/debug.c`)
- Timing utilities → Timer driver: uses timer (evidence: `source/application/utils/delay.c`)
- Operator → Gesture sensor: makes gesture
- Gesture sensor → APDS9960 driver: provides readings
