Skip to content

Commit f119501

Browse files
Fix Fri3dBadge_Adafruit_ST7789 old code and wrong method use
1 parent a527c93 commit f119501

File tree

3 files changed

+9
-33
lines changed

3 files changed

+9
-33
lines changed

libraries/Fri3dBadge/examples/Adafruit_ST7789/graphicstest_st7789/graphicstest_st7789.ino

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,6 @@
3333
#include <SPI.h>
3434
#include <Fri3dBadge_Adafruit_ST7789.h>
3535

36-
#if defined(ARDUINO_FEATHER_ESP32) // Feather Huzzah32
37-
#define TFT_CS 14
38-
#define TFT_RST 15
39-
#define TFT_DC 32
40-
41-
#elif defined(ESP8266)
42-
#define TFT_CS 4
43-
#define TFT_RST 16
44-
#define TFT_DC 5
45-
46-
#else
47-
// For the breakout board, you can use any 2 or 3 pins.
48-
// These pins will also work for the 1.8" TFT shield.
49-
#define TFT_CS 10
50-
#define TFT_RST 9 // Or set to -1 and connect to Arduino RESET pin
51-
#define TFT_DC 8
52-
#endif
53-
5436
// OPTION 1 (recommended) is to use the HARDWARE SPI pins, which are unique
5537
// to each board and not reassignable. For Arduino Uno: MOSI = pin 11 and
5638
// SCLK = pin 13. This is the fastest mode of operation and is required if
@@ -73,7 +55,7 @@ void setup(void) {
7355
Serial.print(F("Hello! ST77xx TFT Test"));
7456

7557
// Use this initializer (uncomment) if using a 1.3" or 1.54" 240x240 TFT:
76-
tft.init(240, 240); // Init ST7789 240x240
58+
tft.init(X_LCD_HEIGHT, X_LCD_WIDTH); // Init ST7789 240x240
7759

7860
// OR use this initializer (uncomment) if using a 1.69" 280x240 TFT:
7961
//tft.init(240, 280); // Init ST7789 280x240
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
#include <Fri3dBadge_Adafruit_ST7789.h>
22

3-
Fri3dBadge_Adafruit_ST7789::Fri3dBadge_Adafruit_ST7789() : Adafruit_ST7789(X_LCD_CS, X_LCD_DC, X_LCD_MOSI, X_LCD_CLK, X_LCD_RST);
3+
Fri3dBadge_Adafruit_ST7789::Fri3dBadge_Adafruit_ST7789() : Adafruit_ST7789(X_LCD_CS, X_LCD_DC, X_LCD_MOSI, X_LCD_CLK, X_LCD_RST)
44
{
55

66
}
77

8-
void Fri3dBadge_Adafruit_ST7789::begin(uint32_t freq)
8+
void Fri3dBadge_Adafruit_ST7789::init()
99
{
1010
// Call the parent class's begin method to initialize the display
11-
Adafruit_ST7789::begin(freq);
12-
setRotation(1);
11+
Adafruit_ST7789::init(X_LCD_WIDTH, X_LCD_HEIGHT);
1312
}

libraries/Fri3dBadge/src/Fri3dBadge_Adafruit_ST7789.h

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
1-
#ifndef Fri3dBadge_TFT_h
2-
#define Fri3dBadge_TFT_h
1+
#ifndef Fri3dBadge_Adafruit_ST7789_h
2+
#define Fri3dBadge_Adafruit_ST7789_h
33

44
#include <Adafruit_GFX.h> // Core graphics library
55
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
66
#include <SPI.h>
77

8-
#define BADGE2020_TFT_CS 5
9-
#define BADGE2020_TFT_RST -1
10-
#define BADGE2020_TFT_DC 33
11-
12-
#define BADGE2020_ACC_ADDRESS 0x18
13-
#define BADGE2020_ACC_CTRL_REG5 0x25
14-
158
class Fri3dBadge_Adafruit_ST7789 : public Adafruit_ST7789 {
169
public:
17-
Fri3dBadge_TFT();
10+
Fri3dBadge_Adafruit_ST7789();
11+
12+
void init();
1813
private:
1914

2015
};

0 commit comments

Comments
 (0)