mirror of https://github.com/arendst/Tasmota.git
commit
b8647a9826
|
@ -60,7 +60,7 @@ struct MULTI_DISP {
|
|||
uint8_t auto_draw;
|
||||
} displays[3];
|
||||
uint8_t cur_display;
|
||||
Renderer *Init_uDisplay(const char *desc);
|
||||
Renderer *Init_uDisplay(const char *desc, int8_t cs);
|
||||
|
||||
void Set_display(uint8_t index) {
|
||||
displays[index].display = renderer;
|
||||
|
@ -585,7 +585,7 @@ void DisplayText(void)
|
|||
fp.read((uint8_t*)fdesc, size);
|
||||
fp.close();
|
||||
Get_display(temp);
|
||||
renderer = Init_uDisplay(fdesc);
|
||||
renderer = Init_uDisplay(fdesc, -1);
|
||||
Set_display(temp);
|
||||
AddLog(LOG_LEVEL_INFO, PSTR("DSP: File descriptor loaded %x"),renderer);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
xdsp_08_ILI9488.ino - Display ILI9488 support for Tasmota
|
||||
|
||||
Copyright (C) 2021 Theo Arends, Gerhard Mutz
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef USE_SPI
|
||||
#ifdef USE_DISPLAY
|
||||
#ifdef USE_DISPLAY_ILI9488_UD
|
||||
#ifdef USE_UNIVERSAL_DISPLAY
|
||||
|
||||
#define XDSP_08 8
|
||||
|
||||
bool ili9488_init_done = false;
|
||||
|
||||
Renderer *Init_uDisplay(const char *desc, int8_t cs);
|
||||
void udisp_CheckTouch(void);
|
||||
|
||||
/*********************************************************************************************/
|
||||
|
||||
const char ILI9488_DESC[] PROGMEM =
|
||||
":H,ILI9488,480,320,16,SPI,1,*,*,*,*,*,*,*,10\n"
|
||||
":S,2,1,1,0,40,20\n"
|
||||
":I\n"
|
||||
"E0,0F,00,03,09,08,16,0A,3F,78,4C,09,0A,08,16,1A,0F\n"
|
||||
"E1,0F,00,16,19,03,0F,05,32,45,46,04,0E,0D,35,37,0F\n"
|
||||
"C0,2,17,15\n"
|
||||
"C1,1,41\n"
|
||||
"C5,3,00,12,80\n"
|
||||
"36,1,48\n"
|
||||
"3A,1,66\n"
|
||||
"B0,1,80\n"
|
||||
"B1,1,A0\n"
|
||||
"B4,1,02\n"
|
||||
"B6,2,02,02\n"
|
||||
"E9,1,00\n"
|
||||
"F7,4,A9,51,2C,82\n"
|
||||
"11,80\n"
|
||||
"29,0\n"
|
||||
":o,28\n"
|
||||
":O,29\n"
|
||||
":A,2A,2B,2C,16\n"
|
||||
":R,36\n"
|
||||
";:0,48,00,00,00\n"
|
||||
":0,28,00,00,01\n"
|
||||
":1,28,00,00,00\n"
|
||||
":2,E8,00,00,03\n"
|
||||
":3,88,00,00,02\n"
|
||||
":P,18\n"
|
||||
":i,20,21\n"
|
||||
":TI1,38,*,*\n"
|
||||
"#\n";
|
||||
|
||||
void ILI9488_InitDriver(void) {
|
||||
if (PinUsed(GPIO_ILI9488_CS) && (TasmotaGlobal.spi_enabled & SPI_MOSI)) {
|
||||
|
||||
renderer = Init_uDisplay(ILI9488_DESC, Pin(GPIO_ILI9488_CS));
|
||||
|
||||
if (!renderer) return;
|
||||
|
||||
Settings.display_model = XDSP_08;
|
||||
|
||||
ili9488_init_done = true;
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************************************************/
|
||||
/*********************************************************************************************\
|
||||
* Interface
|
||||
\*********************************************************************************************/
|
||||
bool Xdsp08(uint8_t function)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
if (FUNC_DISPLAY_INIT_DRIVER == function) {
|
||||
ILI9488_InitDriver();
|
||||
}
|
||||
else if (ili9488_init_done && (XDSP_08 == Settings.display_model)) {
|
||||
switch (function) {
|
||||
case FUNC_DISPLAY_MODEL:
|
||||
result = true;
|
||||
break;
|
||||
case FUNC_DISPLAY_EVERY_50_MSECOND:
|
||||
#ifdef USE_FT5206
|
||||
if (FT5206_found) {
|
||||
udisp_CheckTouch();
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif // USE_UNIVERSAL_DISPLAY
|
||||
#endif // USE_DISPLAY_ILI9488
|
||||
#endif // USE_DISPLAY
|
||||
#endif // USE_SPI
|
|
@ -40,8 +40,7 @@ extern FS *ffsp;
|
|||
//#define DSP_ROM_DESC
|
||||
|
||||
/*********************************************************************************************/
|
||||
//#ifdef DSP_ROM_DESC
|
||||
#if 1
|
||||
#ifdef DSP_ROM_DESC
|
||||
/* sample descriptor */
|
||||
const char DSP_SAMPLE_DESC[] PROGMEM =
|
||||
":H,SH1106,128,64,1,I2C,3c,*,*,*\n"
|
||||
|
@ -71,19 +70,20 @@ const char DSP_SAMPLE_DESC[] PROGMEM =
|
|||
|
||||
#endif // DSP_ROM_DESC
|
||||
/*********************************************************************************************/
|
||||
Renderer *Init_uDisplay(const char *desc) {
|
||||
Renderer *Init_uDisplay(const char *desc, int8_t cs) {
|
||||
char *ddesc = 0;
|
||||
char *fbuff;
|
||||
uDisplay *udisp;
|
||||
|
||||
if (TasmotaGlobal.gpio_optiona.udisplay_driver) {
|
||||
if (TasmotaGlobal.gpio_optiona.udisplay_driver || desc) {
|
||||
|
||||
Settings.display_model = XDSP_17;
|
||||
|
||||
fbuff = (char*)calloc(DISPDESC_SIZE, 1);
|
||||
if (!fbuff) return 0;
|
||||
|
||||
if (desc) {
|
||||
memcpy(fbuff, desc, DISPDESC_SIZE - 1);
|
||||
memcpy_P(fbuff, desc, DISPDESC_SIZE - 1);
|
||||
ddesc = fbuff;
|
||||
AddLog(LOG_LEVEL_INFO, PSTR("DSP: const char descriptor used"));
|
||||
}
|
||||
|
@ -192,9 +192,22 @@ uDisplay *udisp;
|
|||
cp += 4;
|
||||
//; 7 params nr,cs,sclk,mosi,dc,bl,reset,miso
|
||||
//SPI,*,*,*,*,*,*,*
|
||||
if (cs < 0) {
|
||||
switch (*cp) {
|
||||
case 1:
|
||||
cs = Pin(GPIO_SPI_CS);
|
||||
break;
|
||||
case 2:
|
||||
cs = Pin(GPIO_SPI_CS, 1);
|
||||
break;
|
||||
default:
|
||||
cs = Pin(GPIO_SSPI_CS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (*cp == '1') {
|
||||
cp+=2;
|
||||
replacepin(&cp, Pin(GPIO_SPI_CS));
|
||||
replacepin(&cp, cs);
|
||||
replacepin(&cp, Pin(GPIO_SPI_CLK));
|
||||
replacepin(&cp, Pin(GPIO_SPI_MOSI));
|
||||
replacepin(&cp, Pin(GPIO_SPI_DC));
|
||||
|
@ -203,7 +216,7 @@ uDisplay *udisp;
|
|||
replacepin(&cp, Pin(GPIO_SPI_MISO));
|
||||
} else if (*cp == '2') {
|
||||
cp+=2;
|
||||
replacepin(&cp, Pin(GPIO_SPI_CS, 1));
|
||||
replacepin(&cp, cs);
|
||||
replacepin(&cp, Pin(GPIO_SPI_CLK, 1));
|
||||
replacepin(&cp, Pin(GPIO_SPI_MOSI, 1));
|
||||
replacepin(&cp, Pin(GPIO_SPI_DC, 1));
|
||||
|
@ -213,7 +226,7 @@ uDisplay *udisp;
|
|||
} else {
|
||||
// soft spi pins
|
||||
cp+=2;
|
||||
replacepin(&cp, Pin(GPIO_SSPI_CS));
|
||||
replacepin(&cp, cs);
|
||||
replacepin(&cp, Pin(GPIO_SSPI_SCLK));
|
||||
replacepin(&cp, Pin(GPIO_SSPI_MOSI));
|
||||
replacepin(&cp, Pin(GPIO_SSPI_DC));
|
||||
|
@ -443,7 +456,7 @@ bool Xdsp17(uint8_t function)
|
|||
bool result = false;
|
||||
|
||||
if (FUNC_DISPLAY_INIT_DRIVER == function) {
|
||||
Init_uDisplay(0);
|
||||
Init_uDisplay(0, -1);
|
||||
}
|
||||
else if (udisp_init_done && (XDSP_17 == Settings.display_model)) {
|
||||
switch (function) {
|
||||
|
|
Loading…
Reference in New Issue