Skip to content
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ doxygen_sqlite3.db
html
/.vs
*.DS_Store
.vscode/
build/
.vs/
.pio/
33 changes: 33 additions & 0 deletions Adafruit_ST7789.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,30 @@ Adafruit_ST7789::Adafruit_ST7789(SPIClass *spiClass, int8_t cs, int8_t dc,
: Adafruit_ST77xx(240, 320, spiClass, cs, dc, rst) {}
#endif // end !ESP8266

#if defined(ARDUINO_ARDUINO_NESSO_N1)
Adafruit_ST7789::Adafruit_ST7789(int8_t cs, ExpanderPin *dc, ExpanderPin *rst)
: Adafruit_ST77xx(240, 320, cs, dc, rst) {}

Adafruit_ST7789::Adafruit_ST7789(int8_t cs, int8_t dc, ExpanderPin *rst)
: Adafruit_ST77xx(240, 320, cs, dc, rst) {}

Adafruit_ST7789::Adafruit_ST7789(ExpanderPin *cs, ExpanderPin *dc,
ExpanderPin *rst)
: Adafruit_ST77xx(240, 320, cs, dc, rst) {}

Adafruit_ST7789::Adafruit_ST7789(SPIClass *spiClass, int8_t cs, int8_t dc,
ExpanderPin *rst)
: Adafruit_ST77xx(240, 320, spiClass, cs, dc, rst) {}

Adafruit_ST7789::Adafruit_ST7789(SPIClass *spiClass, int8_t cs, ExpanderPin *dc,
ExpanderPin *rst)
: Adafruit_ST77xx(240, 320, spiClass, cs, dc, rst) {}

Adafruit_ST7789::Adafruit_ST7789(SPIClass *spiClass, ExpanderPin *cs,
ExpanderPin *dc, ExpanderPin *rst)
: Adafruit_ST77xx(240, 320, spiClass, cs, dc, rst) {}
#endif

// SCREEN INITIALIZATION ***************************************************

// Rather than a bazillion writecommand() and writedata() calls, screen
Expand Down Expand Up @@ -102,6 +126,15 @@ void Adafruit_ST7789::init(uint16_t width, uint16_t height, uint8_t mode) {
// case-by-case basis.)

commonInit(NULL);

#if defined(ARDUINO_ARDUINO_NESSO_N1)
if (width == 135 && height == 240 && _rstExp != nullptr) {
_rowstart = 40;
_rowstart2 = 40;
_colstart = 53;
_colstart2 = 52;
} else
#endif
if (width == 240 && height == 240) {
// 1.3", 1.54" displays (right justified)
_rowstart = (320 - height);
Expand Down
34 changes: 24 additions & 10 deletions Adafruit_ST7789.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,37 @@
#define _ADAFRUIT_ST7789H_

#include "Adafruit_ST77xx.h"
// extern class ExpanderPin;
Copy link
Member Author

Choose a reason for hiding this comment

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

remove


/// Subclass of ST77XX type display for ST7789 TFT Driver
class Adafruit_ST7789 : public Adafruit_ST77xx {
public:
public:
Adafruit_ST7789(int8_t cs, int8_t dc, int8_t mosi, int8_t sclk,
int8_t rst = -1);
Adafruit_ST7789(int8_t cs, int8_t dc, int8_t rst);
#if !defined(ESP8266)
Adafruit_ST7789(SPIClass *spiClass, int8_t cs, int8_t dc, int8_t rst);
#endif // end !ESP8266
int8_t rst = -1);
Adafruit_ST7789(int8_t cs, int8_t dc, int8_t rst);
#if !defined(ESP8266)
Adafruit_ST7789(SPIClass *spiClass, int8_t cs, int8_t dc, int8_t rst);
#endif // end !ESP8266
#if defined(ARDUINO_ARDUINO_NESSO_N1)
Adafruit_ST7789(int8_t cs, ExpanderPin *dc, ExpanderPin *rst = NULL);
Adafruit_ST7789(int8_t cs, int8_t dc, ExpanderPin *rst = NULL);
Adafruit_ST7789(ExpanderPin *cs, ExpanderPin *dc, ExpanderPin *rst = NULL);
Adafruit_ST7789(SPIClass *spiClass, int8_t cs, int8_t dc, ExpanderPin *rst);
Adafruit_ST7789(SPIClass *spiClass, int8_t cs, ExpanderPin *dc, ExpanderPin *rst);
Adafruit_ST7789(SPIClass *spiClass, ExpanderPin *cs, ExpanderPin *dc, ExpanderPin *rst);
#endif

void setRotation(uint8_t m);
void init(uint16_t width, uint16_t height, uint8_t spiMode = SPI_MODE0);
void setRotation(uint8_t m);
void init(uint16_t width, uint16_t height, uint8_t spiMode = SPI_MODE0);

protected:
uint8_t _colstart2 = 0, ///< Offset from the right
_rowstart2 = 0; ///< Offset from the bottom
uint8_t _colstart2 = 0, ///< Offset from the right
_rowstart2 = 0; ///< Offset from the bottom
#if defined(ARDUINO_ARDUINO_NESSO_N1)
ExpanderPin *cs = nullptr;
ExpanderPin *dc = nullptr;
ExpanderPin *rst = nullptr;
#endif

private:
uint16_t windowWidth;
Expand Down
27 changes: 27 additions & 0 deletions Adafruit_ST77xx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,33 @@ Adafruit_ST77xx::Adafruit_ST77xx(uint16_t w, uint16_t h, SPIClass *spiClass,
: Adafruit_SPITFT(w, h, spiClass, cs, dc, rst) {}
#endif // end !ESP8266

#if defined(ARDUINO_ARDUINO_NESSO_N1)
Adafruit_ST77xx::Adafruit_ST77xx(uint16_t w, uint16_t h, SPIClass *spiClass,
int8_t cs, ExpanderPin *dc, ExpanderPin *rst)
: Adafruit_SPITFT(w, h, spiClass, cs, dc, rst) {}

Adafruit_ST77xx::Adafruit_ST77xx(uint16_t w, uint16_t h, SPIClass *spiClass,
int8_t cs, int8_t dc, ExpanderPin *rst)
: Adafruit_SPITFT(w, h, spiClass, cs, dc, rst) {}

Adafruit_ST77xx::Adafruit_ST77xx(uint16_t w, uint16_t h, SPIClass *spiClass,
ExpanderPin *cs, ExpanderPin *dc,
ExpanderPin *rst)
: Adafruit_SPITFT(w, h, spiClass, cs, dc, rst) {}

Adafruit_ST77xx::Adafruit_ST77xx(uint16_t w, uint16_t h, int8_t cs,
ExpanderPin *dc, ExpanderPin *rst)
: Adafruit_SPITFT(w, h, cs, dc, rst) {}

Adafruit_ST77xx::Adafruit_ST77xx(uint16_t w, uint16_t h, int8_t cs, int8_t dc,
ExpanderPin *rst)
: Adafruit_SPITFT(w, h, cs, dc, rst) {}

Adafruit_ST77xx::Adafruit_ST77xx(uint16_t w, uint16_t h, ExpanderPin *cs,
ExpanderPin *dc, ExpanderPin *rst)
: Adafruit_SPITFT(w, h, cs, dc, rst) {}
#endif

/**************************************************************************/
/*!
@brief Companion code to the initiliazation tables. Reads and issues
Expand Down
49 changes: 32 additions & 17 deletions Adafruit_ST77xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,19 @@
#ifndef _ADAFRUIT_ST77XXH_
#define _ADAFRUIT_ST77XXH_

#include "Arduino.h"
#include "Print.h"
#include <Adafruit_GFX.h>
#include <Adafruit_SPITFT.h>
#include <Adafruit_SPITFT_Macros.h>

#define ST7735_TFTWIDTH_128 128 // for 1.44 and mini
#define ST7735_TFTWIDTH_80 80 // for mini
#define ST7735_TFTHEIGHT_128 128 // for 1.44" display
#define ST7735_TFTHEIGHT_160 160 // for 1.8" and mini display
#include "Arduino.h"
#include "Print.h"

#define ST7735_TFTWIDTH_128 128 // for 1.44 and mini
#define ST7735_TFTWIDTH_80 80 // for mini
#define ST7735_TFTHEIGHT_128 128 // for 1.44" display
#define ST7735_TFTHEIGHT_160 160 // for 1.8" and mini display

#define ST_CMD_DELAY 0x80 // special signifier for command lists
#define ST_CMD_DELAY 0x80 // special signifier for command lists

#define ST77XX_NOP 0x00
#define ST77XX_SWRESET 0x01
Expand Down Expand Up @@ -87,31 +88,45 @@

/// Subclass of SPITFT for ST77xx displays (lots in common!)
class Adafruit_ST77xx : public Adafruit_SPITFT {
public:
public:
Adafruit_ST77xx(uint16_t w, uint16_t h, int8_t _CS, int8_t _DC, int8_t _MOSI,
int8_t _SCLK, int8_t _RST = -1, int8_t _MISO = -1);
Adafruit_ST77xx(uint16_t w, uint16_t h, int8_t CS, int8_t RS,
int8_t RST = -1);
#if !defined(ESP8266)
Adafruit_ST77xx(uint16_t w, uint16_t h, SPIClass *spiClass, int8_t CS,
Adafruit_ST77xx(uint16_t w, uint16_t h, SPIClass* spiClass, int8_t CS,
int8_t RS, int8_t RST = -1);
#endif // end !ESP8266
#endif // end !ESP8266
#if defined(ARDUINO_ARDUINO_NESSO_N1)
Adafruit_ST77xx(uint16_t w, uint16_t h, SPIClass* spiClass, int8_t cs,
ExpanderPin* dc, ExpanderPin* rst = NULL);
Adafruit_ST77xx(uint16_t w, uint16_t h, SPIClass* spiClass, int8_t cs,
int8_t dc, ExpanderPin* rst = NULL);
Adafruit_ST77xx(uint16_t w, uint16_t h, SPIClass* spiClass, ExpanderPin* cs,
ExpanderPin* dc, ExpanderPin* rst = NULL);
Adafruit_ST77xx(uint16_t w, uint16_t h, int8_t cs, ExpanderPin* dc,
ExpanderPin* rst = NULL);
Adafruit_ST77xx(uint16_t w, uint16_t h, int8_t cs, int8_t dc,
ExpanderPin* rst = NULL);
Adafruit_ST77xx(uint16_t w, uint16_t h, ExpanderPin* cs, ExpanderPin* dc,
ExpanderPin* rst = NULL);
#endif

void setAddrWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
void setRotation(uint8_t r);
void enableDisplay(boolean enable);
void enableTearing(boolean enable);
void enableSleep(boolean enable);

protected:
uint8_t _colstart = 0, ///< Some displays need this changed to offset
_rowstart = 0, ///< Some displays need this changed to offset
spiMode = SPI_MODE0; ///< Certain display needs MODE3 instead
protected:
uint8_t _colstart = 0, ///< Some displays need this changed to offset
_rowstart = 0, ///< Some displays need this changed to offset
spiMode = SPI_MODE0; ///< Certain display needs MODE3 instead

void begin(uint32_t freq = 0);
void commonInit(const uint8_t *cmdList);
void displayInit(const uint8_t *addr);
void commonInit(const uint8_t* cmdList);
void displayInit(const uint8_t* addr);
void setColRowStart(int8_t col, int8_t row);
};

#endif // _ADAFRUIT_ST77XXH_
#endif // _ADAFRUIT_ST77XXH_
Empty file.
Loading
Loading