Files
lcd1602atest/include/pins.h
DESKTOP-PUHFO60\dsx2016 4bd42a9c39 Fix 3.5 CYD: backlight GPIO27, LCD SCL 21 via Wire1, GT911 INT as input.
Align cyd_35r with CYD_PROJECT_GUIDE so ST7796 is not black-screened, LCD does not steal GT911 Wire, and firmware/docs match 22+21 wiring.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-25 12:52:13 +08:00

54 lines
1.5 KiB
C

#pragma once
// Board pins — 2.8" default; 3.5" when CYD_BOARD_3248S035 is set (env:cyd_35r)
#if defined(CYD_BOARD_3248S035)
#define TFT_BL_PIN 27
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 480
#define UI_HOR_RES 480
#define UI_VER_RES 320
/* 3.5C capacitive GT911 (ESP32-3248S035C). GPIO33 is I2C SDA, not TOUCH_CS.
* Backlight is GPIO27; INT is GPIO21 — they are NOT the same pin. */
#define CYD_GT911_SDA 33
#define CYD_GT911_SCL 32
#define CYD_GT911_INT 21
#define CYD_GT911_RST 25
#else
#define TFT_BL_PIN 21
#define SCREEN_WIDTH 240
#define SCREEN_HEIGHT 320
#define UI_HOR_RES 320
#define UI_VER_RES 240
/* 2.8" CYD: dedicated SoftSPI touch bus. */
#define CYD_TOUCH_IRQ 36
#define CYD_TOUCH_MOSI 32
#define CYD_TOUCH_MISO 39
#define CYD_TOUCH_CLK 25
#define CYD_TOUCH_CS 33
#endif
/* Map 320x240 design coordinates onto the active UI resolution (identity on 2.8"). */
#define UX(x) ((int)(((long)(x) * (UI_HOR_RES)) / 320))
#define UY(y) ((int)(((long)(y) * (UI_VER_RES)) / 240))
#define UW(w) UX(w)
#define UH(h) UY(h)
/* Partial frame buffer: 3.5 needs smaller ratio to fit DRAM. */
#if defined(CYD_BOARD_3248S035)
#define DRAW_BUF_DIV 20
#else
#define DRAW_BUF_DIV 10
#endif
/* LCD1602A I2C backpack: 2.8 forever 22+27; 3.5 forever 22+21 (27 is BL). */
#define LCD_I2C_SDA_PIN 22
#if defined(CYD_BOARD_3248S035)
#define LCD_I2C_SCL_PIN 21
#else
#define LCD_I2C_SCL_PIN 27
#endif
#define LCD_I2C_FREQ_HZ 100000
#define LCD_COLS 16
#define LCD_ROWS 2