#ifndef BOARD_PICO2_TFT_H
#define BOARD_PICO2_TFT_H

#include "pico/stdlib.h"

// ============================================================================
// Raspberry Pi Pico 2 with 4.0" TFT ST7796
// ============================================================================

#define BOARD_NAME "Raspberry Pi Pico 2 + 4.0\" TFT ST7796"

// Display Configuration
#define DISPLAY_WIDTH 480
#define DISPLAY_HEIGHT 320
#define DISPLAY_TYPE_SELECTED 0  // DISPLAY_TYPE_ST7796_VAL

// Touch Configuration
#define TOUCH_TYPE_SELECTED 0  // TOUCH_TYPE_FT6336U_VAL
#define TOUCH_SWAP_XY true
#define TOUCH_INVERT_X true
#define TOUCH_INVERT_Y false

// SPI pins for display (using SPI0)
#define DISPLAY_SPI_PORT spi0
#define DISPLAY_SCK_PIN  2   // GP2
#define DISPLAY_MOSI_PIN 3   // GP3
#define DISPLAY_MISO_PIN 4   // GP4
#define DISPLAY_CS_PIN   5   // GP5
#define DISPLAY_DC_PIN   6   // GP6
#define DISPLAY_RST_PIN  7   // GP7
#define DISPLAY_BL_PIN   8   // GP8
#define DISPLAY_BUSY_PIN -1  // Not used for TFT

// I2C pins for touch (using I2C0)
#define TOUCH_I2C_PORT i2c0
#define TOUCH_SDA_PIN  12  // GP12
#define TOUCH_SCL_PIN  13  // GP13
#define TOUCH_INT_PIN  14  // GP14
#define TOUCH_RST_PIN  15  // GP15

// SD card pins (separate SPI1)
#define SD_SPI_PORT    spi1
#define SD_CS_PIN      17  // GP17
#define SD_MISO_PIN    16  // GP16
#define SD_MOSI_PIN    19  // GP19
#define SD_SCK_PIN     18  // GP18

// Common configuration
#define SPI_BAUDRATE (32 * 1000 * 1000)  // 32 MHz for display
#define I2C_BAUDRATE (400 * 1000)        // 400 kHz for touch

#endif // BOARD_PICO2_TFT_H
