diff --git a/README.md b/README.md index 97f4c650..08e150fc 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ Currently, IceNav works with the following hardware setups and specs |:------------|:----------:|:---:|:----:|:-----:|:---------:|:---------------------------------| | ILI9488 [^3]| 320x480 | yes | --- | --- | XPT2046 | ```-D ILI9488_XPT2046_SPI = 1``` | | ILI9488 | 320x480 | yes | --- | --- | FT5x06 | ```-D ILI9488_FT5x06_SPI = 1 ``` | +| ILI9488 | 320x480 | --- | yes | --- | -------- | ```-D ILI9488_NOTOUCH_8B = 1 ``` | | ILI9488 | 320x480 | --- | --- | yes | FT5x06 | ```-D ILI9488_FT5x06_16B = 1``` | | ILI9341 | 320x240 | yes | --- | --- | XPT2046 | ```-D ILI9341_XPT2046_SPI = 1``` | diff --git a/include/hal.hpp b/include/hal.hpp index ccefa305..5ba2c51c 100644 --- a/include/hal.hpp +++ b/include/hal.hpp @@ -118,12 +118,16 @@ extern const bool TFT_INVERT = true; #endif /** - * @brief TFT 16 Bits parallel pin definition + * @brief TFT 8/16 Bits parallel pin definition * */ extern const uint8_t TFT_WR = 35; extern const uint8_t TFT_RD = 48; extern const uint8_t TFT_RS = 36; +extern const uint8_t TFT_RST = -1; +extern const uint8_t TFT_CS = 5; + +// 8 bit Mode extern const uint8_t TFT_D0 = 47; extern const uint8_t TFT_D1 = 21; extern const uint8_t TFT_D2 = 14; @@ -132,6 +136,8 @@ extern const uint8_t TFT_D4 = 12; extern const uint8_t TFT_D5 = 11; extern const uint8_t TFT_D6 = 10; extern const uint8_t TFT_D7 = 9; + +// Extra 16 bit Mode extern const uint8_t TFT_D8 = 3; extern const uint8_t TFT_D9 = 8; extern const uint8_t TFT_D10 = 16; diff --git a/lib/gui/src/settingsScr.cpp b/lib/gui/src/settingsScr.cpp index cf3ca0ae..8b80adff 100644 --- a/lib/gui/src/settingsScr.cpp +++ b/lib/gui/src/settingsScr.cpp @@ -111,6 +111,7 @@ void createSettingsScr() lv_obj_add_event_cb(btn, compassCalib, LV_EVENT_CLICKED, NULL); #endif + #ifdef TOUCH_INPUT // Touch Calibration btn = lv_btn_create(settingsButtons); lv_obj_set_size(btn, TFT_WIDTH - 30, 40 * scale); @@ -119,6 +120,7 @@ void createSettingsScr() lv_label_set_text_static(btnLabel, "Touch Calibration"); lv_obj_center(btnLabel); lv_obj_add_event_cb(btn, touchCalib, LV_EVENT_CLICKED, NULL); + #endif // Map Settings btn = lv_btn_create(settingsButtons); diff --git a/lib/lvgl/src/lvglSetup.cpp b/lib/lvgl/src/lvglSetup.cpp index 219b6918..da7aa60b 100644 --- a/lib/lvgl/src/lvglSetup.cpp +++ b/lib/lvgl/src/lvglSetup.cpp @@ -163,9 +163,11 @@ void initLVGL() #endif + #ifdef TOUCH_INPUT lv_indev_t *indev_drv = lv_indev_create(); lv_indev_set_type(indev_drv, LV_INDEV_TYPE_POINTER); lv_indev_set_read_cb(indev_drv, touchRead); + #endif modifyTheme(); diff --git a/lib/panel/ILI9341_XPT2046_SPI.hpp b/lib/panel/ILI9341_XPT2046_SPI.hpp index f6ce8c2c..ea23a6ac 100644 --- a/lib/panel/ILI9341_XPT2046_SPI.hpp +++ b/lib/panel/ILI9341_XPT2046_SPI.hpp @@ -11,6 +11,8 @@ #define LGFX_USE_V1 +#define TOUCH_INPUT + #include "LovyanGFX.hpp" extern const uint8_t TFT_SPI_SCLK; diff --git a/lib/panel/ILI9488_FT5x06_16B.hpp b/lib/panel/ILI9488_FT5x06_16B.hpp index b2ae4c44..500363d3 100644 --- a/lib/panel/ILI9488_FT5x06_16B.hpp +++ b/lib/panel/ILI9488_FT5x06_16B.hpp @@ -38,6 +38,7 @@ extern const uint8_t TFT_D14; extern const uint8_t TFT_D15; #define LARGE_SCREEN +#define TOUCH_INPUT class LGFX : public lgfx::LGFX_Device { diff --git a/lib/panel/ILI9488_FT5x06_SPI.hpp b/lib/panel/ILI9488_FT5x06_SPI.hpp index 657d504f..be600684 100644 --- a/lib/panel/ILI9488_FT5x06_SPI.hpp +++ b/lib/panel/ILI9488_FT5x06_SPI.hpp @@ -26,6 +26,7 @@ extern const uint8_t TCH_I2C_INT; extern const bool TFT_INVERT; #define LARGE_SCREEN +#define TOUCH_INPUT class LGFX : public lgfx::LGFX_Device { diff --git a/lib/panel/ILI9488_NOTOUCH_8B.hpp b/lib/panel/ILI9488_NOTOUCH_8B.hpp new file mode 100644 index 00000000..6acc7f68 --- /dev/null +++ b/lib/panel/ILI9488_NOTOUCH_8B.hpp @@ -0,0 +1,93 @@ +/** + * @file ILI9488_NOTOUCH_8B.hpp + * @author Jordi Gauchía (jgauchia@gmx.es) + * @brief LOVYANGFX TFT driver for ILI9488 8 Bits parallel Without Touch controller + * @version 0.1.8 + * @date 2024-06 + */ + +#ifndef ILI9488_NOTOUCH_8B_HPP +#define ILI9488_NOTOUCH_8B_HPP + +#define LGFX_USE_V1 + +#include + +extern const uint8_t TFT_WR; +extern const uint8_t TFT_RD; +extern const uint8_t TFT_RS; +extern const uint8_t TFT_RST; +extern const uint8_t TFT_CS; + +extern const uint8_t TFT_D0; +extern const uint8_t TFT_D1; +extern const uint8_t TFT_D2; +extern const uint8_t TFT_D3; +extern const uint8_t TFT_D4; +extern const uint8_t TFT_D5; +extern const uint8_t TFT_D6; +extern const uint8_t TFT_D7; + +#define LARGE_SCREEN + +class LGFX : public lgfx::LGFX_Device +{ + lgfx::Panel_ILI9488 _panel_instance; + lgfx::Bus_Parallel8 _bus_instance; + +public: + LGFX(void) + { + { + auto cfg = _bus_instance.config(); + + cfg.port = 0; + cfg.freq_write = 20000000; + cfg.pin_wr = TFT_WR; + cfg.pin_rd = TFT_RD; + cfg.pin_rs = TFT_RS; + + cfg.pin_d0 = TFT_D0; + cfg.pin_d1 = TFT_D1; + cfg.pin_d2 = TFT_D2; + cfg.pin_d3 = TFT_D3; + cfg.pin_d4 = TFT_D4; + cfg.pin_d5 = TFT_D5; + cfg.pin_d6 = TFT_D6; + cfg.pin_d7 = TFT_D7; + + _bus_instance.config(cfg); + _panel_instance.setBus(&_bus_instance); + } + + { + auto cfg = _panel_instance.config(); + + cfg.pin_cs = TFT_CS; + cfg.pin_rst = TFT_RST; + cfg.pin_busy = -1; + + cfg.memory_width = 320; + cfg.memory_height = 480; + cfg.panel_width = 320; + cfg.panel_height = 480; + cfg.offset_x = 0; + cfg.offset_y = 0; + cfg.offset_rotation = 0; + cfg.dummy_read_pixel = 8; + cfg.dummy_read_bits = 1; + cfg.readable = true; + cfg.invert = false; + cfg.rgb_order = false; + cfg.dlen_16bit = false; + cfg.bus_shared = true; + + _panel_instance.config(cfg); + } + + setPanel(&_panel_instance); + + } +}; + +#endif diff --git a/lib/panel/ILI9488_XPT2046_SPI.hpp b/lib/panel/ILI9488_XPT2046_SPI.hpp index 1341d206..4bfeb020 100644 --- a/lib/panel/ILI9488_XPT2046_SPI.hpp +++ b/lib/panel/ILI9488_XPT2046_SPI.hpp @@ -27,6 +27,7 @@ extern const uint8_t TCH_SPI_CS; extern const bool TFT_INVERT; #define LARGE_SCREEN +#define TOUCH_INPUT class LGFX : public lgfx::LGFX_Device { diff --git a/lib/tft/tft.cpp b/lib/tft/tft.cpp index 9940ceb6..ceb3522e 100644 --- a/lib/tft/tft.cpp +++ b/lib/tft/tft.cpp @@ -147,5 +147,7 @@ void initTFT() ledcSetup(0, 5000, 8); ledcAttachPin(TFT_BL, 0); ledcWrite(0, 255); +#ifdef TOUCH_INPUT touchCalibrate(); +#endif } diff --git a/lib/tft/tft.hpp b/lib/tft/tft.hpp index 1bb8d587..03308f51 100644 --- a/lib/tft/tft.hpp +++ b/lib/tft/tft.hpp @@ -30,6 +30,10 @@ #include "ILI9488_FT5x06_SPI.hpp" #endif +#ifdef ILI9488_NOTOUCH_8B +#include "ILI9488_NOTOUCH_8B.hpp" +#endif + #include extern TFT_eSPI tft; diff --git a/platformio.ini b/platformio.ini index 69429d26..388de437 100644 --- a/platformio.ini +++ b/platformio.ini @@ -16,7 +16,7 @@ default_envs = ESP32_N16R4 platform = espressif32 framework = arduino version = 0.1.8_dev -revision = 69 +revision = 70 monitor_speed = 115200 ;monitor_rts = 0 ;monitor_dtr = 0 @@ -110,4 +110,5 @@ build_flags = -D SPI_SHARED=1 -D AT6558D_GPS=1 ;-D HMC5883L=1 + -D BME280=1 -D TFT_BL=45