Removed ILI9488 driver in favor of Unversal Display Driver

This commit is contained in:
Stephan Hadinger 2021-11-17 22:48:48 +01:00
parent b19d1c580f
commit f3c235b8e9
17 changed files with 19 additions and 2223 deletions

View File

@ -218,7 +218,6 @@ m = minimal, l = lite, t = tasmota, k = knx, s = sensors, i = ir, d = display
| USE_DISPLAY_ILI9341 | - | - | - / - | - | - | - | x |
| USE_DISPLAY_EPAPER_29 | - | - | - / - | - | - | - | x |
| USE_DISPLAY_EPAPER_42 | - | - | - / - | - | - | - | x |
| USE_DISPLAY_ILI9488 | - | - | - / - | - | - | - | x |
| USE_DISPLAY_SSD1351 | - | - | - / - | - | - | - | x |
| USE_DISPLAY_RA8876 | - | - | - / - | - | - | - | x |
| USE_DISPLAY_ST7789 | - | - | - / - | - | - | - | x |

View File

@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file.
### Changed
- ESP8266 Gratuitous ARP enabled and set to 60 seconds (#13623)
- Removed ILI9488 driver in favor of Unversal Display Driver
## [10.0.0.2] 20211113
### Added

File diff suppressed because it is too large Load Diff

View File

@ -1,174 +0,0 @@
/***************************************************
STM32 Support added by Jaret Burkett at OSHlab.com
This is our library for the Adafruit ILI9488 Breakout and Shield
----> http://www.adafruit.com/products/1651
Check out the links above for our tutorials and wiring diagrams
These displays use SPI to communicate, 4 or 5 pins are required to
interface (RST is optional)
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
MIT license, all text above must be included in any redistribution
****************************************************/
#ifndef _ILI9488H_
#define _ILI9488H_
#if ARDUINO >= 100
#include "Arduino.h"
#include "Print.h"
#else
#include "WProgram.h"
#endif
#include <renderer.h>
#ifdef __AVR
#include <avr/pgmspace.h>
#elif defined(ESP8266)
#include <pgmspace.h>
#endif
#ifdef ARDUINO_STM32_FEATHER
typedef volatile uint32 RwReg;
#endif
#if defined (__AVR__) || defined(TEENSYDUINO) || defined (__arm__) || defined (__STM32F1__)
#define USE_FAST_PINIO
#endif
#define ILI9488_TFTWIDTH 320
#define ILI9488_TFTHEIGHT 480
#define ILI9488_NOP 0x00
#define ILI9488_SWRESET 0x01
#define ILI9488_RDDID 0x04
#define ILI9488_RDDST 0x09
#define ILI9488_SLPIN 0x10
#define ILI9488_SLPOUT 0x11
#define ILI9488_PTLON 0x12
#define ILI9488_NORON 0x13
#define ILI9488_RDMODE 0x0A
#define ILI9488_RDMADCTL 0x0B
#define ILI9488_RDPIXFMT 0x0C
#define ILI9488_RDIMGFMT 0x0D
#define ILI9488_RDSELFDIAG 0x0F
#define ILI9488_INVOFF 0x20
#define ILI9488_INVON 0x21
#define ILI9488_GAMMASET 0x26
#define ILI9488_DISPOFF 0x28
#define ILI9488_DISPON 0x29
#define ILI9488_CASET 0x2A
#define ILI9488_PASET 0x2B
#define ILI9488_RAMWR 0x2C
#define ILI9488_RAMRD 0x2E
#define ILI9488_PTLAR 0x30
#define ILI9488_MADCTL 0x36
#define ILI9488_PIXFMT 0x3A
#define ILI9488_WRCTRLD 0x53
#define ILI9488_CAPC9 0xCF
#define ILI9488_FRMCTR1 0xB1
#define ILI9488_FRMCTR2 0xB2
#define ILI9488_FRMCTR3 0xB3
#define ILI9488_INVCTR 0xB4
#define ILI9488_DFUNCTR 0xB6
#define ILI9488_PWCTR1 0xC0
#define ILI9488_PWCTR2 0xC1
#define ILI9488_PWCTR3 0xC2
#define ILI9488_PWCTR4 0xC3
#define ILI9488_PWCTR5 0xC4
#define ILI9488_VMCTR1 0xC5
#define ILI9488_VMCTR2 0xC7
#define ILI9488_RDID1 0xDA
#define ILI9488_RDID2 0xDB
#define ILI9488_RDID3 0xDC
#define ILI9488_RDID4 0xDD
#define ILI9488_GMCTRP1 0xE0
#define ILI9488_GMCTRN1 0xE1
/*
#define ILI9488_PWCTR6 0xFC
*/
#define PIN_OUT_SET 0x60000304
#define PIN_OUT_CLEAR 0x60000308
// Color definitions
#define ILI9488_BLACK 0x0000 /* 0, 0, 0 */
#define ILI9488_NAVY 0x000F /* 0, 0, 128 */
#define ILI9488_DARKGREEN 0x03E0 /* 0, 128, 0 */
#define ILI9488_DARKCYAN 0x03EF /* 0, 128, 128 */
#define ILI9488_MAROON 0x7800 /* 128, 0, 0 */
#define ILI9488_PURPLE 0x780F /* 128, 0, 128 */
#define ILI9488_OLIVE 0x7BE0 /* 128, 128, 0 */
#define ILI9488_LIGHTGREY 0xC618 /* 192, 192, 192 */
#define ILI9488_DARKGREY 0x7BEF /* 128, 128, 128 */
#define ILI9488_BLUE 0x001F /* 0, 0, 255 */
#define ILI9488_GREEN 0x07E0 /* 0, 255, 0 */
#define ILI9488_CYAN 0x07FF /* 0, 255, 255 */
#define ILI9488_RED 0xF800 /* 255, 0, 0 */
#define ILI9488_MAGENTA 0xF81F /* 255, 0, 255 */
#define ILI9488_YELLOW 0xFFE0 /* 255, 255, 0 */
#define ILI9488_WHITE 0xFFFF /* 255, 255, 255 */
#define ILI9488_ORANGE 0xFD20 /* 255, 165, 0 */
#define ILI9488_GREENYELLOW 0xAFE5 /* 173, 255, 47 */
#define ILI9488_PINK 0xF81F
class ILI9488 : public Renderer {
public:
ILI9488(int8_t cs,int8_t mosi,int8_t sclk,int8_t bp);
void begin(void);
void DisplayInit(int8_t p,int8_t size,int8_t rot,int8_t font);
void setAddrWindow_int(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1);
void setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1);
void setScrollArea(uint16_t topFixedArea, uint16_t bottomFixedArea);
void scroll(uint16_t pixels);
void pushColor(uint16_t color);
void pushColors(uint16_t *data, uint16_t len, boolean first);
//void drawImage(const uint8_t* img, uint16_t x, uint16_t y, uint16_t w, uint16_t h);
void fillScreen(uint16_t color);
void drawPixel(int16_t x, int16_t y, uint16_t color);
void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
void fillRect(int16_t x, int16_t y, int16_t w, int16_t h,uint16_t color);
void setRotation(uint8_t r);
void invertDisplay(boolean i);
uint16_t color565(uint8_t r, uint8_t g, uint8_t b);
uint16_t GetColorFromIndex(uint8_t index);
void DisplayOnff(int8_t on);
void writecommand(uint8_t c);
void writedata(uint8_t d);
void write16BitColor(uint16_t color);
void commandList(uint8_t *addr);
void hw_spi_init();
void dim(uint8_t contrast);
private:
uint8_t tabcolor;
uint8_t dimmer;
void fastSPIwrite(uint8_t d,uint8_t dc);
void spi_lcd_mode_init(void);
void start(void);
void stop(void);
int8_t _cs, _mosi, _sclk, _bp, _hwspi;
};
#endif

View File

@ -1,8 +0,0 @@
### ILI9488 Arduino Library
This library is for support for the 320x480 tft controller over 4 wire SPI. It is based heavily on the [Adafruit_ILI9341](https://github.com/adafruit/Adafruit_ILI9341) library and is designed to work with the [Adafruit_GFX library](https://github.com/adafruit/Adafruit-GFX-Library).
I have made some heavy modifications, as the typical Adafruit TFT libraries are designed to work with 16bit color (RGB565), and the ILI9488 can only do 24bit (RGB888) color in 4 wire SPI mode. You can still use the library EXACTLY like you would for 16bit mode color, the colors are converted before sending to the display. What this means is, things will be slower than normal. Not only do you have to write twice as many pixels as a normal 240x320 display, 153,600px (320x480) vs 76,800px (240x320), but you also have to do a lightweight conversion on each color, and write 3 bytes vs 2bytes per pixel.
For this reason, I do not recommend an AVR based Arduino for this library, although it will still work. I highly recommend a faster microcontroller based on ARM such as the Teensy, [STM32duino](https://github.com/rogerclarkmelbourne/Arduino_STM32), Arduino Zero, or the Arduing Due.
On the STM32duino, DMA is supported and is therefore much faster.

View File

@ -1,350 +0,0 @@
/***************************************************
This is our GFX example for the Adafruit ILI9488 Breakout and Shield
----> http://www.adafruit.com/products/1651
Check out the links above for our tutorials and wiring diagrams
These displays use SPI to communicate, 4 or 5 pins are required to
interface (RST is optional)
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
MIT license, all text above must be included in any redistribution
****************************************************/
#include "SPI.h"
#include <Adafruit_GFX.h>
#include <ILI9488.h>
#define TFT_CS PA1
#define TFT_DC PB3
#define TFT_LED PB0
#define TFT_RST PB4
// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
ILI9488 tft = ILI9488(TFT_CS, TFT_DC, TFT_RST);
// If using the breakout, change pins as desired
//Adafruit_ILI9488 tft = Adafruit_ILI9488(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);
void setup() {
Serial.begin(9600);
Serial.println("ILI9488 Test!");
tft.begin();
// read diagnostics (optional but can help debug problems)
uint8_t x = tft.readcommand8(ILI9488_RDMODE);
Serial.print("Display Power Mode: 0x"); Serial.println(x, HEX);
x = tft.readcommand8(ILI9488_RDMADCTL);
Serial.print("MADCTL Mode: 0x"); Serial.println(x, HEX);
x = tft.readcommand8(ILI9488_RDPIXFMT);
Serial.print("Pixel Format: 0x"); Serial.println(x, HEX);
x = tft.readcommand8(ILI9488_RDIMGFMT);
Serial.print("Image Format: 0x"); Serial.println(x, HEX);
x = tft.readcommand8(ILI9488_RDSELFDIAG);
Serial.print("Self Diagnostic: 0x"); Serial.println(x, HEX);
Serial.println(F("Benchmark Time (microseconds)"));
Serial.print(F("Screen fill "));
Serial.println(testFillScreen());
delay(500);
Serial.print(F("Text "));
Serial.println(testText());
delay(3000);
Serial.print(F("Lines "));
Serial.println(testLines(ILI9488_CYAN));
delay(500);
Serial.print(F("Horiz/Vert Lines "));
Serial.println(testFastLines(ILI9488_RED, ILI9488_BLUE));
delay(500);
Serial.print(F("Rectangles (outline) "));
Serial.println(testRects(ILI9488_GREEN));
delay(500);
Serial.print(F("Rectangles (filled) "));
Serial.println(testFilledRects(ILI9488_YELLOW, ILI9488_MAGENTA));
delay(500);
Serial.print(F("Circles (filled) "));
Serial.println(testFilledCircles(10, ILI9488_MAGENTA));
Serial.print(F("Circles (outline) "));
Serial.println(testCircles(10, ILI9488_WHITE));
delay(500);
Serial.print(F("Triangles (outline) "));
Serial.println(testTriangles());
delay(500);
Serial.print(F("Triangles (filled) "));
Serial.println(testFilledTriangles());
delay(500);
Serial.print(F("Rounded rects (outline) "));
Serial.println(testRoundRects());
delay(500);
Serial.print(F("Rounded rects (filled) "));
Serial.println(testFilledRoundRects());
delay(500);
Serial.println(F("Done!"));
}
void loop(void) {
for(uint8_t rotation=0; rotation<4; rotation++) {
tft.setRotation(rotation);
testText();
delay(1000);
}
}
unsigned long testFillScreen() {
unsigned long start = micros();
tft.fillScreen(ILI9488_BLACK);
tft.fillScreen(ILI9488_RED);
tft.fillScreen(ILI9488_GREEN);
tft.fillScreen(ILI9488_BLUE);
tft.fillScreen(ILI9488_BLACK);
return micros() - start;
}
unsigned long testText() {
tft.fillScreen(ILI9488_BLACK);
unsigned long start = micros();
tft.setCursor(0, 0);
tft.setTextColor(ILI9488_WHITE); tft.setTextSize(1);
tft.println("Hello World!");
tft.setTextColor(ILI9488_YELLOW); tft.setTextSize(2);
tft.println(1234.56);
tft.setTextColor(ILI9488_RED); tft.setTextSize(3);
tft.println(0xDEADBEEF, HEX);
tft.println();
tft.setTextColor(ILI9488_GREEN);
tft.setTextSize(5);
tft.println("Groop");
tft.setTextSize(2);
tft.println("I implore thee,");
tft.setTextSize(1);
tft.println("my foonting turlingdromes.");
tft.println("And hooptiously drangle me");
tft.println("with crinkly bindlewurdles,");
tft.println("Or I will rend thee");
tft.println("in the gobberwarts");
tft.println("with my blurglecruncheon,");
tft.println("see if I don't!");
return micros() - start;
}
unsigned long testLines(uint16_t color) {
unsigned long start, t;
int x1, y1, x2, y2,
w = tft.width(),
h = tft.height();
tft.fillScreen(ILI9488_BLACK);
x1 = y1 = 0;
y2 = h - 1;
start = micros();
for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
x2 = w - 1;
for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
t = micros() - start; // fillScreen doesn't count against timing
tft.fillScreen(ILI9488_BLACK);
x1 = w - 1;
y1 = 0;
y2 = h - 1;
start = micros();
for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
x2 = 0;
for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
t += micros() - start;
tft.fillScreen(ILI9488_BLACK);
x1 = 0;
y1 = h - 1;
y2 = 0;
start = micros();
for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
x2 = w - 1;
for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
t += micros() - start;
tft.fillScreen(ILI9488_BLACK);
x1 = w - 1;
y1 = h - 1;
y2 = 0;
start = micros();
for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
x2 = 0;
for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
return micros() - start;
}
unsigned long testFastLines(uint16_t color1, uint16_t color2) {
unsigned long start;
int x, y, w = tft.width(), h = tft.height();
tft.fillScreen(ILI9488_BLACK);
start = micros();
for(y=0; y<h; y+=5) tft.drawFastHLine(0, y, w, color1);
for(x=0; x<w; x+=5) tft.drawFastVLine(x, 0, h, color2);
return micros() - start;
}
unsigned long testRects(uint16_t color) {
unsigned long start;
int n, i, i2,
cx = tft.width() / 2,
cy = tft.height() / 2;
tft.fillScreen(ILI9488_BLACK);
n = min(tft.width(), tft.height());
start = micros();
for(i=2; i<n; i+=6) {
i2 = i / 2;
tft.drawRect(cx-i2, cy-i2, i, i, color);
}
return micros() - start;
}
unsigned long testFilledRects(uint16_t color1, uint16_t color2) {
unsigned long start, t = 0;
int n, i, i2,
cx = tft.width() / 2 - 1,
cy = tft.height() / 2 - 1;
tft.fillScreen(ILI9488_BLACK);
n = min(tft.width(), tft.height());
for(i=n; i>0; i-=6) {
i2 = i / 2;
start = micros();
tft.fillRect(cx-i2, cy-i2, i, i, color1);
t += micros() - start;
// Outlines are not included in timing results
tft.drawRect(cx-i2, cy-i2, i, i, color2);
}
return t;
}
unsigned long testFilledCircles(uint8_t radius, uint16_t color) {
unsigned long start;
int x, y, w = tft.width(), h = tft.height(), r2 = radius * 2;
tft.fillScreen(ILI9488_BLACK);
start = micros();
for(x=radius; x<w; x+=r2) {
for(y=radius; y<h; y+=r2) {
tft.fillCircle(x, y, radius, color);
}
}
return micros() - start;
}
unsigned long testCircles(uint8_t radius, uint16_t color) {
unsigned long start;
int x, y, r2 = radius * 2,
w = tft.width() + radius,
h = tft.height() + radius;
// Screen is not cleared for this one -- this is
// intentional and does not affect the reported time.
start = micros();
for(x=0; x<w; x+=r2) {
for(y=0; y<h; y+=r2) {
tft.drawCircle(x, y, radius, color);
}
}
return micros() - start;
}
unsigned long testTriangles() {
unsigned long start;
int n, i, cx = tft.width() / 2 - 1,
cy = tft.height() / 2 - 1;
tft.fillScreen(ILI9488_BLACK);
n = min(cx, cy);
start = micros();
for(i=0; i<n; i+=5) {
tft.drawTriangle(
cx , cy - i, // peak
cx - i, cy + i, // bottom left
cx + i, cy + i, // bottom right
tft.color565(0, 0, i));
}
return micros() - start;
}
unsigned long testFilledTriangles() {
unsigned long start, t = 0;
int i, cx = tft.width() / 2 - 1,
cy = tft.height() / 2 - 1;
tft.fillScreen(ILI9488_BLACK);
start = micros();
for(i=min(cx,cy); i>10; i-=5) {
start = micros();
tft.fillTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
tft.color565(0, i, i));
t += micros() - start;
tft.drawTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
tft.color565(i, i, 0));
}
return t;
}
unsigned long testRoundRects() {
unsigned long start;
int w, i, i2,
cx = tft.width() / 2 - 1,
cy = tft.height() / 2 - 1;
tft.fillScreen(ILI9488_BLACK);
w = min(tft.width(), tft.height());
start = micros();
for(i=0; i<w; i+=6) {
i2 = i / 2;
tft.drawRoundRect(cx-i2, cy-i2, i, i, i/8, tft.color565(i, 0, 0));
}
return micros() - start;
}
unsigned long testFilledRoundRects() {
unsigned long start;
int i, i2,
cx = tft.width() / 2 - 1,
cy = tft.height() / 2 - 1;
tft.fillScreen(ILI9488_BLACK);
start = micros();
for(i=min(tft.width(), tft.height()); i>20; i-=6) {
i2 = i / 2;
tft.fillRoundRect(cx-i2, cy-i2, i, i, i/8, tft.color565(0, i, 0));
}
return micros() - start;
}

View File

@ -1,30 +0,0 @@
#######################################
# Syntax Coloring Map
#######################################
#######################################
# Datatypes (KEYWORD1)
#######################################
ILI9488 KEYWORD1
#######################################
# Methods and Functions (KEYWORD2)
#######################################
setRotation KEYWORD2
setAddrWindow KEYWORD2
pushColor KEYWORD2
drawPixel KEYWORD2
drawFastVLine KEYWORD2
drawFastHLine KEYWORD2
fillRect KEYWORD2
setRotation KEYWORD2
setRotation KEYWORD2
height KEYWORD2
width KEYWORD2
invertDisplay KEYWORD2
drawImage KEYWORD2
setScrollArea KEYWORD2
scroll KEYWORD2

View File

@ -1,9 +0,0 @@
name=ILI9488
version=1.0.2
author=Jaret Burkett
maintainer=Jaret Burkett <jaretburkett@gmail.com>
sentence=Library for ILI9488 displays
paragraph=Library for ILI9488 displays
category=Display
url=https://github.com/jaretburkett/ILI9488
architectures=*

View File

@ -1,189 +0,0 @@
/*
* Copyright (c) 2010 - 2011 Espressif System
*
*/
#ifndef SPI_REGISTER_H_INCLUDED
#define SPI_REGISTER_H_INCLUDED
#define REG_SPI_BASE(i) (0x60000200-i*0x100)
#define SPI_CMD(i) (REG_SPI_BASE(i) + 0x0)
#define SPI_USR (BIT(18))
#define SPI_ADDR(i) (REG_SPI_BASE(i) + 0x4)
#define SPI_CTRL(i) (REG_SPI_BASE(i) + 0x8)
#define SPI_WR_BIT_ORDER (BIT(26))
#define SPI_RD_BIT_ORDER (BIT(25))
#define SPI_QIO_MODE (BIT(24))
#define SPI_DIO_MODE (BIT(23))
#define SPI_QOUT_MODE (BIT(20))
#define SPI_DOUT_MODE (BIT(14))
#define SPI_FASTRD_MODE (BIT(13))
#define SPI_RD_STATUS(i) (REG_SPI_BASE(i) + 0x10)
#define SPI_CTRL2(i) (REG_SPI_BASE(i) + 0x14)
#define SPI_CS_DELAY_NUM 0x0000000F
#define SPI_CS_DELAY_NUM_S 28
#define SPI_CS_DELAY_MODE 0x00000003
#define SPI_CS_DELAY_MODE_S 26
#define SPI_MOSI_DELAY_NUM 0x00000007
#define SPI_MOSI_DELAY_NUM_S 23
#define SPI_MOSI_DELAY_MODE 0x00000003
#define SPI_MOSI_DELAY_MODE_S 21
#define SPI_MISO_DELAY_NUM 0x00000007
#define SPI_MISO_DELAY_NUM_S 18
#define SPI_MISO_DELAY_MODE 0x00000003
#define SPI_MISO_DELAY_MODE_S 16
#define SPI_CK_OUT_HIGH_MODE 0x0000000F
#define SPI_CK_OUT_HIGH_MODE_S 12
#define SPI_CK_OUT_LOW_MODE 0x0000000F
#define SPI_CK_OUT_LOW_MODE_S 8
#define SPI_CLOCK(i) (REG_SPI_BASE(i) + 0x18)
#define SPI_CLK_EQU_SYSCLK (BIT(31))
#define SPI_CLKDIV_PRE 0x00001FFF
#define SPI_CLKDIV_PRE_S 18
#define SPI_CLKCNT_N 0x0000003F
#define SPI_CLKCNT_N_S 12
#define SPI_CLKCNT_H 0x0000003F
#define SPI_CLKCNT_H_S 6
#define SPI_CLKCNT_L 0x0000003F
#define SPI_CLKCNT_L_S 0
#define SPI_USER(i) (REG_SPI_BASE(i) + 0x1C)
#define SPI_USR_COMMAND (BIT(31))
#define SPI_USR_ADDR (BIT(30))
#define SPI_USR_DUMMY (BIT(29))
#define SPI_USR_MISO (BIT(28))
#define SPI_USR_MOSI (BIT(27))
#define SPI_USR_MOSI_HIGHPART (BIT(25))
#define SPI_USR_MISO_HIGHPART (BIT(24))
#define SPI_SIO (BIT(16))
#define SPI_FWRITE_QIO (BIT(15))
#define SPI_FWRITE_DIO (BIT(14))
#define SPI_FWRITE_QUAD (BIT(13))
#define SPI_FWRITE_DUAL (BIT(12))
#define SPI_WR_BYTE_ORDER (BIT(11))
#define SPI_RD_BYTE_ORDER (BIT(10))
#define SPI_CK_OUT_EDGE (BIT(7))
#define SPI_CK_I_EDGE (BIT(6))
#define SPI_CS_SETUP (BIT(5))
#define SPI_CS_HOLD (BIT(4))
#define SPI_FLASH_MODE (BIT(2))
#define SPI_DOUTDIN (BIT(0))
#define SPI_USER1(i) (REG_SPI_BASE(i) + 0x20)
#define SPI_USR_ADDR_BITLEN 0x0000003F
#define SPI_USR_ADDR_BITLEN_S 26
#define SPI_USR_MOSI_BITLEN 0x000001FF
#define SPI_USR_MOSI_BITLEN_S 17
#define SPI_USR_MISO_BITLEN 0x000001FF
#define SPI_USR_MISO_BITLEN_S 8
#define SPI_USR_DUMMY_CYCLELEN 0x000000FF
#define SPI_USR_DUMMY_CYCLELEN_S 0
#define SPI_USER2(i) (REG_SPI_BASE(i) + 0x24)
#define SPI_USR_COMMAND_BITLEN 0x0000000F
#define SPI_USR_COMMAND_BITLEN_S 28
#define SPI_USR_COMMAND_VALUE 0x0000FFFF
#define SPI_USR_COMMAND_VALUE_S 0
#define SPI_WR_STATUS(i) (REG_SPI_BASE(i) + 0x28)
#define SPI_PIN(i) (REG_SPI_BASE(i) + 0x2C)
#define SPI_CS2_DIS (BIT(2))
#define SPI_CS1_DIS (BIT(1))
#define SPI_CS0_DIS (BIT(0))
#define SPI_IDLE_EDGE (BIT(29))
#define SPI_SLAVE(i) (REG_SPI_BASE(i) + 0x30)
#define SPI_SYNC_RESET (BIT(31))
#define SPI_SLAVE_MODE (BIT(30))
#define SPI_SLV_WR_RD_BUF_EN (BIT(29))
#define SPI_SLV_WR_RD_STA_EN (BIT(28))
#define SPI_SLV_CMD_DEFINE (BIT(27))
#define SPI_TRANS_CNT 0x0000000F
#define SPI_TRANS_CNT_S 23
#define SPI_TRANS_DONE_EN (BIT(9))
#define SPI_SLV_WR_STA_DONE_EN (BIT(8))
#define SPI_SLV_RD_STA_DONE_EN (BIT(7))
#define SPI_SLV_WR_BUF_DONE_EN (BIT(6))
#define SPI_SLV_RD_BUF_DONE_EN (BIT(5))
#define SLV_SPI_INT_EN 0x0000001f
#define SLV_SPI_INT_EN_S 5
#define SPI_TRANS_DONE (BIT(4))
#define SPI_SLV_WR_STA_DONE (BIT(3))
#define SPI_SLV_RD_STA_DONE (BIT(2))
#define SPI_SLV_WR_BUF_DONE (BIT(1))
#define SPI_SLV_RD_BUF_DONE (BIT(0))
#define SPI_SLAVE1(i) (REG_SPI_BASE(i) + 0x34)
#define SPI_SLV_STATUS_BITLEN 0x0000001F
#define SPI_SLV_STATUS_BITLEN_S 27
#define SPI_SLV_BUF_BITLEN 0x000001FF
#define SPI_SLV_BUF_BITLEN_S 16
#define SPI_SLV_RD_ADDR_BITLEN 0x0000003F
#define SPI_SLV_RD_ADDR_BITLEN_S 10
#define SPI_SLV_WR_ADDR_BITLEN 0x0000003F
#define SPI_SLV_WR_ADDR_BITLEN_S 4
#define SPI_SLV_WRSTA_DUMMY_EN (BIT(3))
#define SPI_SLV_RDSTA_DUMMY_EN (BIT(2))
#define SPI_SLV_WRBUF_DUMMY_EN (BIT(1))
#define SPI_SLV_RDBUF_DUMMY_EN (BIT(0))
#define SPI_SLAVE2(i) (REG_SPI_BASE(i) + 0x38)
#define SPI_SLV_WRBUF_DUMMY_CYCLELEN 0X000000FF
#define SPI_SLV_WRBUF_DUMMY_CYCLELEN_S 24
#define SPI_SLV_RDBUF_DUMMY_CYCLELEN 0X000000FF
#define SPI_SLV_RDBUF_DUMMY_CYCLELEN_S 16
#define SPI_SLV_WRSTR_DUMMY_CYCLELEN 0X000000FF
#define SPI_SLV_WRSTR_DUMMY_CYCLELEN_S 8
#define SPI_SLV_RDSTR_DUMMY_CYCLELEN 0x000000FF
#define SPI_SLV_RDSTR_DUMMY_CYCLELEN_S 0
#define SPI_SLAVE3(i) (REG_SPI_BASE(i) + 0x3C)
#define SPI_SLV_WRSTA_CMD_VALUE 0x000000FF
#define SPI_SLV_WRSTA_CMD_VALUE_S 24
#define SPI_SLV_RDSTA_CMD_VALUE 0x000000FF
#define SPI_SLV_RDSTA_CMD_VALUE_S 16
#define SPI_SLV_WRBUF_CMD_VALUE 0x000000FF
#define SPI_SLV_WRBUF_CMD_VALUE_S 8
#define SPI_SLV_RDBUF_CMD_VALUE 0x000000FF
#define SPI_SLV_RDBUF_CMD_VALUE_S 0
#define SPI_W0(i) (REG_SPI_BASE(i) +0x40)
#define SPI_W1(i) (REG_SPI_BASE(i) +0x44)
#define SPI_W2(i) (REG_SPI_BASE(i) +0x48)
#define SPI_W3(i) (REG_SPI_BASE(i) +0x4C)
#define SPI_W4(i) (REG_SPI_BASE(i) +0x50)
#define SPI_W5(i) (REG_SPI_BASE(i) +0x54)
#define SPI_W6(i) (REG_SPI_BASE(i) +0x58)
#define SPI_W7(i) (REG_SPI_BASE(i) +0x5C)
#define SPI_W8(i) (REG_SPI_BASE(i) +0x60)
#define SPI_W9(i) (REG_SPI_BASE(i) +0x64)
#define SPI_W10(i) (REG_SPI_BASE(i) +0x68)
#define SPI_W11(i) (REG_SPI_BASE(i) +0x6C)
#define SPI_W12(i) (REG_SPI_BASE(i) +0x70)
#define SPI_W13(i) (REG_SPI_BASE(i) +0x74)
#define SPI_W14(i) (REG_SPI_BASE(i) +0x78)
#define SPI_W15(i) (REG_SPI_BASE(i) +0x7C)
#define SPI_EXT3(i) (REG_SPI_BASE(i) + 0xFC)
#define SPI_INT_HOLD_ENA 0x00000003
#define SPI_INT_HOLD_ENA_S 0
#endif // SPI_REGISTER_H_INCLUDED

View File

@ -704,7 +704,6 @@
#define USE_DISPLAY_ILI9341 // [DisplayModel 4] Enable ILI9341 Tft 480x320 display (+19k code)
// #define USE_DISPLAY_EPAPER_29 // [DisplayModel 5] Enable e-paper 2.9 inch display (+19k code)
// #define USE_DISPLAY_EPAPER_42 // [DisplayModel 6] Enable e-paper 4.2 inch display
// #define USE_DISPLAY_ILI9488 // [DisplayModel 8] [I2cDriver38] (Touch)
// #define USE_DISPLAY_SSD1351 // [DisplayModel 9] Enable SSD1351 module
// #define USE_DISPLAY_RA8876 // [DisplayModel 10] [I2cDriver39] (Touch)
// #define USE_DISPLAY_ST7789 // [DisplayModel 12] Enable ST7789 module

View File

@ -673,9 +673,9 @@ void ResponseAppendFeatures(void)
#if defined(USE_SPI) && defined(USE_DISPLAY) && defined(USE_DISPLAY_EPAPER_42)
feature7 |= 0x00008000; // xdsp_06_epaper_42.ino
#endif
#if defined(USE_SPI) && defined(USE_DISPLAY) && defined(USE_DISPLAY_ILI9488)
feature7 |= 0x00010000; // xdsp_08_ILI9488.ino
#endif
// #if defined(USE_SPI) && defined(USE_DISPLAY) && defined(USE_DISPLAY_ILI9488)
// feature7 |= 0x00010000; // xdsp_08_ILI9488.ino
// #endif
#if defined(USE_SPI) && defined(USE_DISPLAY) && defined(USE_DISPLAY_SSD1351)
feature7 |= 0x00020000; // xdsp_09_SSD1351.ino
#endif

View File

@ -330,7 +330,7 @@
#define USE_DISPLAY_ILI9341 // [DisplayModel 4] Enable ILI9341 Tft 480x320 display (+19k code)
#define USE_DISPLAY_EPAPER_29 // [DisplayModel 5] Enable e-paper 2.9 inch display (+19k code)
#define USE_DISPLAY_EPAPER_42 // [DisplayModel 6] Enable e-paper 4.2 inch display
#define USE_DISPLAY_ILI9488 // [DisplayModel 8]
// #define USE_DISPLAY_ILI9488 // [DisplayModel 8]
#define USE_DISPLAY_SSD1351 // [DisplayModel 9]
#define USE_DISPLAY_RA8876 // [DisplayModel 10]
#define USE_DISPLAY_ST7789 // [DisplayModel 12] Enable ST7789 module

View File

@ -67,7 +67,7 @@ struct MULTI_DISP {
uint8_t used;
} displays[MAX_MULTI_DISPLAYS];
uint8_t cur_display;
Renderer *Init_uDisplay(const char *desc, int8_t cs = -1);
Renderer *Init_uDisplay(const char *desc);
void Set_display(uint8_t index) {
displays[index].display = renderer;

View File

@ -24,7 +24,7 @@
#include <berry.h>
#ifdef USE_UNIVERSAL_DISPLAY
Renderer *Init_uDisplay(const char *desc, int8_t cs = -1);
Renderer *Init_uDisplay(const char *desc);
#endif // USE_UNIVERSAL_DISPLAY
/*********************************************************************************************\

View File

@ -1,167 +0,0 @@
/*
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
#define XDSP_08 8
#define XI2C_38 38 // See I2CDEVICES.md
#define COLORED 1
#define UNCOLORED 0
// using font 8 is opional (num=3)
// very badly readable, but may be useful for graphs
#define USE_TINY_FONT
#include <ILI9488.h>
uint8_t ili9488_ctouch_counter = 0;
bool ili9488_init_done = false;
// currently fixed
#define BACKPLANE_PIN 2
extern uint8_t color_type;
ILI9488 *ili9488;
extern const uint16_t picture[];
/*********************************************************************************************/
void ILI9488_InitDriver(void) {
if (PinUsed(GPIO_ILI9488_CS) && (TasmotaGlobal.spi_enabled & SPI_MOSI)) {
Settings->display_model = XDSP_08;
if (Settings->display_width != ILI9488_TFTWIDTH) {
Settings->display_width = ILI9488_TFTWIDTH;
}
if (Settings->display_height != ILI9488_TFTHEIGHT) {
Settings->display_height = ILI9488_TFTHEIGHT;
}
// default colors
fg_color = ILI9488_WHITE;
bg_color = ILI9488_BLACK;
int8_t bppin = BACKPLANE_PIN;
if (PinUsed(GPIO_BACKLIGHT)) {
bppin = Pin(GPIO_BACKLIGHT);
}
// init renderer, must use hardware spi
ili9488 = new ILI9488(Pin(GPIO_ILI9488_CS), Pin(GPIO_SPI_MOSI), Pin(GPIO_SPI_CLK), bppin);
ili9488->begin();
renderer = ili9488;
renderer->DisplayInit(DISPLAY_INIT_MODE,Settings->display_size,Settings->display_rotate,Settings->display_font);
renderer->dim(GetDisplayDimmer16());
#ifdef SHOW_SPLASH
// Welcome text
renderer->setTextFont(2);
renderer->setTextColor(ILI9488_WHITE,ILI9488_BLACK);
renderer->DrawStringAt(50, 50, "ILI9488 TFT Display!", ILI9488_WHITE,0);
delay(1000);
//renderer->drawRGBBitmap(100,100, picture,51,34);
#endif
color_type = COLOR_COLOR;
// start digitizer
#ifdef USE_FT5206
FT5206_Touch_Init(Wire);
#endif
ili9488_init_done = true;
AddLog(LOG_LEVEL_INFO, PSTR("DSP: ILI9488"));
}
}
#ifdef USE_FT5206
#ifdef USE_TOUCH_BUTTONS
void ILI9488_RotConvert(int16_t *x, int16_t *y) {
int16_t temp;
if (renderer) {
uint8_t rot=renderer->getRotation();
switch (rot) {
case 0:
temp=*y;
*y=renderer->height()-*x;
*x=temp;
break;
case 1:
break;
case 2:
break;
case 3:
temp=*y;
*y=*x;
*x=renderer->width()-temp;
break;
}
}
}
// check digitizer hit
void ILI9488_CheckTouch(void) {
ili9488_ctouch_counter++;
if (2 == ili9488_ctouch_counter) {
// every 100 ms should be enough
ili9488_ctouch_counter = 0;
Touch_Check(ILI9488_RotConvert);
}
}
#endif // USE_TOUCH_BUTTONS
#endif // USE_FT5206
/*********************************************************************************************/
/*********************************************************************************************\
* 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_TOUCH_BUTTONS
if (FT5206_found) {
ILI9488_CheckTouch();
}
#endif
break;
}
}
return result;
}
#endif // USE_DISPLAY_ILI9488
#endif // USE_DISPLAY
#endif // USE_SPI

View File

@ -1,111 +0,0 @@
/*
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 = -1);
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

View File

@ -62,10 +62,11 @@ void Core2DisplayDim(uint8_t dim);
const char DSP_SAMPLE_DESC[] PROGMEM = DSP_ROM_DESC
#endif // DSP_ROM_DESC
/*********************************************************************************************/
Renderer *Init_uDisplay(const char *desc, int8_t cs) {
Renderer *Init_uDisplay(const char *desc) {
char *ddesc = 0;
char *fbuff;
uDisplay *udisp;
int8_t cs;
if (TasmotaGlobal.gpio_optiona.udisplay_driver || desc) {
@ -185,18 +186,16 @@ 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;
}
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;