# infineon/mtb-example-cy8cproto-041tp-demo architecture

> Architecture diagram of the GitHub repository infineon/mtb-example-cy8cproto-041tp-demo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/infineon/mtb-example-cy8cproto-041tp-demo
- Repository: https://github.com/infineon/mtb-example-cy8cproto-041tp-demo

## Overview

##### Project type and purpose
- This is an embedded-firmware demo for the PSoC™ 4100T Plus (CY8CPROTO-041TP) CAPSENSE™ kit.
- It implements ultra-low-power capacitive-sensing (buttons, proximity, touchpad, ambient-light sensor) and drives LEDs to indicate sensor events, while exposing data to the PC-based CAPSENSE™ Tuner over I2C.

##### File structure
- Top-level files:
– Makefile, main.c: standard ModusToolbox™ CLI-build firmware project
– deps/: contains middleware (capsense) and PDL driver libraries
– templates/: BSP and project templates for TARGET_CY8CPROTO-041TP
– images/: screenshots for README
- No separate “frontend/backend”: it’s monolithic firmware with layered drivers.
- Configuration files (design.cycapsense, design.modus) live under templates/, used by ModusToolbox™ device configurator.

##### README for insights
- Middleware: CAPSENSE™ library (capsense driver, MSC hardware interface)
- Drivers: PDL SCB (EZI2C), PWM, system power
- Firmware state machine: Active → ALR → WoT modes
- External tool: CAPSENSE™ Tuner uses I2C via KitProg3

##### Diagramming recommendations
- Components: use rectangles labeled “MCU: PSoC™ 4100T”, “MSC Sensor Block”, “SCB/EZI2C”, “PWM/LED Driver”, “CAPSENSE™ Middleware”, “Application FSM”, “KitProg3/I2C Bridge”, “CAPSENSE™ Tuner”
- Firmware/middleware in another (e.g., green)
- External tool in a third (e.g., orange)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Hardware Layer
    subgraph "Hardware Layer"
        direction TB
        MCU["MCU: PSoC™ 4100T"]:::hardware
        MSC["MSC Sensor Block"]:::hardware
        SCB["SCB/EZI2C"]:::hardware
        PWM["PWM/LED Driver"]:::hardware
        POWER["Power Subsystem"]:::hardware
        SENSORS["Sensors\n(Low-power widgets,\nSelf-cap, Mutual-cap,\nProximity, ALS)"]:::hardware
        LEDs["LEDs\n(LED2, LED3,\nLED5, LED6)"]:::hardware
        KITPROG["KitProg3/I2C Bridge"]:::hardware
    end

    %% Firmware Layer
    subgraph "Firmware Layer"
        direction TB
        BSP["BSP & PDL Drivers"]:::firmware
        MIDDLEWARE["CAPSENSE™ Middleware"]:::firmware
        APP["Application FSM\n(State-Machine,\nSensor Scan,\nLED Control,\nI²C Buffer)"]:::firmware
        BUILD["Build System\n(Makefile)"]:::docs
    end

    %% External Interface
    subgraph "External Interface"
        direction TB
        TUNER["CAPSENSE™ Tuner (PC)"]:::external
        DOCS["Project Docs\n& Examples"]:::docs
    end

    %% Connections
    SENSORS -->|"scan data"| MSC
    MSC -->|"raw data"| MIDDLEWARE
    MIDDLEWARE -->|"processed data"| APP
    APP -->|"power mode control"| POWER
    POWER -->|"configures scan rate"| MSC
    APP -->|"PWM duty updates"| PWM
    PWM -->|"drive"| LEDs
    APP -->|"I2C data buffer"| SCB
    SCB -->|"I2C @400kHz"| KITPROG
    KITPROG -->|"I2C bridge"| TUNER

    %% Documentation links
    DOCS --> README["README.md"]:::docs
    DOCS --> IMAGES["images/"]:::docs

    %% Click Events
    click APP "https://github.com/infineon/mtb-example-cy8cproto-041tp-demo/blob/master/main.c"
    click BUILD "https://github.com/infineon/mtb-example-cy8cproto-041tp-demo/tree/master/Makefile"
    click MIDDLEWARE "https://github.com/infineon/mtb-example-cy8cproto-041tp-demo/blob/master/deps/capsense.mtb"
    click BSP "https://github.com/infineon/mtb-example-cy8cproto-041tp-demo/tree/master/templates/TARGET_CY8CPROTO-041TP/"
    click README "https://github.com/infineon/mtb-example-cy8cproto-041tp-demo/blob/master/README.md"
    click IMAGES "https://github.com/infineon/mtb-example-cy8cproto-041tp-demo/tree/master/images/"
    click DESIGN1 "https://github.com/infineon/mtb-example-cy8cproto-041tp-demo/blob/master/templates/TARGET_CY8CPROTO-041TP/config/design.cycapsense"
    click DESIGN2 "https://github.com/infineon/mtb-example-cy8cproto-041tp-demo/blob/master/templates/TARGET_CY8CPROTO-041TP/config/design.modus"

    %% Styles
    classDef hardware fill:#AED6F1,stroke:#2E86C1,color:#1B4F72;
    classDef firmware fill:#A9DFBF,stroke:#229954,color:#145A32;
    classDef external fill:#F9E79F,stroke:#B7950B,color:#7D6608;
    classDef docs fill:#D7DBDD,stroke:#7B7D7D,color:#283747;
```
