chore: import local project into Gitea

This commit is contained in:
2026-05-20 10:02:48 -07:00
commit 397c0e44b0
14 changed files with 4658 additions and 0 deletions

76
README.md Normal file
View File

@@ -0,0 +1,76 @@
# Gemini Chat Gadget for ESP32-C6-LCD-1.69
This project builds a minimal ESP-IDF application that turns an ESP32-C6-LCD-1.69 board into a Gemini chat gadget. It features on-screen state indicators, speaker beeps, Wi-Fi connectivity, and integration with the Gemini API.
## Hardware
* **MCU/Board:** ESP32-C6 DevKitC-1
* **Display:** 1.69" ST7789V2, 240x280 resolution, SPI interface
* **Default Pins (configurable via Kconfig):**
* MOSI: GPIO7
* SCLK: GPIO6
* CS: GPIO5
* DC: GPIO2
* RST: GPIO4
* BL (Backlight): GPIO15
* BUTTON: GPIO0
* LED: GPIO8
* SPEAKER: GPIO25
* BAT_EN (Battery Enable): GPIO15 (drive HIGH on battery)
## Features
* **Display Auto-Probe:** Automatically detects and configures the ST7789V2 display by trying common rotations, offsets, and SPI clock frequencies.
* **UI State Machine:** Visual feedback on the LCD for different states: BOOT, CONNECTING, READY, LISTENING, THINKING, SPEAKING, and ERROR.
* **Wi-Fi Connectivity:** Connects to a specified Wi-Fi network in STA mode.
* **Gemini API Integration:** Communicates with the Google Gemini API (gemini-1.5-flash model) to generate text responses.
* **Audio Feedback:** Uses LEDC to generate tones for listening and speaking states, and a short beep for thinking.
* **Button Input:** A button on GPIO0 triggers a chat cycle.
* **Battery Management:** Sets `BAT_EN` (GPIO15) HIGH to enable battery power.
## Project Structure
* `CMakeLists.txt`: Main project CMake file.
* `main/CMakeLists.txt`: Component CMake file for the `main` component.
* `main/main.c`: Main application source code.
* `main/Kconfig.projbuild`: Defines Kconfig options for Wi-Fi credentials, Gemini API key, and LCD pin overrides.
* `sdkconfig.defaults`: Default configuration settings, including UART console, FreeRTOS tick rate, and placeholders for Wi-Fi and Gemini API key.
## Build and Flash Instructions
1. **Set the ESP-IDF Target:**
```bash
idf.py set-target esp32c6
```
2. **Configure Project Settings:**
Run `menuconfig` to set your Wi-Fi SSID, Wi-Fi Password, and Gemini API Key. You can also override default LCD pin assignments here if needed.
```bash
idf.py menuconfig
```
Navigate to "Application Configuration" to find the Wi-Fi and Gemini API key settings.
Navigate to "Application Configuration" -> "LCD Pin Configuration" to adjust pin assignments.
3. **Build, Flash, and Monitor:**
This command will build the project, flash it to your ESP32-C6 board, and open a serial monitor to view logs.
```bash
idf.py build flash monitor
```
## Acceptance Criteria
* Upon boot, the LCD should display a color-sweep during the auto-probe routine, followed by the BOOT, CONNECTING, and READY states.
* Pressing the button should initiate the LISTENING state (with a tone), transition to THINKING (with a beep), perform an HTTP POST to the Gemini API, move to SPEAKING (with a tone) while logging the reply, and finally return to the READY state.
* The console logs should clearly show auto-probe attempts and results, Wi-Fi connection status, HTTP status codes, and the extracted Gemini text response.
* The application should handle Wi-Fi or HTTP failures gracefully, transitioning to an ERROR state with appropriate logging.
## Dependencies
The project is designed to be lightweight and uses the following ESP-IDF components:
* `esp_lcd`
* `esp_http_client`
* `cJSON`
* `esp_wifi`
* `driver` (for GPIO and LEDC)
* `esp_timer`