adafruit / Adafruit-ST7735-Library

This is a library for the Adafruit 1.8" SPI display http://www.adafruit.com/products/358 and http://www.adafruit.com/products/618
https://learn.adafruit.com/1-8-tft-display
547 stars 303 forks source link

Using with RP2040-PiZero and 1.3inch display HAT #198

Open hasaranga opened 2 months ago

hasaranga commented 2 months ago

I was able to use this library with RP2040-PiZero board and 1.3inch display HAT. For anyone trying to use this library, you will need to configure SPI1 pins manually.

Board: https://www.waveshare.com/wiki/RP2040-PiZero Display: https://www.waveshare.com/1.3inch-lcd-hat.htm

#include <Adafruit_GFX.h>
#include <Adafruit_ST7789.h>
#include <SPI.h>

#define TFT_CS  8
#define TFT_RST 27
#define TFT_DC  25
#define TFT_MOSI 11
#define TFT_SCLK 10

Adafruit_ST7789 tft = Adafruit_ST7789(&SPI1, TFT_CS, TFT_DC, TFT_RST);

void setup(void) {
  gpio_set_function(TFT_MOSI, GPIO_FUNC_SPI);
  gpio_set_function(TFT_SCLK, GPIO_FUNC_SPI);

  tft.init(240, 240); 
  tft.setRotation(3);

  Serial.println(F("Initialized"));
}