# abdelhamid108/iti-iot- architecture

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

- Interactive diagram: https://gitdiagram.com/abdelhamid108/iti-iot-
- Repository: https://github.com/abdelhamid108/iti-iot-

## Overview

##### Project type and purpose
- This is an embedded IoT firmware project (ITI-IoT) combined with MATLAB-based data-processing and lab scripts.
- The firmware runs on a microcontroller, providing drivers for ADC, digital I/O, 7-segment display and UART, plus a middleware layer (CRC, SLIP, delay) and a LoRaWAN communication stack (WiMOD_HCI_Layer, WiMOD_LoRaWAN_API). MATLAB scripts under matlab_iot are used on a host PC to generate or analyze signals and interact with the device.

##### File structure
- Top-level directories:
– adc, dio, segment, uart: peripheral driver implementations and small demos (e.g., main.c to test each driver)
– project: the full firmware build, containing HAL drivers, protocol layers, main application and Debug/build artifacts
– matlab_iot: MATLAB/.m scripts for lab exercises and LoRaWAN interaction
- Key patterns:
– “project” directory is organized by component (CRC16, DIO, SLIP, UART, WiMOD layers, lcd, delay, Utils) and contains build files (makefile, .elf/.hex)
– Drivers live at the bottom layer, utilities and protocol middleware above, and main.c sits at the top as the application entry point

##### Putting it all together
2. Inside, stack from bottom to top:
- HAL Layer: ADC, DIO, 7-Segment, UART
- Middleware Layer: CRC16, Delay, SLIP
- Protocol Layer: WiMOD_HCI_Layer, WiMOD_LoRaWAN_API
- Application Layer: main.c

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Hardware
    SENS["Sensors & Inputs"]:::external
    DISPLAY["7-Segment Display"]:::external
    RADIO["WiMOD LoRaWAN Radio Module"]:::external
    PC["Host PC (MATLAB Scripts)"]:::external

    %% Microcontroller Firmware Stack
    subgraph "Microcontroller Firmware"
        direction TB
        subgraph "HAL Layer"
            direction TB
            ADC["ADC Driver"]:::hal
            DIO["DIO Driver"]:::hal
            SEG["7-Segment Driver"]:::hal
            UART_DRV["UART Driver"]:::hal
        end
        subgraph "Middleware Layer"
            direction TB
            CRC["CRC16 Utility"]:::middleware
            DELAY["Delay Middleware"]:::middleware
            SLIP["SLIP Framing"]:::middleware
            UTILS["General Utilities"]:::middleware
        end
        subgraph "Protocol Layer"
            direction TB
            HCI["WiMOD HCI Layer"]:::protocol
            API["WiMOD LoRaWAN API"]:::protocol
        end
        MAIN["Core Application (main.c)"]:::application
    end

    %% Data Flows
    SENS -->|"Sensor Data"| ADC
    SENS -->|"Digital Inputs"| DIO
    ADC -->|"Data"| MAIN
    DIO -->|"Data"| MAIN
    MAIN -->|"Display Commands"| SEG
    MAIN -->|"Frame Data"| CRC
    CRC -->|"CRC-Protected"| SLIP
    SLIP -->|"SLIP Frames"| HCI
    HCI -->|"HCI Packets"| API
    API -->|"UART TX/RX"| UART_DRV
    UART_DRV -->|"Serial Data"| RADIO
    RADIO -->|"Radio Feedback"| UART_DRV
    PC -->|"Serial Interface"| UART_DRV
    PC -->|"LoRaWAN Network"| RADIO

    %% Click Events
    click ADC "https://github.com/abdelhamid108/iti-iot-/blob/main/adc/adc/adc.c"
    click DIO "https://github.com/abdelhamid108/iti-iot-/blob/main/dio/dio.c"
    click SEG "https://github.com/abdelhamid108/iti-iot-/blob/main/segment/7segment.c"
    click UART_DRV "https://github.com/abdelhamid108/iti-iot-/blob/main/uart/uart.c"
    click CRC "https://github.com/abdelhamid108/iti-iot-/blob/main/project/CRC16.c"
    click DELAY "https://github.com/abdelhamid108/iti-iot-/blob/main/project/delay.c"
    click SLIP "https://github.com/abdelhamid108/iti-iot-/blob/main/project/SLIP.c"
    click UTILS "https://github.com/abdelhamid108/iti-iot-/blob/main/project/Utils.h"
    click HCI "https://github.com/abdelhamid108/iti-iot-/blob/main/project/WiMOD_HCI_Layer.c"
    click API "https://github.com/abdelhamid108/iti-iot-/blob/main/project/WiMOD_LoRaWAN_API.c"
    click MAIN "https://github.com/abdelhamid108/iti-iot-/blob/main/project/main.c"
    click PC "https://github.com/abdelhamid108/iti-iot-/tree/main/matlab_iot/"

    %% Styles
    classDef hal fill:#cce5ff,stroke:#004085,color:#004085
    classDef middleware fill:#d4edda,stroke:#155724,color:#155724
    classDef protocol fill:#fff3cd,stroke:#856404,color:#856404
    classDef application fill:#f5c6cb,stroke:#721c24,color:#721c24
    classDef external fill:#e2e3e5,stroke:#6c757d,color:#6c757d
```
