# ESP32-P4 Waveform Generator

Simple firmware and HMI to generate square waveforms on a selected GPIO pin.

## Features
- User-selectable GPIO pin.
- Configurable frequency from 0Hz to 5000Hz (5kHz).
- Real-time control via USB/Serial.

## Project Structure
- `firmware/`: ESP-IDF project for ESP32-P4.
- `hmi/`: Python script for the Graphical User Interface.

## Prerequisites
1.  **ESP-IDF v5.x** installed and configured in your environment.
2.  **Python 3.x** with `pip` installed.

## Building and Flashing Firmware
1.  Navigate to the firmware directory:
    ```bash
    cd firmware
    ```
2.  Set the target to esp32p4:
    ```bash
    idf.py set-target esp32p4
    ```
3.  Build and flash the firmware:
    ```bash
    idf.py build flash monitor
    ```

## Running the HMI
1.  Navigate to the hmi directory:
    ```bash
    cd hmi
    ```
2.  Install dependencies:
    ```bash
    pip install -r requirements.txt
    ```
3.  Run the application:
    ```bash
    python hmi.py
    ```

## Usage
1.  Connect your ESP32-P4 board via USB.
2.  Select the correct COM/Serial port in the HMI.
3.  Enter the GPIO pin you want to use (e.g., GPIO 21).
4.  Set the desired frequency using the slider or text box.
5.  Click **Apply** to start/update the waveform.
6.  Setting frequency to **0** will stop the output.
