Files
touchbtntest/include/pins.h
DESKTOP-PUHFO60\dsx2016 e70fbd1d7f Fix 3.5C board support per CYD_PROJECT_GUIDE: BL=27, GT911 INT separate.
Correct ST7796/cyd_35r backlight, leave INT as input after reset, export firmware/cyd_35r.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-25 11:51:07 +08:00

49 lines
1.4 KiB
C

#pragma once
// Board pins — 2.8" default; 3.5" when CYD_BOARD_3248S035 is set (env:cyd_35r)
// See ../CYD_PROJECT_GUIDE.md §A
#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.
* BL=27; INT=21 (not shared with BL). Touch-btn OUT stays GPIO22. */
#define CYD_GT911_SDA 33
#define CYD_GT911_SCL 32
#define CYD_GT911_INT 21
#define CYD_GT911_RST 25
#define CYD_TFT_CS 15
#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: SoftSPI touch. BL=21; touch-btn OUT GPIO22. */
#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
#define CYD_TFT_CS 15
#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
/* Primary peripheral pin — same on 2.8 and 3.5 */
#define BTN_PIN 22