improve board config setup
This commit is contained in:
159
board_config.h
159
board_config.h
@@ -1,129 +1,50 @@
|
||||
#ifndef BOARD_CONFIG_H
|
||||
#define BOARD_CONFIG_H
|
||||
|
||||
#include "pico/stdlib.h"
|
||||
// ============================================================================
|
||||
// BOARD CONFIGURATION SELECTOR
|
||||
// ============================================================================
|
||||
// This file serves as a selector for different board configurations.
|
||||
// Uncomment ONE of the board defines below to select your hardware setup.
|
||||
//
|
||||
// Available boards:
|
||||
// - BOARD_FEATHER_TFT: Adafruit Feather RP2350 with 4.0" TFT ST7796
|
||||
// - BOARD_PICO2_TFT: Raspberry Pi Pico 2 with 4.0" TFT ST7796
|
||||
// - BOARD_PICO2_EINK: Raspberry Pi Pico 2 with E-Ink Display
|
||||
//
|
||||
// To switch boards: Simply uncomment one board and comment out the others.
|
||||
// ============================================================================
|
||||
|
||||
// Forward declare display and touch types (actual enums in respective headers)
|
||||
// Display options: DISPLAY_TYPE_ST7796, DISPLAY_TYPE_ST7789, DISPLAY_TYPE_EPAPER
|
||||
// Touch options: TOUCH_TYPE_FT6336U, TOUCH_TYPE_NONE
|
||||
// ---- 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
|
||||
// --------------------------------
|
||||
|
||||
// Board-specific pin definitions and configurations
|
||||
// ============================================================================
|
||||
// Display Type Constants (for use in board configs)
|
||||
// ============================================================================
|
||||
#define DISPLAY_TYPE_ST7796_VAL 0
|
||||
#define DISPLAY_TYPE_ST7789_VAL 1
|
||||
#define DISPLAY_TYPE_EPAPER_VAL 2
|
||||
|
||||
#if defined(PICO_BOARD_ADAFRUIT_FEATHER_RP2350)
|
||||
// Adafruit Feather RP2350 pinout
|
||||
#define BOARD_NAME "Adafruit Feather RP2350"
|
||||
|
||||
// Display configuration
|
||||
#define DISPLAY_WIDTH 480
|
||||
#define DISPLAY_HEIGHT 320
|
||||
#define DISPLAY_TYPE_SELECTED 0 // DISPLAY_TYPE_ST7796
|
||||
|
||||
// Touch configuration
|
||||
#define TOUCH_TYPE_SELECTED 0 // TOUCH_TYPE_FT6336U
|
||||
#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 13 // For e-paper displays
|
||||
|
||||
// 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
|
||||
|
||||
#elif defined(PICO_BOARD) && (PICO_BOARD == pico2 || PICO_BOARD == pico2_w)
|
||||
// Raspberry Pi Pico 2 / Pico 2 W pinout
|
||||
#define BOARD_NAME "Raspberry Pi Pico 2"
|
||||
|
||||
// Display configuration
|
||||
#define DISPLAY_WIDTH 480
|
||||
#define DISPLAY_HEIGHT 320
|
||||
#define DISPLAY_TYPE_SELECTED 0 // DISPLAY_TYPE_ST7796
|
||||
|
||||
// Touch configuration
|
||||
#define TOUCH_TYPE_SELECTED 0 // TOUCH_TYPE_FT6336U
|
||||
#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 9 // GP9 - For e-paper displays
|
||||
|
||||
// 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
|
||||
|
||||
// ============================================================================
|
||||
// Touch Type Constants (for use in board configs)
|
||||
// ============================================================================
|
||||
#define TOUCH_TYPE_FT6336U_VAL 0
|
||||
#define TOUCH_TYPE_NONE_VAL 1
|
||||
|
||||
// ============================================================================
|
||||
// Load Board-Specific Configuration
|
||||
// ============================================================================
|
||||
#ifdef BOARD_FEATHER_TFT
|
||||
#include "board_configs/board_feather_tft.h"
|
||||
#elif defined(BOARD_PICO2_TFT)
|
||||
#include "board_configs/board_pico2_tft.h"
|
||||
#elif defined(BOARD_PICO2_EINK)
|
||||
#include "board_configs/board_pico2_eink.h"
|
||||
#else
|
||||
#warning "Unknown board! Using default Pico 2 pinout"
|
||||
#define BOARD_NAME "Unknown Board (Pico 2 defaults)"
|
||||
|
||||
// Display configuration
|
||||
#define DISPLAY_WIDTH 480
|
||||
#define DISPLAY_HEIGHT 320
|
||||
#define DISPLAY_TYPE_SELECTED 0 // DISPLAY_TYPE_ST7796
|
||||
|
||||
// Touch configuration
|
||||
#define TOUCH_TYPE_SELECTED 0 // TOUCH_TYPE_FT6336U
|
||||
#define TOUCH_SWAP_XY true
|
||||
#define TOUCH_INVERT_X true
|
||||
#define TOUCH_INVERT_Y false
|
||||
|
||||
// Default to Pico 2 pinout
|
||||
#define DISPLAY_SPI_PORT spi0
|
||||
#define DISPLAY_SCK_PIN 2
|
||||
#define DISPLAY_MOSI_PIN 3
|
||||
#define DISPLAY_MISO_PIN 4
|
||||
#define DISPLAY_CS_PIN 5
|
||||
#define DISPLAY_DC_PIN 6
|
||||
#define DISPLAY_RST_PIN 7
|
||||
#define DISPLAY_BL_PIN 8
|
||||
#define DISPLAY_BUSY_PIN 9 // For e-paper displays
|
||||
|
||||
#define TOUCH_I2C_PORT i2c0
|
||||
#define TOUCH_SDA_PIN 12
|
||||
#define TOUCH_SCL_PIN 13
|
||||
#define TOUCH_INT_PIN 14
|
||||
#define TOUCH_RST_PIN 15
|
||||
|
||||
#define SD_SPI_PORT spi1
|
||||
#define SD_CS_PIN 17
|
||||
#error "No board selected! Please uncomment one BOARD_xxx define in board_config.h"
|
||||
#endif
|
||||
|
||||
// Common configuration
|
||||
#define SPI_BAUDRATE (32 * 1000 * 1000) // 32 MHz for display
|
||||
#define I2C_BAUDRATE (400 * 1000) // 400 kHz for touch
|
||||
|
||||
#endif // BOARD_CONFIG_H
|
||||
|
||||
Reference in New Issue
Block a user