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

Add support for Pirate Audio ST7789 HAT #203

Merged
merged 1 commit into from
Mar 28, 2021
Merged
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(PIRATE_AUDIO_ST7789_HAT)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DST7789 -DPIRATE_AUDIO_ST7789_HAT")
message(STATUS "Targeting Pirate Audio 240x240 1.3inch IPS LCD Hat with ST7789 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 @@ -61,6 +61,7 @@ The following LCD displays have been tested:
- [Arduino A000096 1.77" 160x128 LCD Screen](https://store.arduino.cc/arduino-lcd-screen) with ST7735R controller
- [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
- [Pirate Audio 240x240, 1.3inch IPS LCD display HAT for Raspberry Pi](https://shop.pimoroni.com/collections/pirate-audio) 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 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
Expand Down Expand Up @@ -115,6 +116,7 @@ When using one of the displays that stack on top of the Pi that are already reco
- `-DFREEPLAYTECH_WAVESHARE32B=ON`: If you are running on the [Freeplay CM3 or Zero](https://www.freeplaytech.com/product/freeplay-cm3-diy-kit/) device, pass this flag. (this is not a hat, but still a preconfigured pin assignment)
- `-DWAVESHARE35B_ILI9486=ON`: If specified, targets a [Waveshare 3.5" 480x320 ILI9486](https://www.amazon.co.uk/dp/B01N48NOXI/ref=pe_3187911_185740111_TE_item) display.
- `-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.
- `-DPIRATE_AUDIO_ST7789_HAT=ON`: If specified, targets a [Pirate Audio 240x240, 1.3inch IPS LCD display HAT for Raspberry Pi](https://shop.pimoroni.com/collections/pirate-audio) with ST7789 display controller
- `-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.
- `-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.
Expand Down
19 changes: 19 additions & 0 deletions pirate_audio_st7789_hat.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma once

// Data specific to Pirate Audio series 240x240, 1.3inch IPS LCD ST7789 hat, https://shop.pimoroni.com/collections/pirate-audio
#ifdef PIRATE_AUDIO_ST7789_HAT

#if !defined(GPIO_TFT_DATA_CONTROL)
#define GPIO_TFT_DATA_CONTROL 9
#endif

#if !defined(GPIO_TFT_BACKLIGHT)
#define GPIO_TFT_BACKLIGHT 13
#endif

#define DISPLAY_USES_CS1

// CS1 line is for the LCD
#define DISPLAY_SPI_DRIVE_SETTINGS (1)

#endif
4 changes: 4 additions & 0 deletions spi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,11 @@ int InitSPI()
#ifdef GPIO_TFT_DATA_CONTROL
SET_GPIO_MODE(GPIO_TFT_DATA_CONTROL, 0x01); // Data/Control pin to output (0x01)
#endif
// The Pirate Audio hat ST7789 based display has Data/Control on the MISO pin, so only initialize the pin as MISO if the
// Data/Control pin does not use it.
#if !defined(GPIO_TFT_DATA_CONTROL) || GPIO_TFT_DATA_CONTROL != GPIO_SPI0_MISO
SET_GPIO_MODE(GPIO_SPI0_MISO, 0x04);
#endif
SET_GPIO_MODE(GPIO_SPI0_MOSI, 0x04);
SET_GPIO_MODE(GPIO_SPI0_CLK, 0x04);

Expand Down
2 changes: 2 additions & 0 deletions st7735r.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
#include "waveshare_st7789vw_hat.h"
#elif defined(WAVESHARE_ST7735S_HAT)
#include "waveshare_st7735s_hat.h"
#elif defined(PIRATE_AUDIO_ST7789_HAT)
#include "pirate_audio_st7789_hat.h"
#endif

#define InitSPIDisplay InitST7735R
Expand Down