From c95518ec425ce8a9bfacd7c3a552f562cf1cfdff Mon Sep 17 00:00:00 2001 From: jpe230 Date: Sun, 28 Feb 2021 03:13:52 -0600 Subject: [PATCH] Added support GamePi20 --- CMakeLists.txt | 3 +++ README.md | 2 ++ st7735r.h | 6 +++++- waveshare_gamepi20.h | 18 ++++++++++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 waveshare_gamepi20.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 235c70f..3904e0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -208,6 +208,9 @@ elseif(WAVESHARE_ST7789VW_HAT) elseif(WAVESHARE_ST7735S_HAT) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DST7735S -DWAVESHARE_ST7735S_HAT") message(STATUS "Targeting WaveShare 128x128 1.44inch LCD Hat with ST7735S controller") +elseif(WAVESHARE_GAMEPI20) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DST7789 -DST7789VW -DWAVESHARE_GAMEPI20") + message(STATUS "Targeting WaveShare GamePi20 320x240 2.0inch IPS LCD with ST7789VW controller") elseif(ILI9340) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DILI9340") message(STATUS "Targeting ILI9340") diff --git a/README.md b/README.md index cfe85d1..e6c62bc 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,7 @@ The following LCD displays have been tested: - [Tontec 3.5" 320x480 LCD Display](https://www.ebay.com/p/Tontec-3-5-Inches-Touch-Screen-for-Raspberry-Pi-Display-TFT-Monitor-480x320-LCD/1649448059) with MZ61581-PI-EXT 2016.1.28 controller - [Adafruit 1.54" 240x240 Wide Angle TFT LCD Display with MicroSD](https://www.adafruit.com/product/3787) with ST7789 controller - [WaveShare 240x240, 1.3inch IPS LCD display HAT for Raspberry Pi](https://www.waveshare.com/1.3inch-lcd-hat.htm) with ST7789VW controller + - [WaveShare GamePi20 320x240 2.0inch IPS LCD](https://www.waveshare.com/gamepi20.htm) with ST7789VW controller - [WaveShare 128x128, 1.44inch LCD display HAT for Raspberry Pi](https://www.waveshare.com/1.44inch-lcd-hat.htm) with ST7735S controller - [KeDei 3.5 inch SPI TFTLCD 480*320 16bit/18bit version 6.3 2018/4/9](https://github.com/juj/fbcp-ili9341/issues/40) with MPI3501 controller - Unbranded 2.8" 320x240 display with ILI9340 controller @@ -117,6 +118,7 @@ When using one of the displays that stack on top of the Pi that are already reco - `-DTONTEC_MZ61581=ON`: If you are running on the [Tontec 3.5" 320x480 LCD Display](https://www.ebay.com/p/Tontec-3-5-Inches-Touch-Screen-for-Raspberry-Pi-Display-TFT-Monitor-480x320-LCD/1649448059) display, pass this. - `-DWAVESHARE_ST7789VW_HAT=ON`: If specified, targets a [240x240, 1.3inch IPS LCD display HAT for Raspberry Pi](https://www.waveshare.com/1.3inch-lcd-hat.htm) with ST7789VW display controller. - `-DWAVESHARE_ST7735S_HAT=ON`: If specified, targets a [128x128, 1.44inch LCD display HAT for Raspberry Pi](https://www.waveshare.com/1.3inch-lcd-hat.htm) with ST7735S display controller. +- `-DWAVESHARE_GAMEPI20=ON`: If specified, targets a [GamePi20 320x240 2.0inch IPS LCD](https://www.waveshare.com/gamepi20.htm) with ST7735SVW display controller. - `-DKEDEI_V63_MPI3501=ON`: If specified, targets a [KeDei 3.5 inch SPI TFTLCD 480*320 16bit/18bit version 6.3 2018/4/9](https://github.com/juj/fbcp-ili9341/issues/40) display with MPI3501 display controller. ###### If you wired the display to the Pi yourself diff --git a/st7735r.h b/st7735r.h index 789b4b6..f0a408a 100644 --- a/st7735r.h +++ b/st7735r.h @@ -15,7 +15,7 @@ #define DISPLAY_SET_CURSOR_Y 0x2B #define DISPLAY_WRITE_PIXELS 0x2C -#if defined(ST7789) || defined(ST7789VW) +#if (defined(ST7789) || defined(ST7789VW)) && !defined(WAVESHARE_GAMEPI20) #define DISPLAY_NATIVE_WIDTH 240 #define DISPLAY_NATIVE_HEIGHT 240 #elif defined(ST7735R) @@ -39,6 +39,10 @@ #include "waveshare_st7789vw_hat.h" #elif defined(WAVESHARE_ST7735S_HAT) #include "waveshare_st7735s_hat.h" +#elif defined(WAVESHARE_GAMEPI20) +#include "waveshare_gamepi20.h" +#define DISPLAY_NATIVE_WIDTH 240 +#define DISPLAY_NATIVE_HEIGHT 320 #endif #define InitSPIDisplay InitST7735R diff --git a/waveshare_gamepi20.h b/waveshare_gamepi20.h new file mode 100644 index 0000000..56e1d4b --- /dev/null +++ b/waveshare_gamepi20.h @@ -0,0 +1,18 @@ +#pragma once + +// Data specific to WaveShare GamePi20 320x240 2.0inch IPS LCD, https://www.waveshare.com/wiki/GamePi20 +#ifdef WAVESHARE_GAMEPI20 + +#if !defined(GPIO_TFT_DATA_CONTROL) +#define GPIO_TFT_DATA_CONTROL 25 +#endif + +#if !defined(GPIO_TFT_BACKLIGHT) +#define GPIO_TFT_BACKLIGHT 24 +#endif + +#if !defined(GPIO_TFT_RESET_PIN) +#define GPIO_TFT_RESET_PIN 27 +#endif + +#endif \ No newline at end of file