# sefu202/io_board architecture

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

- Interactive diagram: https://gitdiagram.com/sefu202/io_board
- Repository: https://github.com/sefu202/io_board

## Overview

IO_Board is AVR firmware for an industrial-style I/O board. Its visible runtime starts by initializing board I/O, timing, communications, and sensors, then repeatedly updates RS-485 communications. The component names indicate distinct analog/digital I/O, PWM/stepper, environmental, light, and wind functions. Sampled source confirms the main loop, wind measurement’s DI/tick reads, and BH1750’s I²C transactions; wiring among unsampled modules is intentionally left out. The tree and excerpts provide no README-level product description.

Main entry points: [`IO_Board/main.c`](https://github.com/sefu202/io_board/blob/master/IO_Board/main.c) (Firmware entry), [`IO_Board/Windsensor/Windsensor.c`](https://github.com/sefu202/io_board/blob/master/IO_Board/Windsensor/Windsensor.c) (Wind measurement), [`IO_Board/AI.c`](https://github.com/sefu202/io_board/blob/master/IO_Board/AI.c) (Analog inputs), [`IO_Board/LightSensor/bh1750.c`](https://github.com/sefu202/io_board/blob/master/IO_Board/LightSensor/bh1750.c) (Light sensor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and communications"]
  node_main["Firmware entry<br/>[main.c]"]
  node_rs485["RS-485 update<br/>[RS485.c]"]
  node_usart["USART transport<br/>[usart.c]"]
  node_crc["CRC-16<br/>[CRC16.c]"]
  node_fifo["FIFO buffer<br/>[fifo.c]"]
  node_process["Process image<br/>[ProcessImage.c]"]
  node_systick["System tick<br/>[SysTick.c]"]
end

subgraph group_io["Board I/O"]
  node_ai["Analog inputs<br/>[AI.c]"]
  node_adc["ADC<br/>[adc.c]"]
  node_di["Digital inputs<br/>[DI.c]"]
  node_do["Digital outputs<br/>[DO.c]"]
  node_pwm["PWM outputs<br/>[PWM.c]"]
  node_step["Stepper control<br/>[Step1.c]"]
end

subgraph group_sensors["Sensors"]
  node_wind["Wind measurement<br/>[Windsensor.c]"]
  node_env["Environmental sensor<br/>[EnvSensor.c]"]
  node_bme["BME280 driver<br/>[bme280.c]"]
  node_light["Light sensor<br/>[bh1750.c]"]
end

subgraph group_bus["Device buses"]
  node_i2c["I²C master<br/>[Fleury_twimaster.c]"]
end

node_host(("RS-485 host"))

node_main -->|"updates repeatedly"| node_rs485
node_main -->|"initializes"| node_systick
node_main -->|"initializes"| node_do
node_main -->|"initializes"| node_di
node_main -->|"initializes"| node_ai
node_main -->|"initializes"| node_step
node_main -->|"initializes"| node_pwm
node_main -->|"initializes"| node_wind
node_main -->|"initializes"| node_i2c
node_main -->|"initializes"| node_env
node_main -->|"initializes"| node_light
node_host -->|"communicates over"| node_rs485
node_wind -->|"reads input"| node_di
node_wind -->|"reads ticks"| node_systick
node_light -->|"reads sensor"| node_i2c
node_ai -->|"uses conversion"| node_adc

click node_main "https://github.com/sefu202/io_board/blob/master/IO_Board/main.c"
click node_rs485 "https://github.com/sefu202/io_board/blob/master/IO_Board/Comm/RS485.c"
click node_usart "https://github.com/sefu202/io_board/blob/master/IO_Board/Comm/usart.c"
click node_crc "https://github.com/sefu202/io_board/blob/master/IO_Board/Comm/CRC16.c"
click node_fifo "https://github.com/sefu202/io_board/blob/master/IO_Board/Comm/fifo.c"
click node_process "https://github.com/sefu202/io_board/blob/master/IO_Board/ProcessImage.c"
click node_systick "https://github.com/sefu202/io_board/blob/master/IO_Board/SysTick.c"
click node_ai "https://github.com/sefu202/io_board/blob/master/IO_Board/AI.c"
click node_adc "https://github.com/sefu202/io_board/blob/master/IO_Board/adc.c"
click node_di "https://github.com/sefu202/io_board/blob/master/IO_Board/DI.c"
click node_do "https://github.com/sefu202/io_board/blob/master/IO_Board/DO.c"
click node_pwm "https://github.com/sefu202/io_board/blob/master/IO_Board/PWM.c"
click node_step "https://github.com/sefu202/io_board/blob/master/IO_Board/Step1.c"
click node_wind "https://github.com/sefu202/io_board/blob/master/IO_Board/Windsensor/Windsensor.c"
click node_env "https://github.com/sefu202/io_board/blob/master/IO_Board/EnvSensor/EnvSensor.c"
click node_bme "https://github.com/sefu202/io_board/blob/master/IO_Board/EnvSensor/bme280.c"
click node_light "https://github.com/sefu202/io_board/blob/master/IO_Board/LightSensor/bh1750.c"
click node_i2c "https://github.com/sefu202/io_board/blob/master/IO_Board/Fleury_twimaster.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_rs485,node_usart,node_crc,node_fifo,node_process,node_systick toneBlue
class node_ai,node_adc,node_di,node_do,node_pwm,node_step toneAmber
class node_wind,node_env,node_bme,node_light toneMint
class node_i2c toneRose
class node_host toneIndigo
```

## Components

### Runtime and communications

- [Firmware entry](https://github.com/sefu202/io_board/blob/master/IO_Board/main.c): `IO_Board/main.c`
- [RS-485 update](https://github.com/sefu202/io_board/blob/master/IO_Board/Comm/RS485.c): `IO_Board/Comm/RS485.c`
- [USART transport](https://github.com/sefu202/io_board/blob/master/IO_Board/Comm/usart.c): `IO_Board/Comm/usart.c`
- [CRC-16](https://github.com/sefu202/io_board/blob/master/IO_Board/Comm/CRC16.c): `IO_Board/Comm/CRC16.c`
- [FIFO buffer](https://github.com/sefu202/io_board/blob/master/IO_Board/Comm/fifo.c): `IO_Board/Comm/fifo.c`
- [Process image](https://github.com/sefu202/io_board/blob/master/IO_Board/ProcessImage.c): `IO_Board/ProcessImage.c`
- [System tick](https://github.com/sefu202/io_board/blob/master/IO_Board/SysTick.c): `IO_Board/SysTick.c`

### Board I/O

- [Analog inputs](https://github.com/sefu202/io_board/blob/master/IO_Board/AI.c): `IO_Board/AI.c`
- [ADC](https://github.com/sefu202/io_board/blob/master/IO_Board/adc.c): `IO_Board/adc.c`
- [Digital inputs](https://github.com/sefu202/io_board/blob/master/IO_Board/DI.c): `IO_Board/DI.c`
- [Digital outputs](https://github.com/sefu202/io_board/blob/master/IO_Board/DO.c): `IO_Board/DO.c`
- [PWM outputs](https://github.com/sefu202/io_board/blob/master/IO_Board/PWM.c): `IO_Board/PWM.c`
- [Stepper control](https://github.com/sefu202/io_board/blob/master/IO_Board/Step1.c): `IO_Board/Step1.c`

### Sensors

- [Wind measurement](https://github.com/sefu202/io_board/blob/master/IO_Board/Windsensor/Windsensor.c): `IO_Board/Windsensor/Windsensor.c`
- [Environmental sensor](https://github.com/sefu202/io_board/blob/master/IO_Board/EnvSensor/EnvSensor.c): `IO_Board/EnvSensor/EnvSensor.c`
- [BME280 driver](https://github.com/sefu202/io_board/blob/master/IO_Board/EnvSensor/bme280.c): `IO_Board/EnvSensor/bme280.c`
- [Light sensor](https://github.com/sefu202/io_board/blob/master/IO_Board/LightSensor/bh1750.c): `IO_Board/LightSensor/bh1750.c`

### Device buses

- [I²C master](https://github.com/sefu202/io_board/blob/master/IO_Board/Fleury_twimaster.c): `IO_Board/Fleury_twimaster.c`

### Other components

- **RS-485 host**

## Connections

- Firmware entry → RS-485 update: updates repeatedly
- Firmware entry → System tick: initializes
- Firmware entry → Digital outputs: initializes
- Firmware entry → Digital inputs: initializes
- Firmware entry → Analog inputs: initializes
- Firmware entry → Stepper control: initializes
- Firmware entry → PWM outputs: initializes
- Firmware entry → Wind measurement: initializes
- Firmware entry → I²C master: initializes
- Firmware entry → Environmental sensor: initializes
- Firmware entry → Light sensor: initializes
- RS-485 host → RS-485 update: communicates over
- Wind measurement → Digital inputs: reads input
- Wind measurement → System tick: reads ticks
- Light sensor → I²C master: reads sensor
- Analog inputs → ADC: uses conversion
