improve board config setup
This commit is contained in:
97
board_configs/README.md
Normal file
97
board_configs/README.md
Normal file
@@ -0,0 +1,97 @@
|
||||
# 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!
|
||||
52
board_configs/board_feather_tft.h
Normal file
52
board_configs/board_feather_tft.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#ifndef BOARD_FEATHER_TFT_H
|
||||
#define BOARD_FEATHER_TFT_H
|
||||
|
||||
#include "pico/stdlib.h"
|
||||
|
||||
// ============================================================================
|
||||
// Adafruit Feather RP2350 with 4.0" TFT ST7796
|
||||
// ============================================================================
|
||||
|
||||
#define BOARD_NAME "Adafruit Feather RP2350 + 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 - Feather RP2350 with 4.0" TFT
|
||||
#define DISPLAY_SPI_PORT spi1
|
||||
#define DISPLAY_SCK_PIN 10 // D10 (SCK)
|
||||
#define DISPLAY_MOSI_PIN 11 // D11 (MOSI)
|
||||
#define DISPLAY_MISO_PIN 20 // Not used for display
|
||||
#define DISPLAY_CS_PIN 7 // D13 (CS)
|
||||
#define DISPLAY_DC_PIN 4 // D4 (DC)
|
||||
#define DISPLAY_RST_PIN 9 // D9 (RST)
|
||||
#define DISPLAY_BL_PIN 6 // D6 (Backlight)
|
||||
#define DISPLAY_BUSY_PIN -1 // Not used for TFT
|
||||
|
||||
// I2C pins for touch - Feather I2C default
|
||||
#define TOUCH_I2C_PORT i2c1
|
||||
#define TOUCH_SDA_PIN 2
|
||||
#define TOUCH_SCL_PIN 3
|
||||
#define TOUCH_INT_PIN 25
|
||||
#define TOUCH_RST_PIN 28
|
||||
|
||||
// SD card pins (shared SPI with display)
|
||||
#define SD_SPI_PORT spi1
|
||||
#define SD_CS_PIN 5
|
||||
#define SD_MISO_PIN 24
|
||||
#define SD_MOSI_PIN 11
|
||||
#define SD_SCK_PIN 10
|
||||
|
||||
// Common configuration
|
||||
#define SPI_BAUDRATE (32 * 1000 * 1000) // 32 MHz for display
|
||||
#define I2C_BAUDRATE (400 * 1000) // 400 kHz for touch
|
||||
|
||||
#endif // BOARD_FEATHER_TFT_H
|
||||
52
board_configs/board_pico2_eink.h
Normal file
52
board_configs/board_pico2_eink.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#ifndef BOARD_PICO2_EINK_H
|
||||
#define BOARD_PICO2_EINK_H
|
||||
|
||||
#include "pico/stdlib.h"
|
||||
|
||||
// ============================================================================
|
||||
// Raspberry Pi Pico 2 with E-Ink Display
|
||||
// ============================================================================
|
||||
|
||||
#define BOARD_NAME "Raspberry Pi Pico 2 + E-Ink Display"
|
||||
|
||||
// Display Configuration
|
||||
#define DISPLAY_WIDTH 400
|
||||
#define DISPLAY_HEIGHT 300
|
||||
#define DISPLAY_TYPE_SELECTED 2 // DISPLAY_TYPE_EPAPER_VAL
|
||||
|
||||
// Touch Configuration (if your e-ink has touch, otherwise use TOUCH_TYPE_NONE)
|
||||
#define TOUCH_TYPE_SELECTED 1 // TOUCH_TYPE_NONE_VAL
|
||||
#define TOUCH_SWAP_XY false
|
||||
#define TOUCH_INVERT_X false
|
||||
#define TOUCH_INVERT_Y false
|
||||
|
||||
// SPI pins for E-Ink 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 (often not used by e-paper)
|
||||
#define DISPLAY_CS_PIN 5 // GP5
|
||||
#define DISPLAY_DC_PIN 6 // GP6 (Data/Command)
|
||||
#define DISPLAY_RST_PIN 7 // GP7 (Reset)
|
||||
#define DISPLAY_BL_PIN 8 // GP8 - Not used for e-ink, but needs valid pin number
|
||||
#define DISPLAY_BUSY_PIN 9 // GP9 - E-paper BUSY pin (critical!)
|
||||
|
||||
// I2C pins for touch (if using touch-enabled e-ink)
|
||||
#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) - optional
|
||||
#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 (4 * 1000 * 1000) // 4 MHz for e-paper (slower than TFT)
|
||||
#define I2C_BAUDRATE (400 * 1000) // 400 kHz for touch
|
||||
|
||||
#endif // BOARD_PICO2_EINK_H
|
||||
52
board_configs/board_pico2_tft.h
Normal file
52
board_configs/board_pico2_tft.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user