Build and deploy Docs site to GitHub Pages / github-pages (push) Canceled after 0s
PR Build Check / build (Heltec_v3_companion_radio_ble) (push) Canceled after 0s
PR Build Check / build (Heltec_v3_repeater) (push) Canceled after 0s
PR Build Check / build (Heltec_v3_room_server) (push) Canceled after 0s
PR Build Check / build (LilyGo_Tlora_C6_repeater_) (push) Canceled after 0s
PR Build Check / build (PicoW_repeater) (push) Canceled after 0s
PR Build Check / build (RAK_4631_companion_radio_ble) (push) Canceled after 0s
PR Build Check / build (RAK_4631_companion_radio_ethernet) (push) Canceled after 0s
PR Build Check / build (RAK_4631_repeater) (push) Canceled after 0s
PR Build Check / build (RAK_4631_repeater_ethernet) (push) Canceled after 0s
PR Build Check / build (RAK_4631_room_server) (push) Canceled after 0s
PR Build Check / build (RAK_4631_room_server_ethernet) (push) Canceled after 0s
PR Build Check / build (Tbeam_SX1276_repeater) (push) Canceled after 0s
PR Build Check / build (wio-e5-mini_repeater) (push) Canceled after 0s
PR Build Check / build (wio_wm1110_repeater) (push) Canceled after 0s
Run Unit Tests / test (push) Canceled after 0s
77 lines
2.1 KiB
C++
77 lines
2.1 KiB
C++
#pragma once
|
|
|
|
#include "DisplayDriver.h"
|
|
#include <Wire.h>
|
|
#include <SPI.h>
|
|
#include <Adafruit_GFX.h>
|
|
#include <Adafruit_ST7789.h>
|
|
#include <helpers/RefCountedDigitalPin.h>
|
|
|
|
class ST7789LCDDisplay : public DisplayDriver {
|
|
#if defined(LILYGO_TDECK) || defined(HELTEC_LORA_V4_TFT) || defined(HELTEC_V4_R8_TFT)
|
|
SPIClass displaySPI;
|
|
#endif
|
|
Adafruit_ST7789 display;
|
|
bool _isOn;
|
|
uint16_t _color;
|
|
RefCountedDigitalPin* _peripher_power;
|
|
#ifdef OLED_RU
|
|
uint8_t _size;
|
|
bool _ru_font;
|
|
#endif
|
|
|
|
bool i2c_probe(TwoWire& wire, uint8_t addr);
|
|
public:
|
|
#ifdef USE_PIN_TFT
|
|
ST7789LCDDisplay(RefCountedDigitalPin* peripher_power=NULL) : DisplayDriver(128, 64),
|
|
display(PIN_TFT_CS, PIN_TFT_DC, PIN_TFT_SDA, PIN_TFT_SCL, PIN_TFT_RST),
|
|
_peripher_power(peripher_power)
|
|
{
|
|
_isOn = false;
|
|
#ifdef OLED_RU
|
|
_size = 1;
|
|
_ru_font = false;
|
|
#endif
|
|
}
|
|
#elif defined(LILYGO_TDECK) || defined(HELTEC_LORA_V4_TFT) || defined(HELTEC_V4_R8_TFT)
|
|
ST7789LCDDisplay(RefCountedDigitalPin* peripher_power=NULL) : DisplayDriver(128, 64),
|
|
displaySPI(HSPI),
|
|
display(&displaySPI, PIN_TFT_CS, PIN_TFT_DC, PIN_TFT_RST),
|
|
_peripher_power(peripher_power)
|
|
{
|
|
_isOn = false;
|
|
#ifdef OLED_RU
|
|
_size = 1;
|
|
_ru_font = false;
|
|
#endif
|
|
}
|
|
#else
|
|
ST7789LCDDisplay(RefCountedDigitalPin* peripher_power=NULL) : DisplayDriver(128, 64),
|
|
display(&SPI, PIN_TFT_CS, PIN_TFT_DC, PIN_TFT_RST),
|
|
_peripher_power(peripher_power)
|
|
{
|
|
_isOn = false;
|
|
#ifdef OLED_RU
|
|
_size = 1;
|
|
_ru_font = false;
|
|
#endif
|
|
}
|
|
#endif
|
|
bool begin();
|
|
|
|
bool isOn() override { return _isOn; }
|
|
void turnOn() override;
|
|
void turnOff() override;
|
|
void clear() override;
|
|
void startFrame(ColorVal bkg = UIColor::window_bkg) override;
|
|
void setTextSize(int sz) override;
|
|
void setColor(ColorVal c) override;
|
|
void setCursor(int x, int y) override;
|
|
void print(const char* str) override;
|
|
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;
|
|
uint16_t getTextWidth(const char* str) override;
|
|
void endFrame() override;
|
|
};
|