mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-24 11:46:34 +00:00
Update Lilypi LovyanGFX drivers
This commit is contained in:
parent
3c55479f56
commit
97464c9969
69
src/drv/tft/Panel_ILI9481b.hpp
Normal file
69
src/drv/tft/Panel_ILI9481b.hpp
Normal file
@ -0,0 +1,69 @@
|
||||
/*----------------------------------------------------------------------------/
|
||||
Lovyan GFX - Graphics library for embedded devices.
|
||||
|
||||
Original Source:
|
||||
https://github.com/lovyan03/LovyanGFX/
|
||||
|
||||
Licence:
|
||||
[FreeBSD](https://github.com/lovyan03/LovyanGFX/blob/master/license.txt)
|
||||
|
||||
Author:
|
||||
[lovyan03](https://twitter.com/lovyan03)
|
||||
|
||||
Contributors:
|
||||
[ciniml](https://github.com/ciniml)
|
||||
[mongonta0716](https://github.com/mongonta0716)
|
||||
[tobozo](https://github.com/tobozo)
|
||||
/----------------------------------------------------------------------------*/
|
||||
#pragma once
|
||||
|
||||
#if defined(ARDUINO) && defined(LGFX_USE_V1)
|
||||
|
||||
#include "LovyanGFX.hpp"
|
||||
|
||||
namespace lgfx {
|
||||
inline namespace v1 {
|
||||
struct Panel_ILI9481_b : public Panel_ILI948x
|
||||
{
|
||||
protected:
|
||||
static constexpr uint8_t CMD_PNLDRV = 0xC0;
|
||||
static constexpr uint8_t CMD_FRMCTR = 0xC5;
|
||||
static constexpr uint8_t CMD_IFCTR = 0xC6;
|
||||
static constexpr uint8_t CMD_PWSET = 0xD0;
|
||||
static constexpr uint8_t CMD_VMCTR = 0xD1;
|
||||
static constexpr uint8_t CMD_PWSETN = 0xD2;
|
||||
static constexpr uint8_t CMD_GMCTR = 0xC8;
|
||||
|
||||
const uint8_t* getInitCommands(uint8_t listno) const override
|
||||
{
|
||||
static constexpr uint8_t list0[] = {
|
||||
CMD_SLPOUT, 0 + CMD_INIT_DELAY, 120, // Exit sleep mode
|
||||
CMD_PWSET, 3, 0x07, 0x42, 0x18, CMD_VMCTR, 3, 0x00, 0x07, 0x10, CMD_PWSETN, 2, 0x01, 0x02, CMD_PNLDRV, 5,
|
||||
0x10, 0x3B, 0x00, 0x02, 0x11, CMD_FRMCTR, 1, 0x03,
|
||||
// CMD_GMCTR ,12, 0x00, 0x44, 0x06, 0x44, 0x0A, 0x08,
|
||||
// 0x17, 0x33, 0x77, 0x44, 0x08, 0x0C,
|
||||
CMD_GMCTR, 12, 0x00, 0x32, 0x36, 0x45, 0x06, 0x16, 0x37, 0x75, 0x77, 0x54, 0x0C, 0x00, CMD_SLPOUT,
|
||||
0 + CMD_INIT_DELAY, 120, // Exit sleep mode
|
||||
CMD_IDMOFF, 0, CMD_DISPON, 0 + CMD_INIT_DELAY, 100, 0xFF, 0xFF, // end
|
||||
};
|
||||
switch(listno) {
|
||||
case 0:
|
||||
return list0;
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t getMadCtl(uint8_t r) const override
|
||||
{
|
||||
static constexpr uint8_t madctl_table[] = {
|
||||
MAD_HF, MAD_MV, MAD_VF, MAD_MV | MAD_HF | MAD_VF, MAD_HF | MAD_VF, MAD_MV | MAD_HF, 0, MAD_MV | MAD_VF,
|
||||
};
|
||||
return madctl_table[r];
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace v1
|
||||
} // namespace lgfx
|
||||
|
||||
#endif
|
@ -3,6 +3,7 @@
|
||||
|
||||
#if defined(ARDUINO) && defined(LGFX_USE_V1)
|
||||
#include "tft_driver_lovyangfx.h"
|
||||
#include "Panel_ILI9481b.hpp"
|
||||
#include <Preferences.h>
|
||||
|
||||
namespace dev {
|
||||
@ -243,13 +244,16 @@ lgfx::IBus* _init_bus(Preferences* preferences)
|
||||
#if defined(ESP32S2)
|
||||
if(is_16bit) {
|
||||
is_8bit = false;
|
||||
LOG_VERBOSE(TAG_TFT, F("16-bit TFT bus"));
|
||||
return init_parallel_16_bus(preferences, data_pins, 16);
|
||||
} else
|
||||
#endif // ESP32S2
|
||||
if(is_8bit) {
|
||||
is_16bit = false;
|
||||
LOG_VERBOSE(TAG_TFT, F("8-bit TFT bus"));
|
||||
return init_parallel_8_bus(preferences, data_pins, 8);
|
||||
} else {
|
||||
LOG_VERBOSE(TAG_TFT, F("SPI TFT bus"));
|
||||
return init_spi_bus(preferences);
|
||||
}
|
||||
return nullptr;
|
||||
@ -261,38 +265,38 @@ lgfx::Panel_Device* LovyanGfx::_init_panel(lgfx::IBus* bus)
|
||||
switch(tft_driver) {
|
||||
case 0x9341: {
|
||||
panel = new lgfx::Panel_ILI9341();
|
||||
LOG_DEBUG(TAG_TFT, F("%s - %d"), __FILE__, __LINE__);
|
||||
LOG_VERBOSE(TAG_TFT, F("Panel_ILI9341"));
|
||||
break;
|
||||
}
|
||||
case 0x9342: {
|
||||
panel = new lgfx::Panel_ILI9342();
|
||||
LOG_DEBUG(TAG_TFT, F("%s - %d"), __FILE__, __LINE__);
|
||||
LOG_VERBOSE(TAG_TFT, F("Panel_ILI9342"));
|
||||
break;
|
||||
}
|
||||
case 0x61529:
|
||||
case 0x9481: {
|
||||
panel = new lgfx::Panel_ILI9481();
|
||||
LOG_DEBUG(TAG_TFT, F("%s - %d"), __FILE__, __LINE__);
|
||||
panel = new lgfx::Panel_ILI9481_b();
|
||||
LOG_VERBOSE(TAG_TFT, F("Panel_ILI9481_b"));
|
||||
break;
|
||||
}
|
||||
case 0x9488: {
|
||||
panel = new lgfx::Panel_ILI9488();
|
||||
LOG_DEBUG(TAG_TFT, F("%s - %d"), __FILE__, __LINE__);
|
||||
LOG_VERBOSE(TAG_TFT, F("Panel_ILI9488"));
|
||||
break;
|
||||
}
|
||||
case 0x7789: {
|
||||
panel = new lgfx::Panel_ST7789();
|
||||
LOG_DEBUG(TAG_TFT, F("%s - %d"), __FILE__, __LINE__);
|
||||
LOG_VERBOSE(TAG_TFT, F("Panel_ST7789"));
|
||||
break;
|
||||
}
|
||||
case 0x7796: {
|
||||
panel = new lgfx::Panel_ST7796();
|
||||
LOG_DEBUG(TAG_TFT, F("%s - %d"), __FILE__, __LINE__);
|
||||
LOG_VERBOSE(TAG_TFT, F("Panel_ST7796"));
|
||||
break;
|
||||
}
|
||||
case 0x8357D: {
|
||||
panel = new lgfx::Panel_HX8357D();
|
||||
LOG_DEBUG(TAG_TFT, F("%s - %d"), __FILE__, __LINE__);
|
||||
LOG_VERBOSE(TAG_TFT, F("Panel_HX8357D"));
|
||||
break;
|
||||
}
|
||||
default: { // Needs to be in curly braces
|
||||
|
@ -54,7 +54,7 @@ lib_ignore =
|
||||
;endregion
|
||||
|
||||
[env:ttgo-lilygo-pi_st7796]
|
||||
extends = esp32-3248s035, esp32_16mb_v2
|
||||
extends = ttgo-lilygo-pi, esp32_16mb_v2
|
||||
build_flags =
|
||||
${ttgo-lilygo-pi.build_flags}
|
||||
-D ST7796_DRIVER=1
|
||||
@ -67,12 +67,12 @@ lib_ignore =
|
||||
${ttgo-lilygo-pi.lib_ignore}
|
||||
|
||||
[env:ttgo-lilygo-pi_ili9481]
|
||||
extends = esp32-3248s035, esp32_16mb_v2
|
||||
extends = ttgo-lilygo-pi, esp32_16mb_v2
|
||||
build_flags =
|
||||
${ttgo-lilygo-pi.build_flags}
|
||||
-D ILI9481_DRIVER=1
|
||||
-D INVERT_COLORS=1
|
||||
-D TFT_INVERSION_ON ; for inverted colors
|
||||
;-D INVERT_COLORS=1
|
||||
;-D TFT_INVERSION_ON ; for inverted colors
|
||||
-D SPI_FREQUENCY=27000000
|
||||
-D I2C_TOUCH_ADDRESS=0x5D ; or 0x14
|
||||
-D TOUCH_DRIVER=0x0911 ; GT911 Capacitive I2C touch panel driver
|
||||
|
Loading…
x
Reference in New Issue
Block a user