Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for GamePi20 #198

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion st7735r.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This #if won't be entered with the GamePi, and neither will the two #elifs below, so won't this cause the #error Unknown display controller! line be taken?

Can you change this to

#if defined(WAVESHARE_GAMEPI20)
#define DISPLAY_NATIVE_WIDTH 240
#define DISPLAY_NATIVE_HEIGHT 320
#elif defined(ST7789) || defined(ST7789VW)
....

to follow the general flow of the size setup code here? (and drop the #define sizes in the changed block below?)

#define DISPLAY_NATIVE_WIDTH 240
#define DISPLAY_NATIVE_HEIGHT 240
#elif defined(ST7735R)
Expand All @@ -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
Expand Down
18 changes: 18 additions & 0 deletions waveshare_gamepi20.h
Original file line number Diff line number Diff line change
@@ -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