fix(boards): initialize Heltec V4 R8 TFT
This commit is contained in:
1 parent
104143bba6
commit
910e6ab03d
3 files changed
+28
-7
No files matched your search
@@ -4,10 +4,6 @@
|
||||
#define PIN_TFT_MISO -1
|
||||
#endif
|
||||
|
||||
#ifndef PIN_TFT_LEDA_CTL_ACTIVE
|
||||
#define PIN_TFT_LEDA_CTL_ACTIVE HIGH
|
||||
#endif
|
||||
|
||||
#ifndef DISPLAY_ROTATION
|
||||
#define DISPLAY_ROTATION 3
|
||||
#endif
|
||||
@@ -42,12 +38,18 @@ bool ST7789LCDDisplay::begin() {
|
||||
if (!_isOn) {
|
||||
if (_peripher_power) {
|
||||
_peripher_power->claim();
|
||||
#ifdef HELTEC_V4_R8_TFT
|
||||
delay(100);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (PIN_TFT_LEDA_CTL != -1) {
|
||||
pinMode(PIN_TFT_LEDA_CTL, OUTPUT);
|
||||
#ifdef HELTEC_V4_R8_TFT
|
||||
digitalWrite(PIN_TFT_LEDA_CTL, !PIN_TFT_LEDA_CTL_ACTIVE);
|
||||
#else
|
||||
digitalWrite(PIN_TFT_LEDA_CTL, HIGH);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Im not sure if this is just a t-deck problem or not, if your display is slow try this.
|
||||
@@ -65,9 +67,11 @@ bool ST7789LCDDisplay::begin() {
|
||||
display.setTextSize(2 * DISPLAY_SCALE_X);
|
||||
display.cp437(true); // Use full 256 char 'Code Page 437' font
|
||||
|
||||
#ifdef HELTEC_V4_R8_TFT
|
||||
if (PIN_TFT_LEDA_CTL != -1) {
|
||||
digitalWrite(PIN_TFT_LEDA_CTL, PIN_TFT_LEDA_CTL_ACTIVE);
|
||||
}
|
||||
#endif
|
||||
|
||||
_isOn = true;
|
||||
}
|
||||
@@ -82,11 +86,20 @@ void ST7789LCDDisplay::turnOn() {
|
||||
void ST7789LCDDisplay::turnOff() {
|
||||
if (_isOn) {
|
||||
if (PIN_TFT_LEDA_CTL != -1) {
|
||||
#ifdef HELTEC_V4_R8_TFT
|
||||
digitalWrite(PIN_TFT_LEDA_CTL, !PIN_TFT_LEDA_CTL_ACTIVE);
|
||||
#else
|
||||
digitalWrite(PIN_TFT_LEDA_CTL, HIGH);
|
||||
#endif
|
||||
}
|
||||
if (PIN_TFT_RST != -1) {
|
||||
digitalWrite(PIN_TFT_RST, LOW);
|
||||
}
|
||||
#ifndef HELTEC_V4_R8_TFT
|
||||
if (PIN_TFT_LEDA_CTL != -1) {
|
||||
digitalWrite(PIN_TFT_LEDA_CTL, LOW);
|
||||
}
|
||||
#endif
|
||||
_isOn = false;
|
||||
|
||||
if (_peripher_power) _peripher_power->release();
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
#include "HeltecV4R8Board.h"
|
||||
|
||||
#if defined(HELTEC_V4_R8_TFT) && defined(DISPLAY_CLASS)
|
||||
#include <target.h>
|
||||
#endif
|
||||
|
||||
void HeltecV4R8Board::begin() {
|
||||
ESP32Board::begin();
|
||||
|
||||
@@ -8,8 +12,8 @@ void HeltecV4R8Board::begin() {
|
||||
|
||||
loRaFEMControl.init();
|
||||
|
||||
// Expansion Kit CHSC6X touch RST/INT are unwired. GPIO 21 is TFT RST
|
||||
// (PIN_TFT_RST), owned by ST7789LCDDisplay. Do not pulse it here.
|
||||
// GPIO 21 is shared by LCD_RST and TP_RST. Let ST7789LCDDisplay own the
|
||||
// reset sequence; no separate touch reset is needed.
|
||||
#ifdef PIN_TOUCH_RST
|
||||
pinMode(PIN_TOUCH_RST, OUTPUT);
|
||||
digitalWrite(PIN_TOUCH_RST, HIGH);
|
||||
@@ -42,6 +46,10 @@ void HeltecV4R8Board::onAfterTransmit(void) {
|
||||
}
|
||||
|
||||
void HeltecV4R8Board::enterDeepSleep(uint32_t secs, int pin_wake_btn) {
|
||||
#if defined(HELTEC_V4_R8_TFT) && defined(DISPLAY_CLASS)
|
||||
display.turnOff();
|
||||
#endif
|
||||
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
|
||||
|
||||
rtc_gpio_set_direction((gpio_num_t)P_LORA_DIO_1, RTC_GPIO_MODE_INPUT_ONLY);
|
||||
|
||||
@@ -68,7 +68,7 @@ build_flags =
|
||||
-D PIN_TFT_RST=21
|
||||
-D PIN_TFT_VDD_CTL=-1
|
||||
-D PIN_TFT_LEDA_CTL=44
|
||||
-D PIN_TFT_LEDA_CTL_ACTIVE=HIGH
|
||||
-D PIN_TFT_LEDA_CTL_ACTIVE=LOW
|
||||
-D PIN_TFT_CS=47
|
||||
-D PIN_TFT_DC=48
|
||||
-D PIN_TFT_SCL=16
|
||||
|
||||
Reference in new issue
Block a user