Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to ili9488 8bit #175

Merged
merged 5 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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``` |

Expand Down
8 changes: 7 additions & 1 deletion include/hal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions lib/gui/src/settingsScr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions lib/lvgl/src/lvglSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 2 additions & 0 deletions lib/panel/ILI9341_XPT2046_SPI.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

#define LGFX_USE_V1

#define TOUCH_INPUT

#include "LovyanGFX.hpp"

extern const uint8_t TFT_SPI_SCLK;
Expand Down
1 change: 1 addition & 0 deletions lib/panel/ILI9488_FT5x06_16B.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
1 change: 1 addition & 0 deletions lib/panel/ILI9488_FT5x06_SPI.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
93 changes: 93 additions & 0 deletions lib/panel/ILI9488_NOTOUCH_8B.hpp
Original file line number Diff line number Diff line change
@@ -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 <LovyanGFX.hpp>

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
1 change: 1 addition & 0 deletions lib/panel/ILI9488_XPT2046_SPI.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 2 additions & 0 deletions lib/tft/tft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,7 @@ void initTFT()
ledcSetup(0, 5000, 8);
ledcAttachPin(TFT_BL, 0);
ledcWrite(0, 255);
#ifdef TOUCH_INPUT
touchCalibrate();
#endif
}
4 changes: 4 additions & 0 deletions lib/tft/tft.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
#include "ILI9488_FT5x06_SPI.hpp"
#endif

#ifdef ILI9488_NOTOUCH_8B
#include "ILI9488_NOTOUCH_8B.hpp"
#endif

#include <LGFX_TFT_eSPI.hpp>

extern TFT_eSPI tft;
Expand Down
3 changes: 2 additions & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -110,4 +110,5 @@ build_flags =
-D SPI_SHARED=1
-D AT6558D_GPS=1
;-D HMC5883L=1
-D BME280=1
-D TFT_BL=45