[P095] Disable unavailable displays (ILI9486/ILI9488)

This commit is contained in:
Ton Huisman
2022-07-20 21:32:32 +02:00
parent 78e4f3f814
commit 35d8d2528a
5 changed files with 93 additions and 50 deletions
+46 -33
View File
@@ -448,14 +448,16 @@ static const uint8_t PROGMEM initcmd_9481_CMI8[] = { // ILI9481 CMI8 (TFT_eSPI I
// clang-format on
#ifdef ILI9341_ENABLE_ILI948X
// clang-format off
static const uint8_t PROGMEM initcmd_9486[] = { // ILI9486
ILI9341_SLPOUT, 0x80, // Exit Sleep
ILI9341_PIXFMT, 1, 0x55, // Pixel format 0x55=16bit, 0x66=18bit
ILI9341_PWCTR3, 1, 0x44, // Power control3
ILI9341_VMCTR1, 4, 0x00, 0x00, 0x00, 0x00, // VCM control
ILI9341_GMCTRP1, 15, 0x0F, 0x1F, 0x1c, 0x0C, 0x0F, 0x08, 0x48, 0x98, 0x37, 0x0A, 0x13, 0x04, 0x11, 0x0D, 0x00,
ILI9341_GMCTRN1, 15, 0x0F, 0x32, 0x2E, 0x0B, 0x0D, 0x05, 0x47, 0x75, 0x37, 0x06, 0x10, 0x03, 0x24, 0x20, 0x00,
static const uint8_t PROGMEM initcmd_9486[] = { // ILI9486
ILI9341_SLPOUT, 0x80, // Exit Sleep
ILI9341_PIXFMT, 1, 0x55, // Pixel format 0x55=16bit, 0x66=18bit
ILI9341_PWCTR3, 1, 0x44, // Power control3
ILI9341_VMCTR1, 4, 0x00, 0x00, 0x00, 0x00, // VCM control
ILI9341_GMCTRP1, 15, 0x0F, 0x1F, 0x1c, 0x0C, 0x0F, 0x08, 0x48, 0x98, 0x37, 0x0A, 0x13, 0x04, 0x11, 0x0D, 0x00,
ILI9341_GMCTRN1, 15, 0x0F, 0x32, 0x2E, 0x0B, 0x0D, 0x05, 0x47, 0x75, 0x37, 0x06, 0x10, 0x03, 0x24, 0x20, 0x00,
ILI9341_INVOFF, 0,
ILI9341_MADCTL, 1, 0x48, // Memory Access Control
ILI9341_DISPON, 0x80, // Display on
@@ -518,6 +520,7 @@ static const uint8_t PROGMEM initcmd_9488[] = { // ILI9488
// End of list
0x00
};
#endif // ifdef ILI9341_ENABLE_ILI948X
// clang-format on
@@ -575,12 +578,14 @@ void Adafruit_ILI9341::begin(uint32_t freq) {
case ILI_TYPE_9481_CMI8: // ILI9481 CMI8
addr = initcmd_9481_CMI8;
break;
case ILI_TYPE_9486: // ILI9486
#ifdef ILI9341_ENABLE_ILI948X
case ILI_TYPE_9486: // ILI9486
addr = initcmd_9486;
break;
case ILI_TYPE_9488: // ILI9488
case ILI_TYPE_9488: // ILI9488
addr = initcmd_9488;
break;
#endif // ifdef ILI9341_ENABLE_ILI948X
default:
addr = initcmd;
break;
@@ -630,14 +635,16 @@ void Adafruit_ILI9341::setRotation(uint8_t m) {
m = (MADCTL_SS | MADCTL_BGR);
break;
case ILI_TYPE_9341: // ILI9341
// m = (MADCTL_MX | MADCTL_BGR);
// break;
#ifdef ILI9341_ENABLE_ILI948X
case ILI_TYPE_9486: // ILI9486
// m = (MADCTL_MX | MADCTL_BGR);
// break;
case ILI_TYPE_9486: // ILI9486
// m = (MADCTL_MX | MADCTL_BGR);
// break;
case ILI_TYPE_9488: // ILI9488
// m = (MADCTL_MX | MADCTL_BGR);
// break;
case ILI_TYPE_9488: // ILI9488
// m = (MADCTL_MX | MADCTL_BGR);
// break;
#endif // ifdef ILI9341_ENABLE_ILI948X
default:
m = (MADCTL_MX | MADCTL_BGR);
break;
@@ -662,14 +669,16 @@ void Adafruit_ILI9341::setRotation(uint8_t m) {
// m = (MADCTL_MV | MADCTL_BGR);
// break;
case ILI_TYPE_9341: // ILI9341
// m = (MADCTL_MV | MADCTL_BGR);
// break;
#ifdef ILI9341_ENABLE_ILI948X
case ILI_TYPE_9486: // ILI9486
// m = (MADCTL_MV | MADCTL_BGR);
// break;
case ILI_TYPE_9486: // ILI9486
// m = (MADCTL_MV | MADCTL_BGR);
// break;
case ILI_TYPE_9488: // ILI9488
// m = (MADCTL_MV | MADCTL_BGR);
// break;
case ILI_TYPE_9488: // ILI9488
// m = (MADCTL_MV | MADCTL_BGR);
// break;
#endif // ifdef ILI9341_ENABLE_ILI948X
default:
m = (MADCTL_MV | MADCTL_BGR);
break;
@@ -694,14 +703,16 @@ void Adafruit_ILI9341::setRotation(uint8_t m) {
m = (MADCTL_GS | MADCTL_BGR);
break;
case ILI_TYPE_9341: // ILI9341
// m = (MADCTL_MY | MADCTL_BGR);
// break;
#ifdef ILI9341_ENABLE_ILI948X
case ILI_TYPE_9486: // ILI9486
// m = (MADCTL_MY | MADCTL_BGR);
// break;
case ILI_TYPE_9486: // ILI9486
// m = (MADCTL_MY | MADCTL_BGR);
// break;
case ILI_TYPE_9488: // ILI9488
// m = (MADCTL_MY | MADCTL_BGR);
// break;
case ILI_TYPE_9488: // ILI9488
// m = (MADCTL_MY | MADCTL_BGR);
// break;
#endif // ifdef ILI9341_ENABLE_ILI948X
default:
m = (MADCTL_MY | MADCTL_BGR);
break;
@@ -726,14 +737,16 @@ void Adafruit_ILI9341::setRotation(uint8_t m) {
m = (MADCTL_SS | MADCTL_GS | MADCTL_MV | MADCTL_BGR);
break;
case ILI_TYPE_9341: // ILI9341
// m = (MADCTL_MX | MADCTL_MY | MADCTL_MV | MADCTL_BGR);
// break;
#ifdef ILI9341_ENABLE_ILI948X
case ILI_TYPE_9486: // ILI9486
// m = (MADCTL_MX | MADCTL_MY | MADCTL_MV | MADCTL_BGR);
// break;
case ILI_TYPE_9486: // ILI9486
// m = (MADCTL_MX | MADCTL_MY | MADCTL_MV | MADCTL_BGR);
// break;
case ILI_TYPE_9488: // ILI9488
// m = (MADCTL_MX | MADCTL_MY | MADCTL_MV | MADCTL_BGR);
// break;
case ILI_TYPE_9488: // ILI9488
// m = (MADCTL_MX | MADCTL_MY | MADCTL_MV | MADCTL_BGR);
// break;
#endif // ifdef ILI9341_ENABLE_ILI948X
default:
m = (MADCTL_MX | MADCTL_MY | MADCTL_MV | MADCTL_BGR);
break;
+9 -5
View File
@@ -43,6 +43,8 @@
#include <Adafruit_SPITFT_Macros.h>
#include <SPI.h>
// #define ILI9341_ENABLE_ILI948X ///< Enable ILI9486 and ILI9488 support, MUST reflect a similar #define in P095_data_struct.h !
#define ILI9341_TFTWIDTH 240 ///< ILI9341 max TFT width
#define ILI9341_TFTHEIGHT 320 ///< ILI9341 max TFT height
@@ -126,7 +128,7 @@
#define ILI9341_PINK 0xFC18 ///< 255, 130, 198
#define ILI_TYPE_9341 0 // Must match with enum class ILI9xxx_type_e in P095_data_struct.h
#define ILI_TYPE_9341 0 // MUST match with enum class ILI9xxx_type_e in P095_data_struct.h !
#define ILI_TYPE_9342 1
#define ILI_TYPE_9481 2
#define ILI_TYPE_9481_CPT29 3
@@ -134,10 +136,12 @@
#define ILI_TYPE_9481_AUO317 5
#define ILI_TYPE_9481_CMO35 6
#define ILI_TYPE_9481_RGB 7
#define ILI_TYPE_9481_CMI7 10
#define ILI_TYPE_9481_CMI8 11
#define ILI_TYPE_9486 8
#define ILI_TYPE_9488 9
#define ILI_TYPE_9481_CMI7 8
#define ILI_TYPE_9481_CMI8 9
#ifdef ILI9341_ENABLE_ILI948X
# define ILI_TYPE_9486 10
# define ILI_TYPE_9488 11
#endif // ifndef ILI9341_ENABLE_ILI948X
/**************************************************************************/
+13 -2
View File
@@ -15,6 +15,9 @@
/**
* Changelog:
* 2022-07-20 tonhuisman: Made support for ILI9486/ILI9488 optional and excluded by default as these are not available as
* regular SPI devices (3/4 wire SPI)
* NOTE: Renumbered enum with display types.
* 2022-07-16 tonhuisman: Add support for some more ILI9481 sub-types (Again cloned from TFT_eSPI library)
* WARNING: ILI9481 does *NOT* support changing rotation and keep writing on the display!
* Display memory is restructured by the rotation change, but the content is not adjusted.
@@ -233,8 +236,10 @@ boolean Plugin_095(uint8_t function, struct EventStruct *event, String& string)
ILI9xxx_type_toString(ILI9xxx_type_e::ILI9481_RGB_320x480),
ILI9xxx_type_toString(ILI9xxx_type_e::ILI9481_CMI7_320x480),
ILI9xxx_type_toString(ILI9xxx_type_e::ILI9481_CMI8_320x480),
# ifdef P095_ENABLE_ILI948X
ILI9xxx_type_toString(ILI9xxx_type_e::ILI9486_320x480),
ILI9xxx_type_toString(ILI9xxx_type_e::ILI9488_320x480),
# endif // ifdef P095_ENABLE_ILI948X
};
const int hardwareOptions[] = {
static_cast<int>(ILI9xxx_type_e::ILI9341_240x320),
@@ -247,8 +252,10 @@ boolean Plugin_095(uint8_t function, struct EventStruct *event, String& string)
static_cast<int>(ILI9xxx_type_e::ILI9481_RGB_320x480),
static_cast<int>(ILI9xxx_type_e::ILI9481_CMI7_320x480),
static_cast<int>(ILI9xxx_type_e::ILI9481_CMI8_320x480),
# ifdef P095_ENABLE_ILI948X
static_cast<int>(ILI9xxx_type_e::ILI9486_320x480),
static_cast<int>(ILI9xxx_type_e::ILI9488_320x480),
# endif // ifdef P095_ENABLE_ILI948X
};
addFormSelector(F("TFT display model"),
F("p095_type"),
@@ -278,16 +285,20 @@ boolean Plugin_095(uint8_t function, struct EventStruct *event, String& string)
P095_CommandTrigger_toString(P095_CommandTrigger::ili9341),
P095_CommandTrigger_toString(P095_CommandTrigger::ili9342),
P095_CommandTrigger_toString(P095_CommandTrigger::ili9481),
# ifdef P095_ENABLE_ILI948X
P095_CommandTrigger_toString(P095_CommandTrigger::ili9486),
P095_CommandTrigger_toString(P095_CommandTrigger::ili9488)
P095_CommandTrigger_toString(P095_CommandTrigger::ili9488),
# endif // ifdef P095_ENABLE_ILI948X
};
const int commandTriggerOptions[] = {
static_cast<int>(P095_CommandTrigger::tft),
static_cast<int>(P095_CommandTrigger::ili9341),
static_cast<int>(P095_CommandTrigger::ili9342),
static_cast<int>(P095_CommandTrigger::ili9481),
# ifdef P095_ENABLE_ILI948X
static_cast<int>(P095_CommandTrigger::ili9486),
static_cast<int>(P095_CommandTrigger::ili9488)
static_cast<int>(P095_CommandTrigger::ili9488),
# endif // ifdef P095_ENABLE_ILI948X
};
addFormSelector(F("Write Command trigger"),
F("p095_commandtrigger"),
@@ -18,8 +18,10 @@ const __FlashStringHelper* ILI9xxx_type_toString(ILI9xxx_type_e device) {
case ILI9xxx_type_e::ILI9481_RGB_320x480: return F("ILI9481 320 x 480px (RGB)");
case ILI9xxx_type_e::ILI9481_CMI7_320x480: return F("ILI9481 320 x 480px (CMI7)");
case ILI9xxx_type_e::ILI9481_CMI8_320x480: return F("ILI9481 320 x 480px (CMI8)");
# ifdef P095_ENABLE_ILI948X
case ILI9xxx_type_e::ILI9486_320x480: return F("ILI9486 320 x 480px");
case ILI9xxx_type_e::ILI9488_320x480: return F("ILI9488 320 x 480px");
# endif // ifdef P095_ENABLE_ILI948X
case ILI9xxx_type_e::ILI9xxx_MAX: break;
}
return F("Unsupported type!");
@@ -43,8 +45,10 @@ void ILI9xxx_type_toResolution(ILI9xxx_type_e device, uint16_t& x, uint16_t& y)
case ILI9xxx_type_e::ILI9481_RGB_320x480:
case ILI9xxx_type_e::ILI9481_CMI7_320x480:
case ILI9xxx_type_e::ILI9481_CMI8_320x480:
# ifdef P095_ENABLE_ILI948X
case ILI9xxx_type_e::ILI9486_320x480:
case ILI9xxx_type_e::ILI9488_320x480:
# endif // ifdef P095_ENABLE_ILI948X
x = 320;
y = 480;
break;
@@ -62,8 +66,10 @@ const __FlashStringHelper* P095_CommandTrigger_toString(P095_CommandTrigger cmd)
case P095_CommandTrigger::ili9341: return F("ili9341");
case P095_CommandTrigger::ili9342: return F("ili9342");
case P095_CommandTrigger::ili9481: return F("ili9481");
# ifdef P095_ENABLE_ILI948X
case P095_CommandTrigger::ili9486: return F("ili9486");
case P095_CommandTrigger::ili9488: return F("ili9488");
# endif // ifdef P095_ENABLE_ILI948X
case P095_CommandTrigger::MAX: return F("None");
}
return F("ili9341"); // Default command trigger
+19 -10
View File
@@ -4,15 +4,18 @@
#include "../../_Plugin_Helper.h"
#ifdef USES_P095
# include <Adafruit_GFX.h> // include Adafruit graphics library
# include <Adafruit_ILI9341.h> // include Adafruit ILI9341 TFT library
# include <Adafruit_GFX.h> // include Adafruit graphics library
# include <Adafruit_ILI9341.h> // include Adafruit ILI9341 TFT library
# include "../Helpers/AdafruitGFX_helper.h" // Use Adafruit graphics helper object
# include "../Helpers/AdafruitGFX_helper.h" // Use Adafruit graphics helper object
# include "../CustomBuild/StorageLayout.h"
# define P095_Nlines 24 // The number of different lines which can be displayed
# define P095_Nlines 24 // The number of different lines which can be displayed
# define P095_Nchars 60
# define P095_DebounceTreshold 5 // number of 20 msec (fifty per second) ticks before the button has settled
# define P095_DebounceTreshold 5 // number of 20 msec (fifty per second) ticks before the button has settled
// # define P095_ENABLE_ILI948X // Enable or disable support for ILI9486 and ILI9488.
// MUST reflect similar #define in Adafruit_ILI9341.h !
# ifndef LIMIT_BUILD_SIZE
# define P095_SHOW_SPLASH // Enable to show initial splash (text)
@@ -75,11 +78,15 @@ enum class ILI9xxx_type_e : uint8_t {
ILI9481_AUO317_320x480 = 5u,
ILI9481_CMO35_320x480 = 6u,
ILI9481_RGB_320x480 = 7u,
ILI9481_CMI7_320x480 = 10u,
ILI9481_CMI8_320x480 = 11u,
ILI9486_320x480 = 8u,
ILI9488_320x480 = 9u,
ILI9xxx_MAX = 12u // last value = count
ILI9481_CMI7_320x480 = 8u,
ILI9481_CMI8_320x480 = 9u,
# ifdef P095_ENABLE_ILI948X
ILI9486_320x480 = 10u,
ILI9488_320x480 = 11u,
ILI9xxx_MAX = 12u // last value = count
# else // ifdef P095_ENABLE_ILI948X
ILI9xxx_MAX = 10u // last value = count
# endif // ifdef P095_ENABLE_ILI948X
};
enum class P095_CommandTrigger : uint8_t {
@@ -87,8 +94,10 @@ enum class P095_CommandTrigger : uint8_t {
ili9341,
ili9342,
ili9481,
# ifdef P095_ENABLE_ILI948X
ili9486,
ili9488,
# endif // ifdef P095_ENABLE_ILI948X
MAX // Keep as last item!
};