# mahmoudamer0a/iti_avr_project architecture

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

- Interactive diagram: https://gitdiagram.com/mahmoudamer0a/iti_avr_project
- Repository: https://github.com/mahmoudamer0a/iti_avr_project

## Overview

This AVR smart-home project uses two firmware roles: the master authenticates a keypad user, reports status on an LCD, and sequences door outputs; the slave waits for an SPI authorization byte, then monitors temperature and light to control actuators. A gas-sensor task is declared in the slave source but is not created in the shown startup. The tree also includes standalone keypad, LCD, ADC, DIO, and SPI drivers; the README gives no further capability detail, and the gas HAL artifacts are binary/index/library files, so their runtime use is unverified.

Main entry points: [`App/main_Master.c`](https://github.com/mahmoudamer0a/iti_avr_project/blob/main/App/main_Master.c) (Master firmware), [`MCAL/DIO/DIO_program.c`](https://github.com/mahmoudamer0a/iti_avr_project/blob/main/MCAL/DIO/DIO_program.c) (Digital I/O), [`App/main_Slave.c`](https://github.com/mahmoudamer0a/iti_avr_project/blob/main/App/main_Slave.c) (Slave firmware), [`HAL/LCD/LCD.c`](https://github.com/mahmoudamer0a/iti_avr_project/blob/main/HAL/LCD/LCD.c) (LCD driver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and door"]
  node_master["Master firmware<br/>[main_Master.c]"]
  node_auth["Credential check<br/>[main_Master.c]"]
  node_door["Door task<br/>[main_Master.c]"]
end

subgraph group_sensing["Home sensing"]
  node_slave["Slave firmware<br/>[main_Slave.c]"]
  node_temperature["Temperature control<br/>[main_Slave.c]"]
  node_light["Light control<br/>[main_Slave.c]"]
  node_gas["Gas task<br/>[main_Slave.c]"]
end

subgraph group_drivers["Device drivers"]
  node_lcd["LCD driver<br/>[LCD.c]"]
  node_keypad["Keypad driver<br/>[KEY_PAD.c]"]
  node_gas_hal["Gas sensor assets"]
end

subgraph group_mcal["MCAL peripherals"]
  node_spi["SPI driver<br/>[SPI.c]"]
  node_adc["ADC driver<br/>[ADC.c]"]
  node_dio["Digital I/O<br/>[DIO_program.c]"]
end

node_user(("Home user"))

node_user -->|"enters credentials"| node_master
node_master -->|"checks credentials"| node_auth
node_auth -->|"reads keys"| node_keypad
node_auth -->|"shows prompts"| node_lcd
node_master -->|"shows status"| node_lcd
node_master -->|"sends authorization"| node_spi
node_master -->|"creates task"| node_door
node_door -.->|"sets door outputs"| node_dio
node_slave -->|"receives authorization"| node_spi
node_slave -->|"creates task"| node_temperature
node_slave -->|"creates task"| node_light
node_temperature -->|"reads temperature"| node_adc
node_light -->|"reads light level"| node_adc
node_temperature -.->|"controls outputs"| node_dio
node_light -.->|"controls LEDs"| node_dio
node_gas -.->|"controls gas output"| node_dio
node_gas -.->|"sensor integration"| node_gas_hal

click node_master "https://github.com/mahmoudamer0a/iti_avr_project/blob/main/App/main_Master.c"
click node_auth "https://github.com/mahmoudamer0a/iti_avr_project/blob/main/App/main_Master.c"
click node_door "https://github.com/mahmoudamer0a/iti_avr_project/blob/main/App/main_Master.c"
click node_slave "https://github.com/mahmoudamer0a/iti_avr_project/blob/main/App/main_Slave.c"
click node_temperature "https://github.com/mahmoudamer0a/iti_avr_project/blob/main/App/main_Slave.c"
click node_light "https://github.com/mahmoudamer0a/iti_avr_project/blob/main/App/main_Slave.c"
click node_gas "https://github.com/mahmoudamer0a/iti_avr_project/blob/main/App/main_Slave.c"
click node_lcd "https://github.com/mahmoudamer0a/iti_avr_project/blob/main/HAL/LCD/LCD.c"
click node_keypad "https://github.com/mahmoudamer0a/iti_avr_project/blob/main/HAL/KEY_PAD/KEY_PAD.c"
click node_spi "https://github.com/mahmoudamer0a/iti_avr_project/blob/main/MCAL/SPI/SPI.c"
click node_adc "https://github.com/mahmoudamer0a/iti_avr_project/blob/main/MCAL/ADC/ADC.c"
click node_dio "https://github.com/mahmoudamer0a/iti_avr_project/blob/main/MCAL/DIO/DIO_program.c"
click node_gas_hal "https://github.com/mahmoudamer0a/iti_avr_project/tree/main/HAL/GAS"

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_master,node_auth,node_door,node_user toneBlue
class node_slave,node_temperature,node_light,node_gas toneAmber
class node_lcd,node_keypad,node_gas_hal toneMint
class node_spi,node_adc,node_dio toneRose
```

## Components

### Access and door

- [Master firmware](https://github.com/mahmoudamer0a/iti_avr_project/blob/main/App/main_Master.c): `App/main_Master.c`
- [Credential check](https://github.com/mahmoudamer0a/iti_avr_project/blob/main/App/main_Master.c): `App/main_Master.c`
- [Door task](https://github.com/mahmoudamer0a/iti_avr_project/blob/main/App/main_Master.c): `App/main_Master.c`

### Home sensing

- [Slave firmware](https://github.com/mahmoudamer0a/iti_avr_project/blob/main/App/main_Slave.c): `App/main_Slave.c`
- [Temperature control](https://github.com/mahmoudamer0a/iti_avr_project/blob/main/App/main_Slave.c): `App/main_Slave.c`
- [Light control](https://github.com/mahmoudamer0a/iti_avr_project/blob/main/App/main_Slave.c): `App/main_Slave.c`
- [Gas task](https://github.com/mahmoudamer0a/iti_avr_project/blob/main/App/main_Slave.c): `App/main_Slave.c`

### Device drivers

- [LCD driver](https://github.com/mahmoudamer0a/iti_avr_project/blob/main/HAL/LCD/LCD.c): `HAL/LCD/LCD.c`
- [Keypad driver](https://github.com/mahmoudamer0a/iti_avr_project/blob/main/HAL/KEY_PAD/KEY_PAD.c): `HAL/KEY_PAD/KEY_PAD.c`
- [Gas sensor assets](https://github.com/mahmoudamer0a/iti_avr_project/tree/main/HAL/GAS): `HAL/GAS`

### MCAL peripherals

- [SPI driver](https://github.com/mahmoudamer0a/iti_avr_project/blob/main/MCAL/SPI/SPI.c): `MCAL/SPI/SPI.c`
- [ADC driver](https://github.com/mahmoudamer0a/iti_avr_project/blob/main/MCAL/ADC/ADC.c): `MCAL/ADC/ADC.c`
- [Digital I/O](https://github.com/mahmoudamer0a/iti_avr_project/blob/main/MCAL/DIO/DIO_program.c): `MCAL/DIO/DIO_program.c`

### Other components

- **Home user**

## Connections

- Home user → Master firmware: enters credentials (evidence: `App/main_Master.c`)
- Master firmware → Credential check: checks credentials (evidence: `App/main_Master.c`)
- Credential check → Keypad driver: reads keys (evidence: `App/main_Master.c`)
- Credential check → LCD driver: shows prompts (evidence: `App/main_Master.c`)
- Master firmware → LCD driver: shows status (evidence: `App/main_Master.c`)
- Master firmware → SPI driver: sends authorization (evidence: `App/main_Master.c`)
- Master firmware → Door task: creates task (evidence: `App/main_Master.c`)
- Door task → Digital I/O: sets door outputs
- Slave firmware → SPI driver: receives authorization (evidence: `App/main_Slave.c`)
- Slave firmware → Temperature control: creates task (evidence: `App/main_Slave.c`)
- Slave firmware → Light control: creates task (evidence: `App/main_Slave.c`)
- Temperature control → ADC driver: reads temperature (evidence: `App/main_Slave.c`)
- Light control → ADC driver: reads light level (evidence: `App/main_Slave.c`)
- Temperature control → Digital I/O: controls outputs
- Light control → Digital I/O: controls LEDs
- Gas task → Digital I/O: controls gas output
- Gas task → Gas sensor assets: sensor integration
