- Add Alert History endpoints to REST API reference - Create alert-history.md firmware component doc - Update firmware controller index to include alert history - Fix all /root/cleargrow paths to /opt/repos 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
5.2 KiB
5.2 KiB
title, version
| title | version |
|---|---|
| Controller GPIO Pinout | 1.0 |
Controller GPIO Pinout
GPIO pin assignments for the ClearGrow Controller (ESP32-S3 with Waveshare 4.3" RGB LCD).
Source of Truth:
/opt/repos/controller/main/pin_config.h
GPIO Pin Allocation Table
| GPIO | Function | Interface | Notes |
|---|---|---|---|
| 0 | LCD_B2 | RGB | Blue bit 2 (strapping pin) |
| 1 | RESERVED | — | Reserved (previously NFC_CS) |
| 2 | RESERVED | — | Reserved (previously NFC_IRQ) |
| 3 | TOUCH_INT | GPIO | Touch interrupt (input) |
| 4 | LCD_VSYNC | RGB | LCD vertical sync |
| 5 | LCD_HSYNC | RGB | LCD horizontal sync |
| 6 | LCD_G0 | RGB | Green bit 0 |
| 7 | LCD_R4 | RGB | Red bit 4 |
| 8 | USB_VBUS_DETECT | GPIO | USB power detection |
| 9 | LCD_G2 | RGB | Green bit 2 |
| 10 | LCD_G3 | RGB | Green bit 3 |
| 11 | LCD_G4 | RGB | Green bit 4 |
| 12 | LCD_G5 | RGB | Green bit 5 |
| 13 | LCD_B0 | RGB | Blue bit 0 |
| 14 | LCD_B1 | RGB | Blue bit 1 |
| 15 | LCD_R3 | RGB | Red bit 3 |
| 16 | LCD_R2 | RGB | Red bit 2 |
| 17 | LCD_R1 | RGB | Red bit 1 |
| 18 | LCD_R0 | RGB | Red bit 0 |
| 19 | TOUCH_SDA | I2C | GT911 touch data |
| 20 | TOUCH_SCL | I2C | GT911 touch clock |
| 21 | LCD_PCLK | RGB | LCD pixel clock |
| 35 | SPI_MOSI | SPI2 | SD card data out |
| 36 | SPI_SCLK | SPI2 | SD card clock |
| 37 | SPI_MISO | SPI2 | SD card data in |
| 38 | LCD_BACKLIGHT | LEDC | PWM backlight control |
| 39 | SD_CS | SPI2 | SD card chip select |
| 40 | RCP_RESET | GPIO | nRF52840 RCP reset |
| 41 | STATUS_LED | GPIO | Status LED output |
| 43 | RCP_TX | UART | ESP TX → nRF RX |
| 44 | RCP_RX | UART | ESP RX ← nRF TX |
| 45 | LCD_DE | RGB | LCD data enable |
| 46 | LCD_G1 | RGB | Green bit 1 (strapping) |
| 47 | LCD_B3 | RGB | Blue bit 3 |
| 48 | LCD_B4 | RGB | Blue bit 4 |
Pin Configuration Header
// main/pin_config.h
#ifndef PIN_CONFIG_H
#define PIN_CONFIG_H
// === RGB Display Interface ===
#define PIN_LCD_DE 45
#define PIN_LCD_VSYNC 4
#define PIN_LCD_HSYNC 5
#define PIN_LCD_PCLK 21
// Red channel (5 bits)
#define PIN_LCD_R0 18
#define PIN_LCD_R1 17
#define PIN_LCD_R2 16
#define PIN_LCD_R3 15
#define PIN_LCD_R4 7
// Green channel (6 bits)
#define PIN_LCD_G0 6
#define PIN_LCD_G1 46
#define PIN_LCD_G2 9
#define PIN_LCD_G3 10
#define PIN_LCD_G4 11
#define PIN_LCD_G5 12
// Blue channel (5 bits)
#define PIN_LCD_B0 13
#define PIN_LCD_B1 14
#define PIN_LCD_B2 0
#define PIN_LCD_B3 47
#define PIN_LCD_B4 48
#define PIN_LCD_BACKLIGHT 38
// === Touch Controller (GT911) ===
#define PIN_TOUCH_SDA 19
#define PIN_TOUCH_SCL 20
#define PIN_TOUCH_INT 3
#define PIN_TOUCH_RST -1 // Not connected
// === SPI Bus (SD card) ===
#define PIN_SPI_MOSI 35
#define PIN_SPI_MISO 37
#define PIN_SPI_SCLK 36
#define PIN_SD_CS 39
// Reserved pins (previously NFC)
// #define PIN_NFC_CS 1
// #define PIN_NFC_IRQ 2
// === Thread RCP (nRF52840 via UART) ===
#define PIN_RCP_TX 43
#define PIN_RCP_RX 44
#define PIN_RCP_RESET 40
// === Other ===
#define PIN_USB_VBUS_DETECT 8
#define PIN_STATUS_LED 41
// === I2C/SPI Frequencies ===
#define I2C_TOUCH_FREQ_HZ 400000
#define SPI_BUS_FREQ_HZ 10000000
#endif // PIN_CONFIG_H
Interface Groups
RGB LCD (16-bit RGB565)
The display uses a 16-bit parallel RGB interface:
| Signal | GPIO | Description |
|---|---|---|
| DE | 45 | Data enable |
| VSYNC | 4 | Vertical sync |
| HSYNC | 5 | Horizontal sync |
| PCLK | 21 | Pixel clock |
| R[4:0] | 7, 15-18 | Red channel (5 bits) |
| G[5:0] | 6, 9-12, 46 | Green channel (6 bits) |
| B[4:0] | 0, 13-14, 47-48 | Blue channel (5 bits) |
| Backlight | 38 | PWM brightness control |
Touch Controller (GT911)
| Signal | GPIO | Description |
|---|---|---|
| SDA | 19 | I2C data |
| SCL | 20 | I2C clock |
| INT | 3 | Touch interrupt |
| RST | -1 | Not connected |
I2C frequency: 400 kHz
SPI Bus (SD Card)
SPI2 used for SD card storage:
| Signal | GPIO | Description |
|---|---|---|
| MOSI | 35 | Data out |
| MISO | 37 | Data in |
| SCLK | 36 | Clock |
| SD_CS | 39 | SD card chip select |
Note: GPIO 1 and 2 are reserved (previously used for NFC reader, now removed)
Thread RCP (nRF52840)
| Signal | GPIO | Description |
|---|---|---|
| TX | 43 | ESP32 TX → nRF RX |
| RX | 44 | ESP32 RX ← nRF TX |
| RESET | 40 | nRF reset control |
Status & Power
| Signal | GPIO | Description |
|---|---|---|
| STATUS_LED | 41 | Status indicator LED |
| USB_VBUS_DETECT | 8 | USB power detection |
Strapping Pin Notes
| GPIO | Boot Requirement | Usage |
|---|---|---|
| 0 | Pull-up (normal boot) | LCD_B2 - safe after boot |
| 45 | Pull-down (3.3V VDD_SPI) | LCD_DE - safe after boot |
| 46 | Pull-down (normal boot) | LCD_G1 - safe after boot |
GPIO 0, 45, and 46 are strapping pins. They affect boot behavior but can be used for LCD signals after boot completes.