# Board Configuration System

This directory contains board-specific configuration files for different hardware setups.

## How to Switch Boards

Edit [`board_config.h`](../board_config.h) and uncomment the board you want to use:

```cpp
// ---- SELECT YOUR BOARD HERE ----
#define BOARD_FEATHER_TFT      // Feather RP2350 + 4.0" TFT ST7796
// #define BOARD_PICO2_TFT        // Pico 2 + 4.0" TFT ST7796
// #define BOARD_PICO2_EINK       // Pico 2 + E-Ink Display
// --------------------------------
```

**Important:** Only one board should be uncommented at a time!

## Available Boards

### 1. BOARD_FEATHER_TFT
**File:** `board_feather_tft.h`  
**Hardware:** Adafruit Feather RP2350 with 4.0" TFT ST7796  
**Display:** ST7796 (480x320 RGB TFT)  
**Touch:** FT6336U capacitive touch  
**Features:** High-speed refresh, backlight control, SD card

### 2. BOARD_PICO2_TFT
**File:** `board_pico2_tft.h`  
**Hardware:** Raspberry Pi Pico 2 with 4.0" TFT ST7796  
**Display:** ST7796 (480x320 RGB TFT)  
**Touch:** FT6336U capacitive touch  
**Features:** High-speed refresh, backlight control, SD card

### 3. BOARD_PICO2_EINK
**File:** `board_pico2_eink.h`  
**Hardware:** Raspberry Pi Pico 2 with E-Ink Display  
**Display:** E-Paper (400x300 monochrome)  
**Touch:** None (configurable)  
**Features:** Ultra low power, BUSY pin for refresh status

## Adding a New Board

1. Create a new header file: `board_configs/board_your_name.h`
2. Copy the structure from an existing board file
3. Update all pin definitions for your hardware
4. Add a `#define BOARD_YOUR_NAME` option in `board_config.h`
5. Add an `#elif defined(BOARD_YOUR_NAME)` section

## Configuration Structure

Each board config file must define:

### Display Settings
- `BOARD_NAME` - Human-readable board name
- `DISPLAY_WIDTH`, `DISPLAY_HEIGHT` - Screen dimensions
- `DISPLAY_TYPE_SELECTED` - Display driver type (0=ST7796, 2=EPAPER)

### Display Pins
- `DISPLAY_SPI_PORT` - SPI instance (spi0 or spi1)
- `DISPLAY_SCK_PIN`, `DISPLAY_MOSI_PIN`, `DISPLAY_MISO_PIN`
- `DISPLAY_CS_PIN` - Chip select
- `DISPLAY_DC_PIN` - Data/Command
- `DISPLAY_RST_PIN` - Reset
- `DISPLAY_BL_PIN` - Backlight (-1 for e-ink)
- `DISPLAY_BUSY_PIN` - E-paper busy signal (-1 for TFT)

### Touch Settings
- `TOUCH_TYPE_SELECTED` - Touch driver type (0=FT6336U, 1=NONE)
- `TOUCH_SWAP_XY`, `TOUCH_INVERT_X`, `TOUCH_INVERT_Y` - Orientation

### Touch Pins
- `TOUCH_I2C_PORT` - I2C instance (i2c0 or i2c1)
- `TOUCH_SDA_PIN`, `TOUCH_SCL_PIN`
- `TOUCH_INT_PIN` - Interrupt
- `TOUCH_RST_PIN` - Reset

### SD Card Pins (Optional)
- `SD_SPI_PORT`, `SD_CS_PIN`, `SD_MISO_PIN`, `SD_MOSI_PIN`, `SD_SCK_PIN`

### Timing
- `SPI_BAUDRATE` - SPI clock speed (32MHz for TFT, 4MHz for e-ink)
- `I2C_BAUDRATE` - I2C clock speed (typically 400kHz)

## Build Process

The build system automatically uses the selected board configuration:

```bash
# Build for currently selected board
mkdir -p build
cd build
cmake ..
make -j4
```

No need to specify board-specific CMake flags - just edit `board_config.h` to switch!
