mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2026-08-18 18:32:30 +02:00
Modify TFT display initialisiation
This commit is contained in:
@@ -94,16 +94,13 @@ class LGFX : public lgfx::LGFX_Device {
|
|||||||
public:
|
public:
|
||||||
lgfx::Bus_SPI _bus_instance;
|
lgfx::Bus_SPI _bus_instance;
|
||||||
|
|
||||||
|
#ifdef TFT_320x480_ST7796
|
||||||
LGFX(void) {
|
LGFX(void) {
|
||||||
{
|
{
|
||||||
auto cfg = _bus_instance.config();
|
auto cfg = _bus_instance.config();
|
||||||
cfg.spi_host = SPI2_HOST;
|
cfg.spi_host = SPI2_HOST;
|
||||||
cfg.spi_mode = 0;
|
cfg.spi_mode = 0;
|
||||||
#if defined(TFT_320x480_ILI9488)
|
cfg.freq_write = 80000000; // High speed ST7796
|
||||||
cfg.freq_write = 40000000;
|
|
||||||
#else
|
|
||||||
cfg.freq_write = 80000000;
|
|
||||||
#endif
|
|
||||||
cfg.freq_read = 16000000;
|
cfg.freq_read = 16000000;
|
||||||
cfg.pin_sclk = OBP_SPI_CLK;
|
cfg.pin_sclk = OBP_SPI_CLK;
|
||||||
cfg.pin_mosi = OBP_SPI_DIN;
|
cfg.pin_mosi = OBP_SPI_DIN;
|
||||||
@@ -121,7 +118,7 @@ public:
|
|||||||
cfg.panel_height = 480; // Native hight resolution
|
cfg.panel_height = 480; // Native hight resolution
|
||||||
cfg.offset_x = 0; // No panel offset: full framebuffer mapping
|
cfg.offset_x = 0; // No panel offset: full framebuffer mapping
|
||||||
cfg.offset_y = 0; // No panel offset: full framebuffer mapping
|
cfg.offset_y = 0; // No panel offset: full framebuffer mapping
|
||||||
cfg.offset_rotation = 3; // Rotate display content conter clock wise 90 deg
|
cfg.offset_rotation = 3; // Rotate display content conter clock wise 90 deg ST7796
|
||||||
cfg.dummy_read_pixel = 8;
|
cfg.dummy_read_pixel = 8;
|
||||||
cfg.dummy_read_bits = 1;
|
cfg.dummy_read_bits = 1;
|
||||||
cfg.memory_width = 320;
|
cfg.memory_width = 320;
|
||||||
@@ -139,6 +136,51 @@ public:
|
|||||||
// Match Adafruit GFX cursor semantics: y coordinate is text baseline.
|
// Match Adafruit GFX cursor semantics: y coordinate is text baseline.
|
||||||
setTextDatum(textdatum_t::baseline_left);
|
setTextDatum(textdatum_t::baseline_left);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef TFT_320x480_ILI9488
|
||||||
|
LGFX(void) {
|
||||||
|
{
|
||||||
|
auto cfg = _bus_instance.config();
|
||||||
|
cfg.spi_host = SPI2_HOST;
|
||||||
|
cfg.spi_mode = 0;
|
||||||
|
cfg.freq_write = 40000000; // Slow speed ILI9488
|
||||||
|
cfg.freq_read = 16000000;
|
||||||
|
cfg.pin_sclk = OBP_SPI_CLK;
|
||||||
|
cfg.pin_mosi = OBP_SPI_DIN;
|
||||||
|
cfg.pin_miso = -1;
|
||||||
|
cfg.pin_dc = OBP_SPI_DC;
|
||||||
|
_bus_instance.config(cfg);
|
||||||
|
_panel_instance.setBus(&_bus_instance);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto cfg = _panel_instance.config();
|
||||||
|
cfg.pin_cs = OBP_SPI_CS;
|
||||||
|
cfg.pin_rst = OBP_SPI_RST;
|
||||||
|
cfg.pin_busy = -1;
|
||||||
|
cfg.panel_width = 320; // Native width resolution
|
||||||
|
cfg.panel_height = 480; // Native hight resolution
|
||||||
|
cfg.offset_x = 0; // No panel offset: full framebuffer mapping
|
||||||
|
cfg.offset_y = 0; // No panel offset: full framebuffer mapping
|
||||||
|
cfg.offset_rotation = 1; // Rotate display content clock wise 90 deg ILI9488
|
||||||
|
cfg.dummy_read_pixel = 8;
|
||||||
|
cfg.dummy_read_bits = 1;
|
||||||
|
cfg.memory_width = 320;
|
||||||
|
cfg.memory_height = 480;
|
||||||
|
// cfg.pwm_control not available in this LovyanGFX version
|
||||||
|
cfg.invert = false;
|
||||||
|
cfg.rgb_order = false;
|
||||||
|
cfg.dlen_16bit = false;
|
||||||
|
cfg.bus_shared = true;
|
||||||
|
_panel_instance.config(cfg);
|
||||||
|
}
|
||||||
|
// No dedicated TFT PWM backlight pin configured on this board.
|
||||||
|
// Keep backlight handling outside LovyanGFX to avoid LEDC init on invalid GPIO.
|
||||||
|
setPanel(&_panel_instance);
|
||||||
|
// Match Adafruit GFX cursor semantics: y coordinate is text baseline.
|
||||||
|
setTextDatum(textdatum_t::baseline_left);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// compatibility helpers --------------------------------------------------
|
// compatibility helpers --------------------------------------------------
|
||||||
using lgfx::LGFX_Device::setFont;
|
using lgfx::LGFX_Device::setFont;
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ build_flags=
|
|||||||
# -D HARDWARE_V20 #OBP60 hardware revision V2.0
|
# -D HARDWARE_V20 #OBP60 hardware revision V2.0
|
||||||
-D HARDWARE_V21 #OBP60 hardware revision V2.1
|
-D HARDWARE_V21 #OBP60 hardware revision V2.1
|
||||||
-D TFT_DISPLAY #Enable TFT LCD display path (instead of E-Ink)
|
-D TFT_DISPLAY #Enable TFT LCD display path (instead of E-Ink)
|
||||||
-D TFT_320x480_ST7796 #TFT panel type: ST7796 (320x480)
|
# -D TFT_320x480_ST7796 #TFT panel type: ST7796 (320x480, 80 MHz), best performance
|
||||||
# -D TFT_320x480_ILI9488 #TFT panel type: ILI9488 (320x480), use instead of ST7796
|
-D TFT_320x480_ILI9488 #TFT panel type: ILI9488 (320x480, 40 MHz), lower performance
|
||||||
-D OBP_TFT_ENABLE_SCALING=1 #TFT scaling on/off (1=scale to max Y=320, 0=no scaling)
|
-D OBP_TFT_ENABLE_SCALING=1 #TFT scaling on/off (1=scale to max Y=320, 0=no scaling)
|
||||||
-D OBP_TFT_SCALE_ANTIALIAS=1 #Antialiasing for TFT scaling (1=on, 0=off)
|
-D OBP_TFT_SCALE_ANTIALIAS=1 #Antialiasing for TFT scaling (1=on, 0=off)
|
||||||
# -D ENABLE_PATCHES #enable patching of gateway code
|
# -D ENABLE_PATCHES #enable patching of gateway code
|
||||||
|
|||||||
Reference in New Issue
Block a user