2025-04-10 16:24:17 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "DisplayDriver.h"
|
|
|
|
|
#include <Wire.h>
|
|
|
|
|
#include <SPI.h>
|
|
|
|
|
#include <Adafruit_GFX.h>
|
2025-04-24 22:37:06 +02:00
|
|
|
#include <ST7789Spi.h>
|
2025-04-10 16:24:17 +02:00
|
|
|
|
|
|
|
|
class ST7789Display : public DisplayDriver {
|
2025-04-24 22:37:06 +02:00
|
|
|
ST7789Spi display;
|
2025-04-10 16:24:17 +02:00
|
|
|
bool _isOn;
|
2025-04-11 22:23:47 +02:00
|
|
|
uint16_t _color;
|
2025-04-24 22:37:06 +02:00
|
|
|
int _x=0, _y=0;
|
2025-04-10 16:24:17 +02:00
|
|
|
|
|
|
|
|
bool i2c_probe(TwoWire& wire, uint8_t addr);
|
|
|
|
|
public:
|
2025-05-05 15:54:31 +10:00
|
|
|
ST7789Display() : DisplayDriver(128, 64), display(&SPI1, PIN_TFT_RST, PIN_TFT_DC, PIN_TFT_CS, GEOMETRY_RAWMODE, 240, 135) {_isOn = false;}
|
2025-04-24 22:37:06 +02:00
|
|
|
|
2025-04-10 16:24:17 +02:00
|
|
|
bool begin();
|
|
|
|
|
|
|
|
|
|
bool isOn() override { return _isOn; }
|
|
|
|
|
void turnOn() override;
|
|
|
|
|
void turnOff() override;
|
|
|
|
|
void clear() override;
|
|
|
|
|
void startFrame(Color bkg = DARK) override;
|
|
|
|
|
void setTextSize(int sz) override;
|
|
|
|
|
void setColor(Color c) override;
|
|
|
|
|
void setCursor(int x, int y) override;
|
|
|
|
|
void print(const char* str) override;
|
2025-08-08 20:01:31 +10:00
|
|
|
void printWordWrap(const char* str, int max_width) override;
|
2025-04-10 16:24:17 +02:00
|
|
|
void fillRect(int x, int y, int w, int h) override;
|
|
|
|
|
void drawRect(int x, int y, int w, int h) override;
|
|
|
|
|
void drawXbm(int x, int y, const uint8_t* bits, int w, int h) override;
|
2025-05-04 18:17:18 -07:00
|
|
|
uint16_t getTextWidth(const char* str) override;
|
2025-04-10 16:24:17 +02:00
|
|
|
void endFrame() override;
|
|
|
|
|
};
|