diff --git a/BUILDS.md b/BUILDS.md index c127f4335..4f9aed466 100644 --- a/BUILDS.md +++ b/BUILDS.md @@ -251,9 +251,7 @@ Note: the `minimal` variant is not listed as it shouldn't be used outside of the | USE_DISPLAY_MATRIX | - | - / - | - | - | - | x | | USE_DISPLAY_EPAPER_29 | - | - / - | - | - | - | x | | USE_DISPLAY_EPAPER_42 | - | - / - | - | - | - | x | -| USE_DISPLAY_SSD1351 | - | - / - | - | - | - | x | | USE_DISPLAY_RA8876 | - | - / - | - | - | - | x | -| USE_DISPLAY_ST7789 | - | - / - | - | - | - | x | | USE_DISPLAY_TM1637 | - | - / - | - | - | - | x | | USE_DISPLAY_TM1621_SONOFF | - | - / x | - | - | - | - | | USE_DISPLAY_TM1650 | - | - / - | - | - | - | - | @@ -277,6 +275,6 @@ Note: the `minimal` variant is not listed as it shouldn't be used outside of the | USE_DINGTIAN_RELAY | | / - | | | | | | USE_MATTER_DEVICE | | / x | | | | | See SetOption151 | -The following specific display drivers are replaced with uDisplay, see [uDisplay/uTouch documentation](https://tasmota.github.io/docs/Universal-Display-Driver/#migrating-to-udisplay): `USE_DISPLAY_ILI9341`, `USE_DISPLAY_SSD1306`, `USE_DISPLAY_SH1106` +The following specific display drivers are replaced with uDisplay, see [uDisplay/uTouch documentation](https://tasmota.github.io/docs/Universal-Display-Driver/#migrating-to-udisplay): `USE_DISPLAY_ILI9341`, `USE_DISPLAY_SSD1306`, `USE_DISPLAY_SH1106`, `USE_DISPLAY_SSD1351`, `USE_DISPLAY_ST7789` - USE_MQTT_TLS is enabled by default in every ESP32 variants diff --git a/CHANGELOG.md b/CHANGELOG.md index efc90a4d7..d63eab517 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,8 @@ All notable changes to this project will be documented in this file. - SSD1306 driver replaced with uDisplay (#21176) - SSD1331 driver replaced with uDisplay (#21177) - SSH1106 driver replaced with uDisplay (#21183) +- SSD1351 driver replaced with uDisplay +- ST7789 driver replaced with uDisplay ## [13.4.0.3] 20240402 ### Added diff --git a/lib/lib_display/Adafruit_SSD1351-gemu-1.0/README.md b/lib/lib_display/Adafruit_SSD1351-gemu-1.0/README.md deleted file mode 100644 index 6414419d0..000000000 --- a/lib/lib_display/Adafruit_SSD1351-gemu-1.0/README.md +++ /dev/null @@ -1,2 +0,0 @@ -### SSD3115 Arduino Library -This library is for support for the 128x128 oled controller over 3 wire SPI. It is based heavily on the [Adafruit_SSD1351](https://github.com/adafruit/Adafruit-SSD1351-library) library and is designed to work with the [Adafruit_GFX library](https://github.com/adafruit/Adafruit-GFX-Library). diff --git a/lib/lib_display/Adafruit_SSD1351-gemu-1.0/SSD1351.cpp b/lib/lib_display/Adafruit_SSD1351-gemu-1.0/SSD1351.cpp deleted file mode 100644 index 274b030b2..000000000 --- a/lib/lib_display/Adafruit_SSD1351-gemu-1.0/SSD1351.cpp +++ /dev/null @@ -1,588 +0,0 @@ -/*************************************************** - This is our library for the Adafruit SSD1351 Breakout and Shield - - 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 -#include "SSD1351.h" -#include -#include - - -const uint16_t ssd1351_colors[]={SSD1351_BLACK,SSD1351_WHITE,SSD1351_RED,SSD1351_GREEN,SSD1351_BLUE,SSD1351_CYAN,SSD1351_MAGENTA,\ - SSD1351_YELLOW,SSD1351_NAVY,SSD1351_DARKGREEN,SSD1351_DARKCYAN,SSD1351_MAROON,SSD1351_PURPLE,SSD1351_OLIVE,\ -SSD1351_LIGHTGREY,SSD1351_DARKGREY,SSD1351_ORANGE,SSD1351_GREENYELLOW,SSD1351_PINK}; - -// Constructor when using software SPI. All output pins are configurable. -SSD1351::SSD1351(int8_t cs,int8_t mosi,int8_t sclk, int8_t dc) : Renderer(SSD1351_WIDTH, SSD1351_HEIGHT) { - _cs = cs; - _mosi = mosi; - _sclk = sclk; - _hwspi = 0; - _dc = dc; -} - -#ifndef ESP32 - -#include "spi_register.h" - -/* CPU Clock = 80 Mhz -max clock of display is 4.545 Mhz (220ns sclk cycle) -so cpu/18 => 4.44 Mhz should be ok -HSPI CLK 5 GPIO14 -HSPI /CS 8 GPIO15 -HSPI MOSI 7 GPIO13 -*/ - -uint8_t ssd131_start; - -uint32_t ssd1351_clock; -uint32_t ssd1351_usr; -uint32_t ssd1351_usr1; -uint32_t ssd1351_usr2; -uint32_t ssd1351_spi1c; -uint32_t ssd1351_spi1p; -//uint32_t ssd1351_gpmux; -uint32_t ssd1351_mtdo; - - -uint32_t ssd1351_clock_prev; -uint32_t ssd1351_usr_prev; -uint32_t ssd1351_usr1_prev; -uint32_t ssd1351_usr2_prev; -uint32_t ssd1351_spi1c_prev; -uint32_t ssd1351_spi1p_prev; -//uint32_t ssd1351_gpmux_prev; -uint32_t ssd1351_mtdo_prev; - -// code from espressif SDK -/****************************************************************************** - * FunctionName : spi_lcd_mode_init - * Description : SPI master initial function for driving LCD 3 wire spi -*******************************************************************************/ -void SSD1351::spi_lcd_mode_init(void) { - uint32 regvalue; - - if (_dc >= 0) { - spis = SPISettings(40000000, MSBFIRST, SPI_MODE0); - } else { - ssd1351_clock_prev=SPI1CLK; - ssd1351_usr_prev=SPI1U; - ssd1351_usr1_prev=SPI1U1; - ssd1351_usr2_prev=SPI1U2; - ssd1351_spi1c_prev=SPI1C; - ssd1351_spi1p_prev=SPI1P; - //ssd1351_gpmux_prev=GPMUX; - ssd1351_mtdo_prev=READ_PERI_REG(PERIPHS_IO_MUX_MTDO_U); - - SPI1U = SPIUMOSI | SPIUDUPLEX | SPIUSSE; - SPI1U1=0; - SPI1C = 0; - - //bit9 of PERIPHS_IO_MUX should be cleared when HSPI clock doesn't equal CPU clock - //bit8 of PERIPHS_IO_MUX should be cleared when SPI clock doesn't equal CPU clock - - WRITE_PERI_REG(PERIPHS_IO_MUX, 0x105); //clear bit9 - //PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U, 2);//configure miso to spi mode - PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, 2);//configure mosi to spi mode - PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTMS_U, 2);//configure sclk to spi mode - PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U, 2);//configure cs to spi mode - -// the current implementation leaves about 1 us between transfers ???? -// due to lack of documentation i could not find the reason -// skipping this would double the speed !!! - - //SET_PERI_REG_MASK(SPI_USER(1), SPI_CS_SETUP|SPI_CS_HOLD|SPI_USR_COMMAND); - - SET_PERI_REG_MASK(SPI_USER(1), SPI_USR_COMMAND); - - CLEAR_PERI_REG_MASK(SPI_USER(1), SPI_FLASH_MODE); - // SPI clock=CPU clock/8 => 10 Mhz - /* - WRITE_PERI_REG(SPI_CLOCK(1), - ((1&SPI_CLKDIV_PRE)<= 0) { - SPI.beginTransaction(spis); - } else { - while(READ_PERI_REG(SPI_CMD(1))&SPI_USR); - SPI1CLK=ssd1351_clock; - SPI1U=ssd1351_usr; - SPI1U1=ssd1351_usr1; - SPI1U2=ssd1351_usr2; - SPI1C=ssd1351_spi1c; - SPI1P=ssd1351_spi1p; - //GPMUX=ssd1351_gpmux; - WRITE_PERI_REG(PERIPHS_IO_MUX_MTDO_U,ssd1351_mtdo); - } - ssd131_start = 1; -} - -void SSD1351::stop(void) { - if (!ssd131_start) return; - - if (_dc >= 0) { - SPI.endTransaction(); - } else { - //while(SPI1CMD & SPIBUSY) {} - while(READ_PERI_REG(SPI_CMD(1))&SPI_USR); - SPI1CLK=ssd1351_clock_prev; - SPI1U=ssd1351_usr_prev; - SPI1U1=ssd1351_usr1_prev; - SPI1U2=ssd1351_usr2_prev; - SPI1C=ssd1351_spi1c_prev; - SPI1P=ssd1351_spi1p_prev; - //GPMUX=ssd1351_gpmux_prev; - WRITE_PERI_REG(PERIPHS_IO_MUX_MTDO_U,ssd1351_mtdo_prev); - } - ssd131_start = 0; -} - -// dc = 0 -void SSD1351::writecommand(uint8_t c) { - if (_hwspi) { - uint32_t regvalue; - uint8_t bytetemp; - start(); -//#define SPI_USR_COMMAND_BITLEN 0x0000000F -//#define SPI_USR_COMMAND_BITLEN_S 28 - if (_dc >= 0) { - digitalWrite(_dc, LOW); - SPI.transfer(c); - } else { - bytetemp = (c >> 1) & 0x7f; - regvalue= ((8&SPI_USR_COMMAND_BITLEN)<= 0) { - digitalWrite(_dc, HIGH); - SPI.transfer(d); - } else { - bytetemp = (d >> 1) | 0x80; - regvalue= ((8&SPI_USR_COMMAND_BITLEN)<= 0) { - digitalWrite(_dc, dc); - WRITE_PERI_REG( PIN_OUT_CLEAR, 1<<_sclk); - for(uint8_t bit = 0x80; bit; bit >>= 1) { - WRITE_PERI_REG( PIN_OUT_CLEAR, 1<<_sclk); - if(d&bit) WRITE_PERI_REG( PIN_OUT_SET, 1<<_mosi); - else WRITE_PERI_REG( PIN_OUT_CLEAR, 1<<_mosi); - WRITE_PERI_REG( PIN_OUT_SET, 1<<_sclk); - } - } else { - WRITE_PERI_REG( PIN_OUT_CLEAR, 1<<_sclk); - if(dc) WRITE_PERI_REG( PIN_OUT_SET, 1<<_mosi); - else WRITE_PERI_REG( PIN_OUT_CLEAR, 1<<_mosi); - WRITE_PERI_REG( PIN_OUT_SET, 1<<_sclk); - for(uint8_t bit = 0x80; bit; bit >>= 1) { - WRITE_PERI_REG( PIN_OUT_CLEAR, 1<<_sclk); - if(d&bit) WRITE_PERI_REG( PIN_OUT_SET, 1<<_mosi); - else WRITE_PERI_REG( PIN_OUT_CLEAR, 1<<_mosi); - WRITE_PERI_REG( PIN_OUT_SET, 1<<_sclk); - } - } - WRITE_PERI_REG( PIN_OUT_SET, 1 << _cs); -} - -#else -// ESP32 section -uint8_t ssd131_start; - -void SSD1351::writedata(uint8_t d) { - fastSPIwrite(d, 1); -} - -void SSD1351::writecommand(uint8_t c) { - fastSPIwrite(c, 0); -} - -#include "soc/spi_reg.h" -#include "soc/spi_struct.h" -#include "esp32-hal-spi.h" -#include "esp32-hal.h" -#include "soc/spi_struct.h" - -// diconnect from spi -void SSD1351::start(void) { - if (ssd131_start) return; - SPI.beginTransaction(spis); - ssd131_start = 1; -} - -// reconnect to spi -void SSD1351::stop(void) { - if (!ssd131_start) return; - SPI.endTransaction(); - ssd131_start = 0; -} - -// since ardunio transferBits ia completely disfunctional -// we use our own hardware driver for 9 bit spi -void SSD1351::fastSPIwrite(uint8_t d, uint8_t dc) { - - digitalWrite( _cs, LOW); - if (_dc >= 0) { - digitalWrite(_dc, dc); - SPI.transfer(d); - } else { - uint32_t regvalue = d >> 1; - if (dc) regvalue |= 0x80; - else regvalue &= 0x7f; - if (d & 1) regvalue |= 0x8000; - - REG_SET_BIT(SPI_USER_REG(3), SPI_USR_MOSI); - REG_WRITE(SPI_MOSI_DLEN_REG(3), 9 - 1); - uint32_t *dp=(uint32_t*)SPI_W0_REG(3); - *dp = regvalue; - REG_SET_BIT(SPI_CMD_REG(3), SPI_USR); - while (REG_GET_FIELD(SPI_CMD_REG(3), SPI_USR)); - } - digitalWrite( _cs, HIGH); -} - -#endif - - -static const uint8_t PROGMEM initList[] = { - SSD1351_CMD_COMMANDLOCK, 1, // Set command lock, 1 arg - 0x12, - SSD1351_CMD_COMMANDLOCK, 1, // Set command lock, 1 arg - 0xB1, - SSD1351_CMD_DISPLAYOFF, 0, // Display off, no args - SSD1351_CMD_CLOCKDIV, 1, - 0xF1, // 7:4 = Oscillator Freq, 3:0 = CLK Div Ratio (A[3:0]+1 = 1..16) - SSD1351_CMD_MUXRATIO, 1, - 127, - SSD1351_CMD_DISPLAYOFFSET, 1, - 0x0, - SSD1351_CMD_SETGPIO, 1, - 0x00, - SSD1351_CMD_FUNCTIONSELECT, 1, - 0x01, // internal (diode drop) - SSD1351_CMD_PRECHARGE, 1, - 0x32, - SSD1351_CMD_VCOMH, 1, - 0x05, - SSD1351_CMD_STARTLINE, 1, - 0x00, - SSD1351_CMD_NORMALDISPLAY, 0, - SSD1351_CMD_CONTRASTABC, 3, - 0xC8, 0x80, 0xC8, - SSD1351_CMD_CONTRASTMASTER, 1, - 0x0F, - SSD1351_CMD_SETVSL, 3, - 0xA0, 0xB5, 0x55, - SSD1351_CMD_PRECHARGE2, 1, - 0x01, - SSD1351_CMD_HORIZSCROLL, 1, - 0x00, - SSD1351_CMD_STOPSCROLL, 0, - SSD1351_CMD_DISPLAYON, 0, // Main screen turn on - 0 }; // END OF COMMAND LIST - - -void SSD1351::begin(void) { - pinMode(_cs, OUTPUT); - digitalWrite(_cs,HIGH); - pinMode(_sclk, OUTPUT); - digitalWrite(_sclk, LOW); - pinMode(_mosi, OUTPUT); - digitalWrite(_mosi, LOW); - - if (_dc >= 0) { - pinMode(_dc, OUTPUT); - digitalWrite(_dc, LOW); - } - - -#ifndef ESP32 - if ((_sclk == 14) && (_mosi == 13) && (_cs == 15)) { - // we use hardware spi - _hwspi = 1; - SPI.begin(); - spi_lcd_mode_init(); - } else { - // we must use software spi - _hwspi = 0; - } -#else - _hwspi = 1; - SPI.begin(_sclk, -1, _mosi, -1); - spis = SPISettings(4500000, MSBFIRST, SPI_MODE3); -#endif - - const uint8_t *addr = (const uint8_t *)initList; - uint8_t cmd, x, numArgs; - - while ((cmd = pgm_read_byte(addr++)) > 0) { // '0' command ends list - x = pgm_read_byte(addr++); - numArgs = x & 0x7F; - if (cmd != 0xFF) { // '255' is ignored - sendcommand(cmd, addr, numArgs); - } - addr += numArgs; - } - delay(100); - setRotation(0); - stop(); -} - - -void SSD1351::sendcommand(uint8_t commandByte, const uint8_t *dataBytes, uint8_t numDataBytes) { - writecommand(commandByte); - for (int i=0; i=sizeof(ssd1351_colors)/2) index=0; - return ssd1351_colors[index]; -} - -void SSD1351::DisplayInit(int8_t p,int8_t size,int8_t rot,int8_t font) { - setRotation(rot); - invertDisplay(false); - setTextWrap(false); // Allow text to run off edges - cp437(true); - setTextFont(font&3); - setTextSize(size&7); - setTextColor(SSD1351_WHITE,SSD1351_BLACK); - setCursor(0,0); - fillScreen(SSD1351_BLACK); - stop(); -} - -void SSD1351::DisplayOnff(int8_t on) { - if (on) { - writecommand(SSD1351_CMD_DISPLAYON); //Display on - } else { - writecommand(SSD1351_CMD_DISPLAYOFF); - } - stop(); -} - -// dimmer 0-100 -void SSD1351::dim(uint8_t contrast) { - writecommand(SSD1351_CMD_CONTRASTMASTER); - if (contrast>15) contrast=15; - writedata(contrast); - stop(); -} - -#define ssd1351_swap(a, b) (((a) ^= (b)), ((b) ^= (a)), ((a) ^= (b))) ///< No-temp-var swap operation - - -void SSD1351::setAddrWindow_i(uint16_t x1, uint16_t y1, uint16_t w, uint16_t h) { - uint16_t x2 = x1 + w - 1, - y2 = y1 + h - 1; - if (rotation&1) { // Vertical address increment mode - ssd1351_swap(x1,y1); - ssd1351_swap(x2,y2); - } - writecommand(SSD1351_CMD_SETCOLUMN); // X range - writedata(x1); - writedata(x2); - writecommand(SSD1351_CMD_SETROW); // Y range - writedata(y1); - writedata(y2); - writecommand(SSD1351_CMD_WRITERAM); // Begin write -} - -void SSD1351::write16BitColor(uint16_t color){ - writedata(color>>8); - writedata(color&0xff); -} - -#define MADCTL_MY 0x80 -#define MADCTL_MX 0x40 -#define MADCTL_MV 0x20 -#define MADCTL_ML 0x10 -#define MADCTL_RGB 0x00 -#define MADCTL_BGR 0x08 -#define MADCTL_MH 0x04 - -void SSD1351::setRotation(uint8_t r) { - // madctl bits: - // 6,7 Color depth (01 = 64K) - // 5 Odd/even split COM (0: disable, 1: enable) - // 4 Scan direction (0: top-down, 1: bottom-up) - // 3 Reserved - // 2 Color remap (0: A->B->C, 1: C->B->A) - // 1 Column remap (0: 0-127, 1: 127-0) - // 0 Address increment (0: horizontal, 1: vertical) - uint8_t madctl = 0b01100100; // 64K, enable split, CBA - - rotation = r & 3; // Clip input to valid range - - switch(rotation) { - case 0: - madctl |= 0b00010000; // Scan bottom-up - _width = SSD1351_WIDTH; - _height = SSD1351_HEIGHT; - break; - case 1: - madctl |= 0b00010011; // Scan bottom-up, column remap 127-0, vertical - _width = SSD1351_HEIGHT; - _height = SSD1351_WIDTH; - break; - case 2: - madctl |= 0b00000010; // Column remap 127-0 - _width = SSD1351_WIDTH; - _height = SSD1351_HEIGHT; - break; - case 3: - madctl |= 0b00000001; // Vertical - _width = SSD1351_HEIGHT; - _height = SSD1351_WIDTH; - break; - } - - sendcommand(SSD1351_CMD_SETREMAP, &madctl, 1); - uint8_t startline = (rotation < 2) ? SSD1351_HEIGHT : 0; - sendcommand(SSD1351_CMD_STARTLINE, &startline, 1); - stop(); -} - -void SSD1351::invertDisplay(boolean i) { - writecommand(i ? SSD1351_CMD_INVERTDISPLAY : SSD1351_CMD_NORMALDISPLAY); - stop(); -} - -void SSD1351::drawPixel(int16_t x, int16_t y, uint16_t color) { - if((x < 0) ||(x >= _width) || (y < 0) || (y >= _height)) return; - setAddrWindow_i(x,y,1,1); - write16BitColor(color); - stop(); -} - -void SSD1351::setAddrWindow(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) { - // uint16_t x2 = x1 + w - 1, - // y2 = y1 + h - 1; - uint8_t flag=0; - - if (!x1 && !y1 && !x2 && !y2) { - x1=0; - y1=0; - x2=_width; - y2=_height; - flag=1; - } - - if (x2>_width) x2=_width; - if (y2>_height) y2=_height; - - x2--; - y2--; - if (rotation&1) { // Vertical address increment mode - ssd1351_swap(x1,y1); - ssd1351_swap(x2,y2); - } - //Serial.printf("x1:%d x2:%d y1:%d y2:%d\n",x1,x2,y1,y2); - writecommand(SSD1351_CMD_SETCOLUMN); // X range - writedata(x1); - writedata(x2); - writecommand(SSD1351_CMD_SETROW); // Y range - writedata(y1); - writedata(y2); - writecommand(SSD1351_CMD_WRITERAM); // Begin write - if (flag) stop(); -} - -void SSD1351::pushColors(uint16_t *data, uint16_t len, boolean first) { - for (uint16_t b=0; b= _width) || (y >= _height)) return; - if ((y+h-1) >= _height) h = _height-y; - - setAddrWindow_i(x,y,1,h); - while (h--) { - write16BitColor(color); - } - stop(); -} - -void SSD1351::drawFastHLine(int16_t x,int16_t y,int16_t w,uint16_t color) { - // Rudimentary clipping - if ((x >= _width) || (y >= _height)) return; - if ((x+w-1) >= _width) w = _width-x; - - setAddrWindow_i(x,y,w,1); - while (w--) { - write16BitColor(color); - } - stop(); -} diff --git a/lib/lib_display/Adafruit_SSD1351-gemu-1.0/SSD1351.h b/lib/lib_display/Adafruit_SSD1351-gemu-1.0/SSD1351.h deleted file mode 100644 index ad81fc240..000000000 --- a/lib/lib_display/Adafruit_SSD1351-gemu-1.0/SSD1351.h +++ /dev/null @@ -1,130 +0,0 @@ -/*************************************************** - This is our library for the Adafruit SSD1351 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, 3 pins are required to - interface - 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 _SSD1351_ -#define _SSD1351_ - -#if ARDUINO >= 100 - #include "Arduino.h" - #include "Print.h" -#else - #include "WProgram.h" -#endif - -#include -#include - - - -#define SSD1351_WIDTH 128 -#define SSD1351_HEIGHT 128 - - -// Color definitions -#define SSD1351_BLACK 0x0000 /* 0, 0, 0 */ -#define SSD1351_NAVY 0x000F /* 0, 0, 128 */ -#define SSD1351_DARKGREEN 0x03E0 /* 0, 128, 0 */ -#define SSD1351_DARKCYAN 0x03EF /* 0, 128, 128 */ -#define SSD1351_MAROON 0x7800 /* 128, 0, 0 */ -#define SSD1351_PURPLE 0x780F /* 128, 0, 128 */ -#define SSD1351_OLIVE 0x7BE0 /* 128, 128, 0 */ -#define SSD1351_LIGHTGREY 0xC618 /* 192, 192, 192 */ -#define SSD1351_DARKGREY 0x7BEF /* 128, 128, 128 */ -#define SSD1351_BLUE 0x001F /* 0, 0, 255 */ -#define SSD1351_GREEN 0x07E0 /* 0, 255, 0 */ -#define SSD1351_CYAN 0x07FF /* 0, 255, 255 */ -#define SSD1351_RED 0xF800 /* 255, 0, 0 */ -#define SSD1351_MAGENTA 0xF81F /* 255, 0, 255 */ -#define SSD1351_YELLOW 0xFFE0 /* 255, 255, 0 */ -#define SSD1351_WHITE 0xFFFF /* 255, 255, 255 */ -#define SSD1351_ORANGE 0xFD20 /* 255, 165, 0 */ -#define SSD1351_GREENYELLOW 0xAFE5 /* 173, 255, 47 */ -#define SSD1351_PINK 0xF81F - -#define SSD1351_CMD_SETCOLUMN 0x15 -#define SSD1351_CMD_SETROW 0x75 -#define SSD1351_CMD_WRITERAM 0x5C -#define SSD1351_CMD_READRAM 0x5D -#define SSD1351_CMD_SETREMAP 0xA0 -#define SSD1351_CMD_STARTLINE 0xA1 -#define SSD1351_CMD_DISPLAYOFFSET 0xA2 -#define SSD1351_CMD_DISPLAYALLOFF 0xA4 -#define SSD1351_CMD_DISPLAYALLON 0xA5 -#define SSD1351_CMD_NORMALDISPLAY 0xA6 -#define SSD1351_CMD_INVERTDISPLAY 0xA7 -#define SSD1351_CMD_FUNCTIONSELECT 0xAB -#define SSD1351_CMD_DISPLAYOFF 0xAE -#define SSD1351_CMD_DISPLAYON 0xAF -#define SSD1351_CMD_PRECHARGE 0xB1 -#define SSD1351_CMD_DISPLAYENHANCE 0xB2 -#define SSD1351_CMD_CLOCKDIV 0xB3 -#define SSD1351_CMD_SETVSL 0xB4 -#define SSD1351_CMD_SETGPIO 0xB5 -#define SSD1351_CMD_PRECHARGE2 0xB6 -#define SSD1351_CMD_SETGRAY 0xB8 -#define SSD1351_CMD_USELUT 0xB9 -#define SSD1351_CMD_PRECHARGELEVEL 0xBB -#define SSD1351_CMD_VCOMH 0xBE -#define SSD1351_CMD_CONTRASTABC 0xC1 -#define SSD1351_CMD_CONTRASTMASTER 0xC7 -#define SSD1351_CMD_MUXRATIO 0xCA -#define SSD1351_CMD_COMMANDLOCK 0xFD -#define SSD1351_CMD_HORIZSCROLL 0x96 -#define SSD1351_CMD_STOPSCROLL 0x9E -#define SSD1351_CMD_STARTSCROLL 0x9F - - -#define PIN_OUT_SET 0x60000304 -#define PIN_OUT_CLEAR 0x60000308 - -class SSD1351 : public Renderer { - - public: - - SSD1351(int8_t cs,int8_t mosi,int8_t sclk, int8_t dc); - - void begin(void); - void DisplayInit(int8_t p,int8_t size,int8_t rot,int8_t font); - void setAddrWindow_i(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 pushColors(uint16_t *data, uint16_t len, boolean first); - void drawPixel(int16_t x, int16_t y, uint16_t color); - void write16BitColor(uint16_t color); - void setRotation(uint8_t r); - void invertDisplay(boolean i); - uint16_t GetColorFromIndex(uint8_t index); - void DisplayOnff(int8_t on); - void writecommand(uint8_t c); - void writedata(uint8_t d); - void commandList(uint8_t *addr); - void hw_spi_init(); - void sendcommand(uint8_t commandByte, const uint8_t *dataBytes, uint8_t numDataBytes); - void sendcommand(uint8_t commandByte,uint8_t *dataBytes, uint8_t numDataBytes); - 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 spi_lcd_mode_init(void); - void dim(uint8_t contrast); - - private: - uint8_t tabcolor; - SPISettings spis; - void fastSPIwrite(uint8_t d,uint8_t dc); - void start(void); - void stop(void); - int8_t _cs, _mosi, _sclk, _hwspi, _dc; - -}; - -#endif diff --git a/lib/lib_display/Adafruit_SSD1351-gemu-1.0/Tiger.c b/lib/lib_display/Adafruit_SSD1351-gemu-1.0/Tiger.c deleted file mode 100644 index 83e0ba9bf..000000000 --- a/lib/lib_display/Adafruit_SSD1351-gemu-1.0/Tiger.c +++ /dev/null @@ -1,42 +0,0 @@ -#include -// picture with 51 x 34 pixels -// table size 3468 bytes -#if 0 -const uint16_t picture[] = { -0x0000,0x0841,0x0841,0x0840,0x0841,0x0841,0x1041,0x1041,0x1041,0x1041,0x1041,0x1880,0x1041,0x1041,0x1040,0x1041,0x1881,0x1880,0x1880,0x1880,0x2081,0x2081,0x2080,0x20c1,0x3942,0x3942,0x3101,0x2080,0x2881,0x2880,0x2881,0x2881,0x2881,0x2880,0x2881,0x30c1,0x30c1,0x1840,0x2881,0x30c1,0x3901,0x3941,0x3901,0x3101,0x3101,0x3101,0x3101,0x3101,0x4182,0x4182,0x0000, -0x0000,0x0841,0x0841,0x0841,0x1881,0x1881,0x1881,0x1881,0x1881,0x1881,0x2081,0x28c1,0x2081,0x2080,0x2081,0x2081,0x28c1,0x28c1,0x2901,0x3101,0x3101,0x3101,0x3101,0x3942,0x5a04,0x6244,0x6244,0x51c2,0x4101,0x4101,0x4101,0x4101,0x3901,0x4101,0x4101,0x5181,0x4941,0x59c2,0x4141,0x30c1,0x4941,0x4982,0x38c1,0x5182,0x4141,0x4101,0x4941,0x5182,0x5182,0x6a43,0x0000, -0x0000,0x1041,0x0841,0x1041,0x1881,0x20c1,0x2081,0x20c1,0x2081,0x28c1,0x20c1,0x2901,0x2081,0x2081,0x20c1,0x28c1,0x28c1,0x3101,0x3101,0x3101,0x3101,0x3941,0x3942,0x4183,0x5a45,0x6244,0x6a85,0x6a84,0x5a03,0x4141,0x4101,0x4101,0x4101,0x4101,0x4101,0x4101,0x4101,0x4941,0x4141,0x59c2,0x2880,0x38c1,0x4941,0x4941,0x4141,0x4941,0x5181,0x5182,0x6203,0x6203,0x0000, -0x0000,0x20c1,0x1041,0x1881,0x2901,0x3142,0x20c1,0x28c1,0x2901,0x2901,0x2901,0x2901,0x2901,0x2901,0x3101,0x3101,0x3141,0x3942,0x4182,0x4182,0x49c3,0x49c3,0x5204,0x5a45,0x5a45,0x5a45,0x6245,0x6245,0x5a45,0x5a04,0x51c2,0x4141,0x4101,0x4101,0x4101,0x6244,0x8388,0x5a04,0x4101,0x4101,0x4901,0x5182,0x30c1,0x4982,0x4982,0x5182,0x4941,0x4941,0x5181,0x4141,0x0000, -0x0000,0x1881,0x1041,0x1881,0x2101,0x2902,0x28c1,0x2901,0x2901,0x2901,0x2901,0x28c1,0x20c1,0x20c1,0x28c1,0x28c1,0x28c1,0x3942,0x4182,0x4141,0x4182,0x4982,0x4982,0x51c3,0x51c3,0x51c3,0x51c3,0x51c3,0x51c3,0x51c3,0x5a04,0x51c3,0x4982,0x4141,0x9c09,0xd612,0xbd50,0xa48c,0x4100,0x4101,0x4101,0x4101,0x59c2,0x4981,0x3901,0x3901,0x3901,0x4941,0x4101,0x5182,0x0000, -0x0000,0x1881,0x1041,0x1881,0x2902,0x2902,0x2902,0x3142,0x3102,0x3102,0x2901,0x28c1,0x28c1,0x28c1,0x28c1,0x28c1,0x3942,0x51c3,0x6a84,0x3941,0x4182,0x4982,0x4982,0x5a03,0x5a03,0x6244,0x5a04,0x51c3,0x51c3,0x5a03,0x5a44,0x5204,0x3942,0x9bc8,0xcd8f,0xc590,0xc5d1,0xcdd2,0x4100,0x4101,0x4101,0x4101,0x4941,0x4941,0x5182,0x3101,0x4941,0x4941,0x4941,0x4941,0x0000, -0x0000,0x1881,0x1041,0x1881,0x3142,0x3142,0x3102,0x3142,0x3142,0x3102,0x3101,0x28c1,0x28c1,0x28c1,0x28c1,0x5204,0x8bc9,0xbd4f,0xcdd1,0xcdd0,0x6244,0x4982,0x51c2,0x5a45,0xac4a,0x9387,0x4982,0x8b87,0x9387,0x8346,0x6a86,0x5204,0xac89,0xaccc,0xc54f,0xb4ce,0x9c4b,0xc5d1,0x4100,0x4901,0x4101,0x4941,0x4941,0x4101,0x4142,0x6203,0x4941,0x2081,0x38c1,0x5182,0x0000, -0x0000,0x1881,0x1041,0x2081,0x3143,0x3142,0x3142,0x3983,0x3943,0x3102,0x3101,0x28c1,0x28c1,0x28c1,0x2901,0x8b89,0x9c0b,0x9c0a,0xd612,0xac8c,0xd5d1,0x9bc8,0xbc8a,0x9bc7,0xa3c7,0x9bc7,0x9b86,0x9bc7,0x8347,0x93c8,0xac8b,0xc50c,0xcd4b,0xb48a,0xde12,0xde94,0xaccd,0x6ac6,0x4101,0x4101,0x4941,0x4901,0x4101,0x4941,0x4101,0x38c1,0x3901,0x4141,0x2081,0x3901,0x0000, -0x0000,0x1881,0x1041,0x20c1,0x3984,0x3143,0x3943,0x41c4,0x3983,0x3142,0x3101,0x3101,0x3101,0x3101,0x3101,0x9c0a,0x7ac5,0x6203,0xa48c,0xc54f,0xa44b,0xbd0c,0xac08,0x8306,0xc54c,0x72c5,0x7b06,0x6a85,0xddcd,0xcd4c,0x93c7,0xcd0b,0x9386,0xdd8c,0xe60f,0xac8b,0x8389,0x6244,0x6203,0x5181,0x4101,0x4101,0x4901,0x4901,0x4101,0x3901,0x3081,0x38c1,0x59c2,0x4141,0x0000, -0x0000,0x2081,0x1841,0x28c1,0x41c4,0x3142,0x3983,0x49c5,0x4184,0x3102,0x3101,0x3101,0x3101,0x3101,0x3101,0x8348,0xa44b,0x6203,0x6204,0xb50e,0xbd0d,0xe60f,0xe650,0xee90,0x8346,0xb48b,0xb48b,0x7b07,0x72c6,0xd54c,0xbd0b,0xf758,0xffd9,0xb489,0xac07,0xe60e,0xee92,0x5204,0x51c3,0x5181,0x4941,0x4941,0x4101,0x4101,0x4941,0x4101,0x4101,0x3081,0x30c1,0x6a43,0x0000, -0x0000,0x1881,0x1841,0x28c1,0x41c4,0x3983,0x3983,0x41c4,0x3983,0x3102,0x3101,0x3101,0x3101,0x3101,0x3101,0x3941,0x6245,0x7285,0x9c4b,0xa44b,0xee90,0xdd8c,0x8b05,0xde10,0x940b,0xd58e,0xddcd,0xcd0b,0xdd8c,0x8b47,0x9b87,0xbd90,0xd654,0xffda,0xb48b,0xa3c7,0x9c08,0x6285,0x49c3,0x4983,0x4942,0x4941,0x5181,0x4101,0x4101,0x4941,0x4101,0x38c1,0x30c1,0x4141,0x0000, -0x0000,0x1881,0x1881,0x28c1,0x41c4,0x3983,0x41c4,0x4183,0x3942,0x3101,0x3101,0x3101,0x3101,0x3901,0x3901,0x3901,0x4142,0x8bc9,0x6286,0x8b87,0xbc89,0x9345,0xc50b,0xffd9,0xce13,0xe716,0xcd4b,0x7ac5,0xc4ca,0x7284,0x9bc8,0xcdd0,0xde53,0xbd91,0xce13,0xbd0d,0xe60f,0xb4cc,0x6ac6,0x51c4,0x49c3,0x4982,0x5182,0x5181,0x4941,0x4101,0x4101,0x4101,0x4101,0x4101,0x0000, -0x0000,0x1881,0x1881,0x2901,0x41c4,0x3983,0x41c4,0x4183,0x3942,0x3101,0x3101,0x3901,0x3901,0x3101,0x3101,0x6244,0x8b05,0xa409,0xd58d,0xb448,0x82c4,0xbcca,0xee93,0xf757,0xb50f,0xbd4f,0x9c4b,0xb489,0x8b46,0xcd0a,0x7ac4,0x9bc8,0xff98,0xb50f,0xacce,0x940a,0xb4cc,0xac8b,0xeed4,0x51c4,0x49c3,0x49c3,0x4983,0x51c3,0x4941,0x4101,0x4101,0x3901,0x4101,0x38c1,0x0000, -0x0000,0x2081,0x2081,0x2901,0x4184,0x3983,0x4183,0x3942,0x3142,0x3101,0x3101,0x3101,0x3941,0x3101,0x7ac5,0x7ac5,0x6a43,0x6a43,0x6a43,0xbcca,0xe5cd,0x4182,0x9c4b,0x4183,0x8bca,0xa44c,0xb4cd,0xb447,0xb448,0xccc9,0xccca,0xc4c9,0xee94,0x6245,0x838a,0x8b46,0xd5cf,0xde52,0xef15,0x51c3,0x49c3,0x49c3,0x49c3,0x5a45,0x4982,0x4941,0x5141,0x4941,0x3901,0x4101,0x0000, -0x0000,0x2081,0x2080,0x3102,0x3983,0x4184,0x3942,0x3142,0x3942,0x3942,0x3901,0x3941,0x3942,0x7ac5,0x7ac4,0x82c4,0x59c2,0xa3c8,0x5a45,0xd5cd,0xe60f,0xbccb,0x9c09,0xc54e,0x8389,0x93c8,0x9b87,0x69c2,0x8ac4,0xbc89,0xcd0a,0xbc88,0x8bca,0x8b86,0xbd92,0x8305,0xddcf,0xb50e,0xacce,0x5a45,0x51c3,0x49c3,0x49c3,0x5a46,0x4982,0x4982,0x4941,0x4101,0x30c1,0x30c1,0x0000, -0x0000,0x2081,0x2081,0x3142,0x49c4,0x4a05,0x4184,0x4183,0x4183,0x49c3,0x4183,0x7ac6,0x9bc8,0x9b86,0xa386,0x6a44,0x3901,0xb48b,0x4182,0xd54c,0x3101,0xc4ca,0x6244,0x8348,0x61c2,0x6202,0x5a04,0x7a84,0x69c2,0xac07,0xcd0a,0xb448,0x7307,0xf79a,0x7284,0xbc89,0xaccd,0x940b,0x6245,0x51c3,0x51c3,0x49c3,0x49c3,0x6246,0x4982,0x4982,0x4982,0x4141,0x3081,0x2881,0x0000, -0x0000,0x28c1,0x28c1,0x4184,0x5206,0x4a05,0x49c4,0x49c4,0x49c4,0x5205,0x9b87,0x7b06,0x9386,0xa3c6,0x51c2,0x61c2,0x5981,0xe652,0x5204,0xa449,0x3901,0xa3c7,0xac07,0x9305,0x8348,0xb4ce,0x28c1,0x61c2,0x7243,0x9b45,0xcd0a,0xbc89,0x8b05,0xcd8e,0xcd4b,0x8347,0xffd9,0xd654,0x6a87,0x6286,0x6286,0x5a46,0x5a46,0x6287,0x5a45,0x5204,0x5204,0x5204,0x4182,0x2081,0x0000, -0x0000,0x28c1,0x28c1,0x3983,0x41c4,0x41c4,0x4184,0x4184,0x7285,0x82c5,0xa387,0x49c3,0xa3c7,0x9b86,0x4182,0x6a02,0x61c2,0x8b88,0x4142,0x72c5,0x6a84,0xa3c7,0x4982,0x3101,0xa3c6,0xbc8a,0x51c3,0x4941,0x7202,0xac07,0xbc89,0xcd0a,0xccca,0x9b87,0xcd0b,0x8b89,0x7b8a,0xa48e,0x5204,0x5204,0x49c4,0x49c3,0x49c3,0x49c4,0x49c3,0x4983,0x4183,0x4182,0x4182,0x3982,0x0000, -0x0000,0x2081,0x28c1,0x3983,0x41c4,0x4184,0x4184,0x5a03,0x9b86,0x9b86,0x7ac5,0x6244,0x9346,0x9b46,0x4141,0x6a02,0x69c2,0x8305,0x7285,0x3941,0xa449,0xac08,0xcd0c,0x9b86,0x7ac5,0xac08,0x9388,0x6202,0x7a83,0xac09,0xa408,0xcd0b,0xc50b,0xa3c6,0xbcca,0xff99,0x940c,0xaccf,0x49c3,0x49c3,0x49c3,0x4183,0x4183,0x4183,0x4183,0x4182,0x3942,0x3942,0x3942,0x4183,0x0000, -0x0000,0x2081,0x28c1,0x3943,0x41c4,0x4184,0x4183,0x9386,0x9b87,0xa408,0x9346,0x6a44,0x8b05,0x8284,0x5982,0x7a43,0x5181,0x7a43,0x9c09,0x72c6,0xbd0c,0x5a03,0x93c8,0x6a45,0x8b05,0x9b86,0x7a84,0x7243,0x7243,0x9b86,0xb489,0xbccb,0xbccb,0xb447,0xbc8a,0x6ac7,0xce13,0xc5d2,0x49c3,0x49c3,0x4983,0x4183,0x4183,0x4182,0x4182,0x4182,0x3942,0x3942,0x3942,0x4183,0x0000, -0x0000,0x2080,0x28c1,0x3942,0x3984,0x7b06,0x7285,0x7ac5,0x9b87,0x9b86,0x9345,0x6203,0x8284,0x7a83,0x5982,0x7202,0x7203,0x7243,0x9387,0x7b07,0x8b88,0x8347,0x2080,0xb4cb,0xbccc,0x5a03,0x6a03,0x8b04,0x61c2,0x8b05,0xb48b,0xbccb,0xcd4c,0xac09,0xcd0b,0xc590,0x9c8d,0x7b89,0x4983,0x4983,0x4983,0x4183,0x4182,0x4182,0x4182,0x4182,0x3942,0x3942,0x3941,0x4183,0x0000, -0x0000,0x2081,0x28c1,0x3942,0x8b46,0x8b05,0x8b05,0x3101,0x9b86,0x9345,0x8ac4,0x82c4,0x7a43,0x7a83,0x6a02,0x8283,0x8283,0x61c2,0x9b86,0x8b88,0x5204,0xb48b,0x51c3,0xac8a,0x3942,0x6a03,0x7243,0x9345,0x7284,0x8305,0xbccc,0xc54d,0xcd8d,0xc58e,0xcd4c,0xac8c,0xcdd2,0x7307,0x4183,0x4983,0x4982,0x4182,0x4182,0x4182,0x4182,0x3982,0x3942,0x3942,0x3101,0x4183,0x0000, -0x0000,0x2081,0x5a03,0x59c2,0x4141,0x8283,0x82c4,0x4982,0x8b05,0x8b05,0x8284,0x82c4,0x8283,0x8283,0x7a43,0x8283,0x7a02,0x8ac3,0x9346,0x7285,0x93c9,0x5a44,0xa44a,0xb4cb,0x9388,0x7284,0x7a84,0x7243,0x4182,0x7ac5,0xa44a,0x9c4b,0xcd4e,0xbd0e,0xb4cb,0xde53,0xa4ce,0x7308,0x8bca,0x49c3,0x4182,0x4182,0x4182,0x4182,0x4142,0x3942,0x3942,0x3942,0x3101,0x4183,0x0000, -0x0000,0x7243,0x7a43,0x8283,0x3101,0x59c2,0x7a83,0x7a83,0x4141,0x9345,0x8b05,0x7202,0x7203,0x7a43,0x7a43,0x69c2,0x61c2,0x7a02,0x82c4,0x9387,0xa44b,0x3101,0x4182,0x6a86,0x8b88,0xbd4e,0x6244,0x4981,0xac8b,0x4142,0x6203,0xb3c8,0x8307,0xffd9,0xac8b,0x8389,0xa48d,0xa4cd,0x8bca,0x7b49,0x49c3,0x4182,0x4182,0x3982,0x4182,0x3942,0x3942,0x3141,0x3101,0x4183,0x0000, -0x0000,0x6a02,0x7a43,0x7a83,0x8283,0x3901,0x7243,0x7a43,0x7a43,0x4982,0x8283,0x7a43,0x7243,0x5981,0x7202,0x7202,0x69c2,0x5981,0x7a42,0x9bc7,0x51c3,0x93c8,0xa449,0x93c9,0x7b48,0x8347,0x4142,0x6a84,0x8346,0xbccc,0x8b88,0x5182,0xde53,0xcdd1,0xd613,0x8bca,0xb50f,0x8bca,0x8bca,0x8389,0x6286,0x5204,0x4a04,0x49c3,0x4183,0x4183,0x4183,0x4182,0x3982,0x4a04,0x0000, -0x0000,0x8283,0x61c2,0x59c2,0x7202,0x8283,0x4941,0x7a83,0x7243,0x7243,0x7a83,0x7a43,0x7a43,0x7242,0x6182,0x6181,0x7202,0x61c2,0x5981,0x7a43,0x6a43,0x8347,0x8346,0xb48b,0xb4cb,0x9c09,0x5a04,0x7b07,0x93c9,0x9c0a,0x9c0a,0x5a44,0xb4cd,0xa44d,0x8389,0xb50e,0xa44c,0x8b89,0x8b89,0x93ca,0x8388,0x8348,0x8348,0x7b48,0x7b07,0x7307,0x7307,0x72c7,0x6ac7,0x7307,0x0000, -0x0000,0x8ac4,0x8283,0x7a83,0x61c2,0x7a43,0x7a43,0x4942,0x8ac4,0x6a02,0x4982,0x7a83,0x7202,0x7243,0x7a43,0x6a02,0x5941,0x69c2,0x5981,0x5981,0x9386,0x8b46,0x7284,0x5a03,0x51c3,0x8b88,0x6244,0x4183,0x4142,0x7b07,0x3941,0x5a44,0x3982,0x7b07,0x9c0b,0x8348,0x8bc9,0x8b89,0x8388,0x8388,0x8348,0x8348,0x8348,0x8348,0x7b47,0x7b07,0x7b07,0x7307,0x72c6,0x72c7,0x0000, -0x0000,0x8ac4,0x8b04,0x82c3,0x82c4,0x82c4,0x8283,0x82c4,0x4982,0x8ac4,0x6a02,0x5182,0x7243,0x7202,0x7202,0x7202,0x6182,0x5141,0x6182,0x69c2,0x4941,0x7284,0x8b46,0x9bc8,0x8b46,0x93c8,0x49c3,0x3101,0x5a03,0x8306,0x72c7,0xb50e,0xacce,0xb50e,0x8348,0x8348,0x8b89,0x8348,0x8348,0x8348,0x8348,0x8348,0x8347,0x7b07,0x7b07,0x7b07,0x7307,0x72c7,0x72c6,0x72c6,0x0000, -0x0000,0x8b04,0x8ac4,0x9305,0x8ac4,0x8ac4,0x9304,0x8ac4,0x8b04,0x59c2,0x6a03,0x7a43,0x6a03,0x6a02,0x7203,0x69c2,0x69c2,0x6182,0x5141,0x5941,0x69c2,0x5141,0x6203,0x7243,0x7ac5,0x7ac5,0x8346,0xa44a,0xb50d,0xbd0e,0xcd8f,0xd613,0xbd50,0x8bca,0x72c7,0x72c6,0x72c6,0x72c6,0x72c6,0x72c6,0x7307,0x7b07,0x7b07,0x7b07,0x7b07,0x7307,0x72c6,0x72c6,0x72c6,0x72c6,0x0000, -0x0000,0x9345,0x9304,0x9345,0x9345,0x9345,0x9305,0x9345,0x9305,0x8ac4,0x7283,0x5182,0x6202,0x7243,0x6a02,0x69c2,0x61c2,0x5981,0x5982,0x5141,0x4101,0x5101,0x5982,0x5141,0x5141,0x61c2,0x8284,0x9386,0xa44a,0xde53,0xad0f,0xef16,0xe6d6,0x6245,0x4982,0x4982,0x4982,0x4982,0x49c2,0x49c2,0x49c3,0x49c3,0x51c3,0x51c3,0x51c3,0x5203,0x5203,0x5203,0x5203,0x5203,0x0000, -0x0000,0x7a84,0x51c2,0x9b86,0x9b85,0x9304,0x8b04,0x8b04,0x8b04,0x9345,0x7a83,0x7a83,0x7a84,0x30c0,0x7243,0x61c2,0x6182,0x5981,0x5981,0x5141,0x5141,0x38c1,0x2881,0x38c1,0x5181,0x6a02,0x8b04,0xa407,0xcd4c,0xde52,0xef16,0xef57,0xd695,0x6285,0x5a04,0x51c3,0x49c3,0x4982,0x4182,0x3942,0x3941,0x3101,0x3101,0x28c1,0x28c1,0x20c1,0x2081,0x2081,0x2081,0x2081,0x0000, -0x0000,0xa407,0x9b86,0x3901,0x9b86,0xa386,0x9345,0x82c4,0x8b04,0x82c4,0x9304,0x7243,0x59c2,0x7243,0x28c1,0x69c2,0x5981,0x5981,0x4941,0x4901,0x4901,0x5141,0x5141,0x5141,0x4101,0x4941,0x5182,0x5182,0x4182,0xcd8f,0xef16,0xef57,0xa4cf,0x7b07,0x7b07,0x7b07,0x7ac6,0x72c6,0x72c6,0x6a85,0x6a85,0x6245,0x6244,0x5a04,0x5203,0x49c3,0x4182,0x3942,0x3941,0x3101,0x0000, -0x0000,0xac48,0xa407,0xac08,0x30c1,0x8b45,0xa3c7,0x9345,0x8b04,0x8ac4,0x82c4,0x82c4,0x7a83,0x6202,0x6a02,0x30c1,0x59c2,0x61c2,0x5141,0x4901,0x4101,0x4101,0x4101,0x4901,0x5141,0x6182,0x7202,0x8ac4,0xa407,0xac8a,0xa48d,0xef57,0xb550,0x7b06,0x7306,0x72c6,0x72c6,0x72c6,0x72c6,0x72c6,0x72c6,0x72c6,0x72c6,0x72c6,0x72c6,0x6ac6,0x6ac6,0x6a85,0x6a85,0x6a85,0x0000, -0x0000,0x0000,0x1081,0x1081,0x1081,0x0000,0x1041,0x1041,0x0841,0x0840,0x0841,0x0840,0x0841,0x0000,0x0840,0x0840,0x0000,0x0800,0x0840,0x0800,0x0000,0x0000,0x0000,0x0000,0x0000,0x0800,0x0840,0x0840,0x1041,0x1082,0x1082,0x18c3,0x1081,0x0841,0x0841,0x0841,0x0841,0x0841,0x0840,0x0840,0x0841,0x0841,0x0840,0x0841,0x0840,0x0841,0x0840,0x0840,0x0840,0x0840,0x0000, -0x0000 -}; -#endif diff --git a/lib/lib_display/Adafruit_SSD1351-gemu-1.0/Tiger.rgb b/lib/lib_display/Adafruit_SSD1351-gemu-1.0/Tiger.rgb deleted file mode 100644 index e3c49ce82..000000000 Binary files a/lib/lib_display/Adafruit_SSD1351-gemu-1.0/Tiger.rgb and /dev/null differ diff --git a/lib/lib_display/Adafruit_SSD1351-gemu-1.0/keywords.txt b/lib/lib_display/Adafruit_SSD1351-gemu-1.0/keywords.txt deleted file mode 100644 index cfc1e2023..000000000 --- a/lib/lib_display/Adafruit_SSD1351-gemu-1.0/keywords.txt +++ /dev/null @@ -1,30 +0,0 @@ -####################################### -# Syntax Coloring Map -####################################### - -####################################### -# Datatypes (KEYWORD1) -####################################### - -SSD3115 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 diff --git a/lib/lib_display/Adafruit_SSD1351-gemu-1.0/library.properties b/lib/lib_display/Adafruit_SSD1351-gemu-1.0/library.properties deleted file mode 100644 index e405f69b6..000000000 --- a/lib/lib_display/Adafruit_SSD1351-gemu-1.0/library.properties +++ /dev/null @@ -1,9 +0,0 @@ -name=SSD3115 -version=1.0 -author=Limor Fried/Ladyada -maintainer=Limor Fried/Ladyada -sentence=Library for SSD3115 displays -paragraph=Library for SSD3115 displays -category=Display -url=https://github.com/adafruit/Adafruit-SSD1351-library -architectures=* diff --git a/lib/lib_display/Adafruit_SSD1351-gemu-1.0/spi_register.h b/lib/lib_display/Adafruit_SSD1351-gemu-1.0/spi_register.h deleted file mode 100644 index 340559ae1..000000000 --- a/lib/lib_display/Adafruit_SSD1351-gemu-1.0/spi_register.h +++ /dev/null @@ -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 diff --git a/lib/lib_display/Arduino_ST7789-gemu-1.0/Arduino_ST7789.cpp b/lib/lib_display/Arduino_ST7789-gemu-1.0/Arduino_ST7789.cpp deleted file mode 100644 index b51339b32..000000000 --- a/lib/lib_display/Arduino_ST7789-gemu-1.0/Arduino_ST7789.cpp +++ /dev/null @@ -1,634 +0,0 @@ -/*************************************************** - This is a library for the ST7789 IPS SPI display. - - Originally written by Limor Fried/Ladyada for - Adafruit Industries. - - Modified by Ananev Ilia - ****************************************************/ - -#include "Arduino_ST7789.h" -#include -#include "pins_arduino.h" -#include "wiring_private.h" -#include - -const uint16_t ST7789_colors[]={ST7789_BLACK,ST7789_WHITE,ST7789_RED,ST7789_GREEN,ST7789_BLUE,ST7789_CYAN,ST7789_MAGENTA,\ - ST7789_YELLOW,ST7789_NAVY,ST7789_DARKGREEN,ST7789_DARKCYAN,ST7789_MAROON,ST7789_PURPLE,ST7789_OLIVE,\ -ST7789_LIGHTGREY,ST7789_DARKGREY,ST7789_ORANGE,ST7789_GREENYELLOW,ST7789_PINK}; - -#ifdef ESP32 -#include "esp8266toEsp32.h" -#define ST7789_DIMMER -#endif - - - -uint16_t Arduino_ST7789::GetColorFromIndex(uint8_t index) { - if (index>=sizeof(ST7789_colors)/2) index=0; - return ST7789_colors[index]; -} - -static const uint8_t PROGMEM - init_cmd[] = { // Initialization commands for 7789 screens - 10, // 9 commands in list: - ST7789_SWRESET, ST_CMD_DELAY, // 1: Software reset, no args, w/delay - 150, // 150 ms delay - ST7789_SLPOUT , ST_CMD_DELAY, // 2: Out of sleep mode, no args, w/delay - 255, // 255 = 500 ms delay - ST7789_COLMOD , 1+ST_CMD_DELAY, // 3: Set color mode, 1 arg + delay: - 0x55, // 16-bit color - 10, // 10 ms delay - ST7789_MADCTL , 1, // 4: Memory access ctrl (directions), 1 arg: - 0x00, // Row addr/col addr, bottom to top refresh - ST7789_INVON , ST_CMD_DELAY, // 7: Inversion ON - 10, - ST7789_NORON , ST_CMD_DELAY, // 8: Normal display on, no args, w/delay - 10, // 10 ms delay - ST7789_DISPON , ST_CMD_DELAY, // 9: Main screen turn on, no args, w/delay - 255 }; // 255 = 500 ms delay - -inline uint16_t swapcolor(uint16_t x) { - return (x << 11) | (x & 0x07E0) | (x >> 11); -} - -#if defined (SPI_HAS_TRANSACTION) - static SPISettings ST7789_SPISettings; -#elif defined (__AVR__) || defined(CORE_TEENSY) - static uint8_t SPCRbackup; - static uint8_t mySPCR; -#endif - - -#if defined (SPI_HAS_TRANSACTION) -#define SPI_BEGIN_TRANSACTION() if (_hwSPI) SPI.beginTransaction(ST7789_SPISettings) -#define SPI_END_TRANSACTION() if (_hwSPI) SPI.endTransaction() -#else -#define SPI_BEGIN_TRANSACTION() (void) -#define SPI_END_TRANSACTION() (void) -#endif - -// Constructor when using software SPI. All output pins are configurable. -Arduino_ST7789::Arduino_ST7789(int8_t dc, int8_t rst, int8_t sid, int8_t sclk, int8_t cs, int8_t bp) - : Renderer(_width, _height) -{ - _cs = cs; - _dc = dc; - _sid = sid; - _sclk = sclk; - _rst = rst; - _hwSPI = false; - _bp = bp; - if(dc == -1) _SPI9bit = true; - else _SPI9bit = false; -} - -// Constructor when using hardware SPI. Faster, but must use SPI pins -// specific to each board type (e.g. 11,13 for Uno, 51,52 for Mega, etc.) -Arduino_ST7789::Arduino_ST7789(int8_t dc, int8_t rst, int8_t cs, int8_t bp) - : Renderer(_width, _height) { - _cs = cs; - _dc = dc; - _rst = rst; - _hwSPI = true; - _SPI9bit = false; - _sid = _sclk = -1; - _bp = bp; -} - - -void Arduino_ST7789::DisplayInit(int8_t p,int8_t size,int8_t rot,int8_t font) { - setRotation(rot); - if (_width==320 || _height==320) { - invertDisplay(false); - } else { - invertDisplay(true); - } - //setTextWrap(false); // Allow text to run off edges - //cp437(true); - setTextFont(font&3); - setTextSize(size&7); - setTextColor(ST7789_WHITE,ST7789_BLACK); - setCursor(0,0); - fillScreen(ST7789_BLACK); -} - -inline void Arduino_ST7789::spiwrite(uint8_t c) -{ - - //Serial.println(c, HEX); - - if (_hwSPI) - { -#if defined (SPI_HAS_TRANSACTION) - SPI.transfer(c); -#elif defined (__AVR__) || defined(CORE_TEENSY) - SPCRbackup = SPCR; - SPCR = mySPCR; - SPI.transfer(c); - SPCR = SPCRbackup; -#elif defined (__arm__) - SPI.setClockDivider(21); //4MHz - SPI.setDataMode(SPI_MODE2); - SPI.transfer(c); -#endif - } - else - { - if(_SPI9bit) - { - //9s bit send first -#if defined(USE_FAST_IO) - *clkport &= ~clkpinmask; - if(_DCbit) *dataport |= datapinmask; - else *dataport &= ~datapinmask; - *clkport |= clkpinmask; -#else - digitalWrite(_sclk, LOW); - if(_DCbit) digitalWrite(_sid, HIGH); - else digitalWrite(_sid, LOW); - digitalWrite(_sclk, HIGH); -#endif - - - // Fast SPI bitbang swiped from LPD8806 library - for(uint8_t bit = 0x80; bit; bit >>= 1) { -#if defined(USE_FAST_IO) - *clkport &= ~clkpinmask; - if(c & bit) *dataport |= datapinmask; - else *dataport &= ~datapinmask; - *clkport |= clkpinmask; -#else - digitalWrite(_sclk, LOW); - if(c & bit) digitalWrite(_sid, HIGH); - else digitalWrite(_sid, LOW); - digitalWrite(_sclk, HIGH); -#endif - - } - } - else - { - // Fast SPI bitbang swiped from LPD8806 library - for(uint8_t bit = 0x80; bit; bit >>= 1) { -#if defined(USE_FAST_IO) - *clkport &= ~clkpinmask; - if(c & bit) *dataport |= datapinmask; - else *dataport &= ~datapinmask; - *clkport |= clkpinmask; -#else - digitalWrite(_sclk, LOW); - if(c & bit) digitalWrite(_sid, HIGH); - else digitalWrite(_sid, LOW); - digitalWrite(_sclk, HIGH); -#endif - } - } - } -} - -void Arduino_ST7789::writecommand(uint8_t c) { - - DC_LOW(); - CS_LOW(); - SPI_BEGIN_TRANSACTION(); - - spiwrite(c); - - CS_HIGH(); - SPI_END_TRANSACTION(); -} - -void Arduino_ST7789::writedata(uint8_t c) { - SPI_BEGIN_TRANSACTION(); - DC_HIGH(); - CS_LOW(); - - spiwrite(c); - - CS_HIGH(); - SPI_END_TRANSACTION(); -} - - - -// Companion code to the above tables. Reads and issues -// a series of LCD commands stored in PROGMEM byte array. -void Arduino_ST7789::displayInit(const uint8_t *addr) { - - uint8_t numCommands, numArgs; - uint16_t ms; - //<----------------------------------------------------------------------------------------- - DC_HIGH(); - if (!_hwSPI) { -#if defined(USE_FAST_IO) - *clkport |= clkpinmask; -#else - digitalWrite(_sclk, HIGH); -#endif - } - //<----------------------------------------------------------------------------------------- - - numCommands = pgm_read_byte(addr++); // Number of commands to follow - while (numCommands--) { // For each command... - writecommand(pgm_read_byte(addr++)); // Read, issue command - numArgs = pgm_read_byte(addr++); // Number of args to follow - ms = numArgs & ST_CMD_DELAY; // If hibit set, delay follows args - numArgs &= ~ST_CMD_DELAY; // Mask out delay bit - while (numArgs--) { // For each argument... - writedata(pgm_read_byte(addr++)); // Read, issue argument - } - - if (ms) { - ms = pgm_read_byte(addr++); // Read post-command delay time (ms) - if (ms == 255) ms = 500; // If 255, delay for 500 ms - delay(ms); - } - } -} - - -// Initialization code common to all ST7789 displays -void Arduino_ST7789::commonInit(const uint8_t *cmdList) { - _ystart = _xstart = 0; - _colstart = _rowstart = 0; // May be overridden in init func - - pinMode(_dc, OUTPUT); - if (_cs>=0) { - pinMode(_cs, OUTPUT); - } - - if (_bp>=0) { -// #define ESP32_PWM_CHANNEL 1 -#ifdef ST7789_DIMMER - analogWrite(_bp, 128); -#else - pinMode(_bp, OUTPUT); -#endif - - } - - -#if defined(USE_FAST_IO) - dcport = portOutputRegister(digitalPinToPort(_dc)); - dcpinmask = digitalPinToBitMask(_dc); - if (_cs>=0) { - csport = portOutputRegister(digitalPinToPort(_cs)); - cspinmask = digitalPinToBitMask(_cs); - } -#endif - - if(_hwSPI) { // Using hardware SPI -#if defined (SPI_HAS_TRANSACTION) - SPI.begin(); - // ST7789_SPISettings = SPISettings(24000000, MSBFIRST, SPI_MODE2); - ST7789_SPISettings = SPISettings(1000000, MSBFIRST, SPI_MODE2); -#elif defined (__AVR__) || defined(CORE_TEENSY) - SPCRbackup = SPCR; - SPI.begin(); - SPI.setClockDivider(SPI_CLOCK_DIV4); - SPI.setDataMode(SPI_MODE2); - mySPCR = SPCR; // save our preferred state - SPCR = SPCRbackup; // then restore -#elif defined (__SAM3X8E__) - SPI.begin(); - SPI.setClockDivider(21); //4MHz - SPI.setDataMode(SPI_MODE2); -#endif - } else { - pinMode(_sclk, OUTPUT); - pinMode(_sid , OUTPUT); - digitalWrite(_sclk, LOW); - digitalWrite(_sid, LOW); - -#if defined(USE_FAST_IO) - clkport = portOutputRegister(digitalPinToPort(_sclk)); - dataport = portOutputRegister(digitalPinToPort(_sid)); - clkpinmask = digitalPinToBitMask(_sclk); - datapinmask = digitalPinToBitMask(_sid); -#endif - } - - // toggle RST low to reset; CS low so it'll listen to us - CS_LOW(); - if (_rst != -1) { - pinMode(_rst, OUTPUT); - digitalWrite(_rst, HIGH); - delay(50); - digitalWrite(_rst, LOW); - delay(50); - digitalWrite(_rst, HIGH); - delay(50); - } - - if (cmdList) - displayInit(cmdList); -} - -void Arduino_ST7789::setRotation(uint8_t m) { - - writecommand(ST7789_MADCTL); - rotation = m % 4; // can't be higher than 3 - switch (rotation) { - case 0: - writedata(ST7789_MADCTL_MX | ST7789_MADCTL_MY | ST7789_MADCTL_RGB); - - _xstart = 0; - _ystart = 0; - if (_width==240 && _height==240) { - _xstart = ST7789_240x240_XSTART_R0; - _ystart = ST7789_240x240_YSTART_R0; - } - if (_width==135 && _height==240) { - _xstart = ST7789_135x240_XSTART_R0; - _ystart = ST7789_135x240_YSTART_R0; - } - break; - case 1: - writedata(ST7789_MADCTL_MY | ST7789_MADCTL_MV | ST7789_MADCTL_RGB); - - _ystart = 0; - _xstart = 0; - if (_width==240 && _height==240) { - _xstart = ST7789_240x240_XSTART_R1; - _ystart = ST7789_240x240_YSTART_R1; - } - if (_width==240 && _height==135) { - _xstart = ST7789_135x240_XSTART_R1; - _ystart = ST7789_135x240_YSTART_R1; - } - break; - case 2: - writedata(ST7789_MADCTL_RGB); - - _xstart = 0; - _ystart = 0; - if (_width==240 && _height==240) { - _xstart = ST7789_240x240_XSTART_R2; - _ystart = ST7789_240x240_YSTART_R2; - } - if (_width==135 && _height==240) { - _xstart = ST7789_135x240_XSTART_R2; - _ystart = ST7789_135x240_YSTART_R2; - } - break; - - case 3: - writedata(ST7789_MADCTL_MX | ST7789_MADCTL_MV | ST7789_MADCTL_RGB); - - _xstart = 0; - _ystart = 0; - if (_width==240 && _height==240) { - _xstart = ST7789_240x240_XSTART_R3; - _ystart = ST7789_240x240_YSTART_R3; - } - if (_width==240 && _height==135) { - _xstart = ST7789_135x240_XSTART_R3; - _ystart = ST7789_135x240_YSTART_R3; - } - break; - } -} - -void Arduino_ST7789::setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1) { - setAddrWindow_int(x0,y0,x1-1,y1-1); -} - -void Arduino_ST7789::setAddrWindow_int(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1) { - uint16_t x_start = x0 + _xstart, x_end = x1 + _xstart; - uint16_t y_start = y0 + _ystart, y_end = y1 + _ystart; - - writecommand(ST7789_CASET); // Column addr set - writedata(x_start >> 8); - writedata(x_start & 0xFF); // XSTART - writedata(x_end >> 8); - writedata(x_end & 0xFF); // XEND - - writecommand(ST7789_RASET); // Row addr set - writedata(y_start >> 8); - writedata(y_start & 0xFF); // YSTART - writedata(y_end >> 8); - writedata(y_end & 0xFF); // YEND - - writecommand(ST7789_RAMWR); // write to RAM -} - -void Arduino_ST7789::drawPixel(int16_t x, int16_t y, uint16_t color) { - - if((x < 0) ||(x >= _width) || (y < 0) || (y >= _height)) return; - - setAddrWindow_int(x,y,x+1,y+1); - - SPI_BEGIN_TRANSACTION(); - DC_HIGH(); - CS_LOW(); - - spiwrite(color >> 8); - spiwrite(color); - - CS_HIGH(); - SPI_END_TRANSACTION(); -} - -void Arduino_ST7789::drawFastVLine(int16_t x, int16_t y, int16_t h, - uint16_t color) { - - // Rudimentary clipping - if((x >= _width) || (y >= _height)) return; - if((y+h-1) >= _height) h = _height-y; - setAddrWindow_int(x, y, x, y+h-1); - - uint8_t hi = color >> 8, lo = color; - - SPI_BEGIN_TRANSACTION(); - DC_HIGH(); - CS_LOW(); - - while (h--) { - spiwrite(hi); - spiwrite(lo); - } - - CS_HIGH(); - SPI_END_TRANSACTION(); -} - -void Arduino_ST7789::drawFastHLine(int16_t x, int16_t y, int16_t w, - uint16_t color) { - - // Rudimentary clipping - if((x >= _width) || (y >= _height)) return; - if((x+w-1) >= _width) w = _width-x; - setAddrWindow_int(x, y, x+w-1, y); - - uint8_t hi = color >> 8, lo = color; - - SPI_BEGIN_TRANSACTION(); - DC_HIGH(); - CS_LOW(); - - while (w--) { - spiwrite(hi); - spiwrite(lo); - } - - CS_HIGH(); - SPI_END_TRANSACTION(); -} - -void Arduino_ST7789::fillScreen(uint16_t color) { - fillRect(0, 0, _width, _height, color); -} - -// fill a rectangle -void Arduino_ST7789::fillRect(int16_t x, int16_t y, int16_t w, int16_t h, - uint16_t color) { - - // rudimentary clipping (drawChar w/big text requires this) - if((x >= _width) || (y >= _height)) return; - if((x + w - 1) >= _width) w = _width - x; - if((y + h - 1) >= _height) h = _height - y; - - setAddrWindow_int(x, y, x+w-1, y+h-1); - - uint8_t hi = color >> 8, lo = color; - - SPI_BEGIN_TRANSACTION(); - - DC_HIGH(); - CS_LOW(); - for(y=h; y>0; y--) { - for(x=w; x>0; x--) { - spiwrite(hi); - spiwrite(lo); - } - delay(0); - } - CS_HIGH(); - SPI_END_TRANSACTION(); -} - -// Pass 8-bit (each) R,G,B, get back 16-bit packed color -uint16_t Arduino_ST7789::Color565(uint8_t r, uint8_t g, uint8_t b) { - return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3); -} - -void Arduino_ST7789::invertDisplay(boolean i) { - writecommand(i ? ST7789_INVON : ST7789_INVOFF); -} - -/******** low level bit twiddling **********/ - -inline void Arduino_ST7789::CS_HIGH(void) { - if(_cs>=0) { - #if defined(USE_FAST_IO) - *csport |= cspinmask; - #else - digitalWrite(_cs, HIGH); - #endif - } -} - -inline void Arduino_ST7789::CS_LOW(void) { - if(_cs>=0) { - #if defined(USE_FAST_IO) - *csport &= ~cspinmask; - #else - digitalWrite(_cs, LOW); - #endif - } -} - -inline void Arduino_ST7789::DC_HIGH(void) { - _DCbit = true; -#if defined(USE_FAST_IO) - *dcport |= dcpinmask; -#else - digitalWrite(_dc, HIGH); -#endif -} - -inline void Arduino_ST7789::DC_LOW(void) { - _DCbit = false; -#if defined(USE_FAST_IO) - *dcport &= ~dcpinmask; -#else - digitalWrite(_dc, LOW); -#endif -} - -void Arduino_ST7789::init(uint16_t width, uint16_t height) { - commonInit(NULL); - - _height = height; - _width = width; - - displayInit(init_cmd); - - setRotation(2); - -} - -void Arduino_ST7789::DisplayOnff(int8_t on) { - if (on) { - writecommand(ST7789_DISPON); //Display on - if (_bp>=0) { -#ifdef ST7789_DIMMER - analogWrite(_bp, dimmer); - // ledcWrite(ESP32_PWM_CHANNEL,dimmer); -#else - digitalWrite(_bp,HIGH); -#endif - } - } else { - writecommand(ST7789_DISPOFF); - if (_bp>=0) { -#ifdef ST7789_DIMMER - analogWrite(_bp, 0); - // ledcWrite(ESP32_PWM_CHANNEL,0); -#else - digitalWrite(_bp,LOW); -#endif - } - } -} - -// dimmer 0-100 -void Arduino_ST7789::dim(uint8_t dim) { - dimmer = dim; - if (dimmer>15) dimmer=15; - dimmer=((float)dimmer/15.0)*255.0; -#ifdef ESP32 - analogWrite(_bp, dimmer); - // ledcWrite(ESP32_PWM_CHANNEL,dimmer); -#endif -} - -void Arduino_ST7789::pushColor(uint16_t color) { - SPI_BEGIN_TRANSACTION(); - DC_HIGH(); - CS_LOW(); - - spiwrite(color >> 8); - spiwrite(color); - - CS_HIGH(); - SPI_END_TRANSACTION(); -} - -void Arduino_ST7789::pushColors(uint16_t *data, uint16_t len, boolean first) { - uint16_t color; - - SPI_BEGIN_TRANSACTION(); - DC_HIGH(); - CS_LOW(); - - while (len--) { - color = *data++; - spiwrite(color >> 8); - spiwrite(color); - } - - CS_HIGH(); - SPI_END_TRANSACTION(); -} diff --git a/lib/lib_display/Arduino_ST7789-gemu-1.0/Arduino_ST7789.h b/lib/lib_display/Arduino_ST7789-gemu-1.0/Arduino_ST7789.h deleted file mode 100644 index ebd39dc25..000000000 --- a/lib/lib_display/Arduino_ST7789-gemu-1.0/Arduino_ST7789.h +++ /dev/null @@ -1,195 +0,0 @@ -/*************************************************** - This is a library for the ST7789 IPS SPI display. - - Originally written by Limor Fried/Ladyada for - Adafruit Industries. - - Modified by Ananev Ilia - ****************************************************/ - -#ifndef _ADAFRUIT_ST7789H_ -#define _ADAFRUIT_ST7789H_ - -#include "Arduino.h" -#include "Print.h" -#include -#include - -#ifdef ESP8266 -#define USE_FAST_IO -#endif - -#if defined(__AVR__) || defined(CORE_TEENSY) - #include - #define USE_FAST_IO - typedef volatile uint8_t RwReg; -#elif defined(ARDUINO_STM32_FEATHER) - typedef volatile uint32 RwReg; - #define USE_FAST_IO -#elif defined(ARDUINO_FEATHER52) - typedef volatile uint32_t RwReg; - #define USE_FAST_IO -#elif defined(ESP8266) - #include -#elif defined(__SAM3X8E__) - #undef __FlashStringHelper::F(string_literal) - #define F(string_literal) string_literal - #include - #define PROGMEM - #define pgm_read_byte(addr) (*(const unsigned char *)(addr)) - #define pgm_read_word(addr) (*(const unsigned short *)(addr)) - typedef unsigned char prog_uchar; -#endif - -//#define SPI_HAS_TRANSACTION // already defined in SPI.h - -#define ST7789_240x240_XSTART_R0 0 -#define ST7789_240x240_YSTART_R0 80 -#define ST7789_240x240_XSTART_R1 80 -#define ST7789_240x240_YSTART_R1 0 -#define ST7789_240x240_XSTART_R2 0 -#define ST7789_240x240_YSTART_R2 0 -#define ST7789_240x240_XSTART_R3 0 -#define ST7789_240x240_YSTART_R3 0 - -#define ST7789_135x240_XSTART_R0 53 -#define ST7789_135x240_YSTART_R0 40 -#define ST7789_135x240_XSTART_R1 40 -#define ST7789_135x240_YSTART_R1 52 -#define ST7789_135x240_XSTART_R2 52 -#define ST7789_135x240_YSTART_R2 40 -#define ST7789_135x240_XSTART_R3 40 -#define ST7789_135x240_YSTART_R3 53 - -#define ST_CMD_DELAY 0x80 // special signifier for command lists - -#define ST7789_NOP 0x00 -#define ST7789_SWRESET 0x01 -#define ST7789_RDDID 0x04 -#define ST7789_RDDST 0x09 - -#define ST7789_SLPIN 0x10 -#define ST7789_SLPOUT 0x11 -#define ST7789_PTLON 0x12 -#define ST7789_NORON 0x13 - -#define ST7789_INVOFF 0x20 -#define ST7789_INVON 0x21 -#define ST7789_DISPOFF 0x28 -#define ST7789_DISPON 0x29 -#define ST7789_CASET 0x2A -#define ST7789_RASET 0x2B -#define ST7789_RAMWR 0x2C -#define ST7789_RAMRD 0x2E - -#define ST7789_PTLAR 0x30 -#define ST7789_COLMOD 0x3A -#define ST7789_MADCTL 0x36 - -#define ST7789_MADCTL_MY 0x80 -#define ST7789_MADCTL_MX 0x40 -#define ST7789_MADCTL_MV 0x20 -#define ST7789_MADCTL_ML 0x10 -#define ST7789_MADCTL_RGB 0x00 - -#define ST7789_RDID1 0xDA -#define ST7789_RDID2 0xDB -#define ST7789_RDID3 0xDC -#define ST7789_RDID4 0xDD - -// Color definitions -#undef BLACK -#define BLACK 0x0000 -#define BLUE 0x001F -#define RED 0xF800 -#define GREEN 0x07E0 -#define CYAN 0x07FF -#define MAGENTA 0xF81F -#define YELLOW 0xFFE0 -#undef WHITE -#define WHITE 0xFFFF - - -// Color definitions -#define ST7789_BLACK 0x0000 /* 0, 0, 0 */ -#define ST7789_NAVY 0x000F /* 0, 0, 128 */ -#define ST7789_DARKGREEN 0x03E0 /* 0, 128, 0 */ -#define ST7789_DARKCYAN 0x03EF /* 0, 128, 128 */ -#define ST7789_MAROON 0x7800 /* 128, 0, 0 */ -#define ST7789_PURPLE 0x780F /* 128, 0, 128 */ -#define ST7789_OLIVE 0x7BE0 /* 128, 128, 0 */ -#define ST7789_LIGHTGREY 0xC618 /* 192, 192, 192 */ -#define ST7789_DARKGREY 0x7BEF /* 128, 128, 128 */ -#define ST7789_BLUE 0x001F /* 0, 0, 255 */ -#define ST7789_GREEN 0x07E0 /* 0, 255, 0 */ -#define ST7789_CYAN 0x07FF /* 0, 255, 255 */ -#define ST7789_RED 0xF800 /* 255, 0, 0 */ -#define ST7789_MAGENTA 0xF81F /* 255, 0, 255 */ -#define ST7789_YELLOW 0xFFE0 /* 255, 255, 0 */ -#define ST7789_WHITE 0xFFFF /* 255, 255, 255 */ -#define ST7789_ORANGE 0xFD20 /* 255, 165, 0 */ -#define ST7789_GREENYELLOW 0xAFE5 /* 173, 255, 47 */ -#define ST7789_PINK 0xF81F - - -class Arduino_ST7789 : public Renderer { - - public: - - Arduino_ST7789(int8_t DC, int8_t RST, int8_t SID, int8_t SCLK, int8_t CS, int8_t bp); - Arduino_ST7789(int8_t DC, int8_t RST, int8_t CS, int8_t bp); - - void setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1), - pushColor(uint16_t color), - fillScreen(uint16_t color), - drawPixel(int16_t x, int16_t y, uint16_t color), - drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color), - drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color), - fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color), - setRotation(uint8_t r), - invertDisplay(boolean i), - DisplayInit(int8_t p,int8_t size,int8_t rot,int8_t font), - setAddrWindow_int(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1), - init(uint16_t width, uint16_t height); - uint16_t Color565(uint8_t r, uint8_t g, uint8_t b); - uint16_t GetColorFromIndex(uint8_t index); - uint16_t color565(uint8_t r, uint8_t g, uint8_t b) { return Color565(r, g, b); } - void DisplayOnff(int8_t on); - void dim(uint8_t contrast); - void pushColors(uint16_t *data, uint16_t len, boolean first); - - protected: - uint8_t _colstart, _rowstart, _xstart, _ystart; // some displays need this changed - - void displayInit(const uint8_t *addr); - void spiwrite(uint8_t), - writecommand(uint8_t c), - writedata(uint8_t d), - commonInit(const uint8_t *cmdList); - - private: - - inline void CS_HIGH(void); - inline void CS_LOW(void); - inline void DC_HIGH(void); - inline void DC_LOW(void); - - boolean _hwSPI; - boolean _SPI9bit; - boolean _DCbit; - uint8_t dimmer; - int8_t _cs, _dc, _rst, _sid, _sclk, _bp; - -#if defined(USE_FAST_IO) - volatile uint32_t *dataport, *clkport, *csport, *dcport; - - #if defined(__AVR__) || defined(CORE_TEENSY) // 8 bit! - uint8_t datapinmask, clkpinmask, cspinmask, dcpinmask; - #else // 32 bit! - uint32_t datapinmask, clkpinmask, cspinmask, dcpinmask; - #endif -#endif - -}; - -#endif diff --git a/lib/lib_display/Arduino_ST7789-gemu-1.0/README.txt b/lib/lib_display/Arduino_ST7789-gemu-1.0/README.txt deleted file mode 100644 index 8aad7c0e9..000000000 --- a/lib/lib_display/Arduino_ST7789-gemu-1.0/README.txt +++ /dev/null @@ -1,3 +0,0 @@ -This is a library for the ST7789 IPS SPI display. - -Also requires the Adafruit_GFX library for Arduino. diff --git a/lib/lib_display/Arduino_ST7789-gemu-1.0/examples/graphicstest/graphicstest.ino b/lib/lib_display/Arduino_ST7789-gemu-1.0/examples/graphicstest/graphicstest.ino deleted file mode 100644 index baed077ab..000000000 --- a/lib/lib_display/Arduino_ST7789-gemu-1.0/examples/graphicstest/graphicstest.ino +++ /dev/null @@ -1,278 +0,0 @@ -/*************************************************** - This is a library for the ST7789 IPS SPI display. - - Originally written by Limor Fried/Ladyada for - Adafruit Industries. - - Modified by Ananev Ilia - ****************************************************/ - -#include // Core graphics library by Adafruit -#include // Hardware-specific library for ST7789 (with or without CS pin) -#include - -#define TFT_DC 8 -#define TFT_RST 9 -#define TFT_CS 10 // only for displays with CS pin -#define TFT_MOSI 11 // for hardware SPI data pin (all of available pins) -#define TFT_SCLK 13 // for hardware SPI sclk pin (all of available pins) - -//You can use different type of hardware initialization -//using hardware SPI (11, 13 on UNO; 51, 52 on MEGA; ICSP-4, ICSP-3 on DUE and etc) -//Arduino_ST7789 tft = Arduino_ST7789(TFT_DC, TFT_RST); //for display without CS pin -//Arduino_ST7789 tft = Arduino_ST7789(TFT_DC, TFT_RST, TFT_CS); //for display with CS pin -//or you can use software SPI on all available pins (slow) -//Arduino_ST7789 tft = Arduino_ST7789(TFT_DC, TFT_RST, TFT_MOSI, TFT_SCLK); //for display without CS pin -//Arduino_ST7789 tft = Arduino_ST7789(TFT_DC, TFT_RST, TFT_MOSI, TFT_SCLK, TFT_CS); //for display with CS pin -Arduino_ST7789 tft = Arduino_ST7789(-1, TFT_RST, TFT_MOSI, TFT_SCLK, TFT_CS); //for display with CS pin and DC via 9bit SPI - - -float p = 3.1415926; - -void setup(void) { - Serial.begin(9600); - Serial.print("Hello! ST7789 TFT Test"); - - tft.init(240, 240); // initialize a ST7789 chip, 240x240 pixels - - Serial.println("Initialized"); - - uint16_t time = millis(); - tft.fillScreen(BLACK); - time = millis() - time; - - Serial.println(time, DEC); - delay(500); - - // large block of text - tft.fillScreen(BLACK); - testdrawtext("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur adipiscing ante sed nibh tincidunt feugiat. Maecenas enim massa, fringilla sed malesuada et, malesuada sit amet turpis. Sed porttitor neque ut ante pretium vitae malesuada nunc bibendum. Nullam aliquet ultrices massa eu hendrerit. Ut sed nisi lorem. In vestibulum purus a tortor imperdiet posuere. ", WHITE); - delay(1000); - - // tft print function - tftPrintTest(); - delay(4000); - - // a single pixel - tft.drawPixel(tft.width()/2, tft.height()/2, GREEN); - delay(500); - - // line draw test - testlines(YELLOW); - delay(500); - - // optimized lines - testfastlines(RED, BLUE); - delay(500); - - testdrawrects(GREEN); - delay(500); - - testfillrects(YELLOW, MAGENTA); - delay(500); - - tft.fillScreen(BLACK); - testfillcircles(10, BLUE); - testdrawcircles(10, WHITE); - delay(500); - - testroundrects(); - delay(500); - - testtriangles(); - delay(500); - - mediabuttons(); - delay(500); - - Serial.println("done"); - delay(1000); -} - -void loop() { - tft.invertDisplay(true); - delay(500); - tft.invertDisplay(false); - delay(500); -} - -void testlines(uint16_t color) { - tft.fillScreen(BLACK); - for (int16_t x=0; x < tft.width(); x+=6) { - tft.drawLine(0, 0, x, tft.height()-1, color); - } - for (int16_t y=0; y < tft.height(); y+=6) { - tft.drawLine(0, 0, tft.width()-1, y, color); - } - - tft.fillScreen(BLACK); - for (int16_t x=0; x < tft.width(); x+=6) { - tft.drawLine(tft.width()-1, 0, x, tft.height()-1, color); - } - for (int16_t y=0; y < tft.height(); y+=6) { - tft.drawLine(tft.width()-1, 0, 0, y, color); - } - - tft.fillScreen(BLACK); - for (int16_t x=0; x < tft.width(); x+=6) { - tft.drawLine(0, tft.height()-1, x, 0, color); - } - for (int16_t y=0; y < tft.height(); y+=6) { - tft.drawLine(0, tft.height()-1, tft.width()-1, y, color); - } - - tft.fillScreen(BLACK); - for (int16_t x=0; x < tft.width(); x+=6) { - tft.drawLine(tft.width()-1, tft.height()-1, x, 0, color); - } - for (int16_t y=0; y < tft.height(); y+=6) { - tft.drawLine(tft.width()-1, tft.height()-1, 0, y, color); - } -} - -void testdrawtext(char *text, uint16_t color) { - tft.setCursor(0, 0); - tft.setTextColor(color); - tft.setTextWrap(true); - tft.print(text); -} - -void testfastlines(uint16_t color1, uint16_t color2) { - tft.fillScreen(BLACK); - for (int16_t y=0; y < tft.height(); y+=5) { - tft.drawFastHLine(0, y, tft.width(), color1); - } - for (int16_t x=0; x < tft.width(); x+=5) { - tft.drawFastVLine(x, 0, tft.height(), color2); - } -} - -void testdrawrects(uint16_t color) { - tft.fillScreen(BLACK); - for (int16_t x=0; x < tft.width(); x+=6) { - tft.drawRect(tft.width()/2 -x/2, tft.height()/2 -x/2 , x, x, color); - } -} - -void testfillrects(uint16_t color1, uint16_t color2) { - tft.fillScreen(BLACK); - for (int16_t x=tft.width()-1; x > 6; x-=6) { - tft.fillRect(tft.width()/2 -x/2, tft.height()/2 -x/2 , x, x, color1); - tft.drawRect(tft.width()/2 -x/2, tft.height()/2 -x/2 , x, x, color2); - } -} - -void testfillcircles(uint8_t radius, uint16_t color) { - for (int16_t x=radius; x < tft.width(); x+=radius*2) { - for (int16_t y=radius; y < tft.height(); y+=radius*2) { - tft.fillCircle(x, y, radius, color); - } - } -} - -void testdrawcircles(uint8_t radius, uint16_t color) { - for (int16_t x=0; x < tft.width()+radius; x+=radius*2) { - for (int16_t y=0; y < tft.height()+radius; y+=radius*2) { - tft.drawCircle(x, y, radius, color); - } - } -} - -void testtriangles() { - tft.fillScreen(BLACK); - int color = 0xF800; - int t; - int w = tft.width()/2; - int x = tft.height()-1; - int y = 0; - int z = tft.width(); - for(t = 0 ; t <= 15; t++) { - tft.drawTriangle(w, y, y, x, z, x, color); - x-=4; - y+=4; - z-=4; - color+=100; - } -} - -void testroundrects() { - tft.fillScreen(BLACK); - int color = 100; - int i; - int t; - for(t = 0 ; t <= 4; t+=1) { - int x = 0; - int y = 0; - int w = tft.width()-2; - int h = tft.height()-2; - for(i = 0 ; i <= 16; i+=1) { - tft.drawRoundRect(x, y, w, h, 5, color); - x+=2; - y+=3; - w-=4; - h-=6; - color+=1100; - } - color+=100; - } -} - -void tftPrintTest() { - tft.setTextWrap(false); - tft.fillScreen(BLACK); - tft.setCursor(0, 30); - tft.setTextColor(RED); - tft.setTextSize(1); - tft.println("Hello World!"); - tft.setTextColor(YELLOW); - tft.setTextSize(2); - tft.println("Hello World!"); - tft.setTextColor(GREEN); - tft.setTextSize(3); - tft.println("Hello World!"); - tft.setTextColor(BLUE); - tft.setTextSize(4); - tft.print(1234.567); - delay(1500); - tft.setCursor(0, 0); - tft.fillScreen(BLACK); - tft.setTextColor(WHITE); - tft.setTextSize(0); - tft.println("Hello World!"); - tft.setTextSize(1); - tft.setTextColor(GREEN); - tft.print(p, 6); - tft.println(" Want pi?"); - tft.println(" "); - tft.print(8675309, HEX); // print 8,675,309 out in HEX! - tft.println(" Print HEX!"); - tft.println(" "); - tft.setTextColor(WHITE); - tft.println("Sketch has been"); - tft.println("running for: "); - tft.setTextColor(MAGENTA); - tft.print(millis() / 1000); - tft.setTextColor(WHITE); - tft.print(" seconds."); -} - -void mediabuttons() { - // play - tft.fillScreen(BLACK); - tft.fillRoundRect(25, 10, 78, 60, 8, WHITE); - tft.fillTriangle(42, 20, 42, 60, 90, 40, RED); - delay(500); - // pause - tft.fillRoundRect(25, 90, 78, 60, 8, WHITE); - tft.fillRoundRect(39, 98, 20, 45, 5, GREEN); - tft.fillRoundRect(69, 98, 20, 45, 5, GREEN); - delay(500); - // play color - tft.fillTriangle(42, 20, 42, 60, 90, 40, BLUE); - delay(50); - // pause color - tft.fillRoundRect(39, 98, 20, 45, 5, RED); - tft.fillRoundRect(69, 98, 20, 45, 5, RED); - // play color - tft.fillTriangle(42, 20, 42, 60, 90, 40, GREEN); -} diff --git a/lib/lib_display/Arduino_ST7789-gemu-1.0/keywords.txt b/lib/lib_display/Arduino_ST7789-gemu-1.0/keywords.txt deleted file mode 100644 index bb1efcdcc..000000000 --- a/lib/lib_display/Arduino_ST7789-gemu-1.0/keywords.txt +++ /dev/null @@ -1,30 +0,0 @@ -####################################### -# Syntax Coloring Map -####################################### - -####################################### -# Datatypes (KEYWORD1) -####################################### - -ST7789 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 diff --git a/lib/lib_display/Arduino_ST7789-gemu-1.0/library.properties b/lib/lib_display/Arduino_ST7789-gemu-1.0/library.properties deleted file mode 100644 index 2511928c9..000000000 --- a/lib/lib_display/Arduino_ST7789-gemu-1.0/library.properties +++ /dev/null @@ -1,9 +0,0 @@ -name=Arduino ST7789 Library -version=0.9.5 -author=Ananev Ilya -maintainer=Ananev Ilya -sentence=This is a library for the ST7789 IPS SPI display. -paragraph=This is a library for the ST7789 IPS SPI display. -category=Display -url=https://github.com/ananevilya/Arduino-ST7789-Library -architectures=* diff --git a/lib/lib_display/LiquidCrystal_I2C-1.1.3/LiquidCrystal_I2C.o b/lib/lib_display/LiquidCrystal_I2C-1.1.3/LiquidCrystal_I2C.o deleted file mode 100644 index bca78e0d2..000000000 Binary files a/lib/lib_display/LiquidCrystal_I2C-1.1.3/LiquidCrystal_I2C.o and /dev/null differ diff --git a/tasmota/include/tasmota_configurations.h b/tasmota/include/tasmota_configurations.h index 43ea60799..6c17a1fdc 100644 --- a/tasmota/include/tasmota_configurations.h +++ b/tasmota/include/tasmota_configurations.h @@ -367,7 +367,7 @@ // #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 + // REMOVED - #define USE_DISPLAY_ST7789 // [DisplayModel 12] Enable ST7789 module #define USE_UNIVERSAL_DISPLAY #define USE_UNIVERSAL_TOUCH diff --git a/tasmota/include/tasmota_template.h b/tasmota/include/tasmota_template.h index 664001647..e2ec4d398 100644 --- a/tasmota/include/tasmota_template.h +++ b/tasmota/include/tasmota_template.h @@ -677,17 +677,19 @@ const uint16_t kGpioNiceList[] PROGMEM = { #ifdef USE_DISPLAY_EPAPER_42 AGPIO(GPIO_EPAPER42_CS), #endif // USE_DISPLAY_EPAPER_42 -#ifdef USE_DISPLAY_SSD1351 - AGPIO(GPIO_SSD1351_CS), - AGPIO(GPIO_SSD1351_DC), -#endif // USE_DISPLAY_SSD1351 +// REMOVED +// #ifdef USE_DISPLAY_SSD1351 +// AGPIO(GPIO_SSD1351_CS), +// AGPIO(GPIO_SSD1351_DC), +// #endif // USE_DISPLAY_SSD1351 #ifdef USE_DISPLAY_RA8876 AGPIO(GPIO_RA8876_CS), #endif // USE_DISPLAY_RA8876 -#ifdef USE_DISPLAY_ST7789 - AGPIO(GPIO_ST7789_CS), - AGPIO(GPIO_ST7789_DC), -#endif // USE_DISPLAY_ST7789 +// REMOVED +// #ifdef USE_DISPLAY_ST7789 +// AGPIO(GPIO_ST7789_CS), +// AGPIO(GPIO_ST7789_DC), +// #endif // USE_DISPLAY_ST7789 // REMOVED // #ifdef USE_DISPLAY_SSD1331 // AGPIO(GPIO_SSD1331_CS), diff --git a/tasmota/my_user_config.h b/tasmota/my_user_config.h index a122032ae..534592cea 100644 --- a/tasmota/my_user_config.h +++ b/tasmota/my_user_config.h @@ -807,7 +807,7 @@ https://rya.nc/tasmota-fingerprint.html" // REMOVED -- #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_SSD1351 // [DisplayModel 9] Enable SSD1351 module + // REMOVED -- #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 // REMOVED -- #define USE_DISPLAY_SSD1331 // [DisplayModel 14] Enable SSD1331 module diff --git a/tasmota/tasmota_support/support_features.ino b/tasmota/tasmota_support/support_features.ino index e4269c249..8489f8fe5 100644 --- a/tasmota/tasmota_support/support_features.ino +++ b/tasmota/tasmota_support/support_features.ino @@ -660,15 +660,15 @@ constexpr uint32_t feature[] = { // #if defined(USE_SPI) && defined(USE_DISPLAY) && defined(USE_DISPLAY_ILI9488) // 0x00010000 | // xdsp_08_ILI9488.ino // #endif -#if defined(USE_SPI) && defined(USE_DISPLAY) && defined(USE_DISPLAY_SSD1351) - 0x00020000 | // xdsp_09_SSD1351.ino -#endif +// #if defined(USE_SPI) && defined(USE_DISPLAY) && defined(USE_DISPLAY_SSD1351) +// 0x00020000 | // xdsp_09_SSD1351.ino +// #endif #if defined(USE_SPI) && defined(USE_DISPLAY) && defined(USE_DISPLAY_RA8876) 0x00040000 | // xdsp_10_RA8876.ino #endif -#if defined(USE_SPI) && defined(USE_DISPLAY) && defined(USE_DISPLAY_ST7789) - 0x00080000 | // xdsp_12_ST7789.ino -#endif +// #if defined(USE_SPI) && defined(USE_DISPLAY) && defined(USE_DISPLAY_ST7789) +// 0x00080000 | // xdsp_12_ST7789.ino +// #endif // REMOVED // #if defined(USE_SPI) && defined(USE_DISPLAY) && defined(USE_DISPLAY_SSD1331) // 0x00100000 | // xdsp_14_SSD1331.ino diff --git a/tasmota/tasmota_xdsp_display/xdsp_09_SSD1351.ino b/tasmota/tasmota_xdsp_display/xdsp_09_SSD1351.ino index ffb47f425..ba776ea9d 100644 --- a/tasmota/tasmota_xdsp_display/xdsp_09_SSD1351.ino +++ b/tasmota/tasmota_xdsp_display/xdsp_09_SSD1351.ino @@ -17,162 +17,165 @@ along with this program. If not, see . */ -#ifdef USE_SPI -#ifdef USE_DISPLAY -#ifdef USE_DISPLAY_SSD1351 +// REMOVED +// DEPRECATED - USE UNIVERSAL DISPLAY INSTEAD, https://tasmota.github.io/docs/Universal-Display-Driver/#migrating-to-udisplay -#define XDSP_09 9 +// #ifdef USE_SPI +// #ifdef USE_DISPLAY +// #ifdef USE_DISPLAY_SSD1351 -#define COLORED 1 -#define UNCOLORED 0 +// #define XDSP_09 9 -// uses about 1.9k flash + renderer class -// using font 8 is opional (num=3) -// very badly readable, but may be useful for graphs -#define USE_TINY_FONT +// #define COLORED 1 +// #define UNCOLORED 0 -#include +// // uses about 1.9k flash + renderer class +// // using font 8 is opional (num=3) +// // very badly readable, but may be useful for graphs +// #define USE_TINY_FONT -bool ssd1351_init_done = false; -extern uint8_t color_type; -SSD1351 *ssd1351; +// #include -/*********************************************************************************************/ +// bool ssd1351_init_done = false; +// extern uint8_t color_type; +// SSD1351 *ssd1351; -void SSD1351_InitDriver() { - if (PinUsed(GPIO_SSD1351_CS) && - ((TasmotaGlobal.soft_spi_enabled & SPI_MOSI) || (TasmotaGlobal.spi_enabled & SPI_MOSI))) { +// /*********************************************************************************************/ - Settings->display_model = XDSP_09; +// void SSD1351_InitDriver() { +// if (PinUsed(GPIO_SSD1351_CS) && +// ((TasmotaGlobal.soft_spi_enabled & SPI_MOSI) || (TasmotaGlobal.spi_enabled & SPI_MOSI))) { - if (Settings->display_width != SSD1351_WIDTH) { - Settings->display_width = SSD1351_WIDTH; - } - if (Settings->display_height != SSD1351_HEIGHT) { - Settings->display_height = SSD1351_HEIGHT; - } +// Settings->display_model = XDSP_09; - // default colors - fg_color = SSD1351_WHITE; - bg_color = SSD1351_BLACK; +// if (Settings->display_width != SSD1351_WIDTH) { +// Settings->display_width = SSD1351_WIDTH; +// } +// if (Settings->display_height != SSD1351_HEIGHT) { +// Settings->display_height = SSD1351_HEIGHT; +// } - // init renderer - if (TasmotaGlobal.soft_spi_enabled){ - ssd1351 = new SSD1351(Pin(GPIO_SSD1351_CS), Pin(GPIO_SSPI_MOSI), Pin(GPIO_SSPI_SCLK), Pin(GPIO_SSD1351_DC)); - } - else if (TasmotaGlobal.spi_enabled) { - ssd1351 = new SSD1351(Pin(GPIO_SSD1351_CS), Pin(GPIO_SPI_MOSI), Pin(GPIO_SPI_CLK), Pin(GPIO_SSD1351_DC)); - } +// // default colors +// fg_color = SSD1351_WHITE; +// bg_color = SSD1351_BLACK; - delay(100); - ssd1351->begin(); - renderer = ssd1351; - renderer->DisplayInit(DISPLAY_INIT_MODE,Settings->display_size,Settings->display_rotate,Settings->display_font); - renderer->dim(GetDisplayDimmer16()); +// // init renderer +// if (TasmotaGlobal.soft_spi_enabled){ +// ssd1351 = new SSD1351(Pin(GPIO_SSD1351_CS), Pin(GPIO_SSPI_MOSI), Pin(GPIO_SSPI_SCLK), Pin(GPIO_SSD1351_DC)); +// } +// else if (TasmotaGlobal.spi_enabled) { +// ssd1351 = new SSD1351(Pin(GPIO_SSD1351_CS), Pin(GPIO_SPI_MOSI), Pin(GPIO_SPI_CLK), Pin(GPIO_SSD1351_DC)); +// } -#ifdef SHOW_SPLASH - if (!Settings->flag5.display_no_splash) { - // Welcome text - renderer->setTextFont(2); - renderer->setTextColor(SSD1351_WHITE,SSD1351_BLACK); - renderer->DrawStringAt(10, 60, "SSD1351", SSD1351_RED,0); - delay(1000); - } +// delay(100); +// ssd1351->begin(); +// renderer = ssd1351; +// renderer->DisplayInit(DISPLAY_INIT_MODE,Settings->display_size,Settings->display_rotate,Settings->display_font); +// renderer->dim(GetDisplayDimmer16()); -#endif - color_type = COLOR_COLOR; +// #ifdef SHOW_SPLASH +// if (!Settings->flag5.display_no_splash) { +// // Welcome text +// renderer->setTextFont(2); +// renderer->setTextColor(SSD1351_WHITE,SSD1351_BLACK); +// renderer->DrawStringAt(10, 60, "SSD1351", SSD1351_RED,0); +// delay(1000); +// } - ssd1351_init_done = true; - AddLog(LOG_LEVEL_INFO, PSTR("DSP: SSD1351")); - } -} +// #endif +// color_type = COLOR_COLOR; -#ifdef USE_DISPLAY_MODES1TO5 +// ssd1351_init_done = true; +// AddLog(LOG_LEVEL_INFO, PSTR("DSP: SSD1351")); +// } +// } -void SSD1351PrintLog(void) { - disp_refresh--; - if (!disp_refresh) { - disp_refresh = Settings->display_refresh; - if (!disp_screen_buffer_cols) { DisplayAllocScreenBuffer(); } +// #ifdef USE_DISPLAY_MODES1TO5 - char* txt = DisplayLogBuffer('\370'); - if (txt != NULL) { - uint8_t last_row = Settings->display_rows -1; +// void SSD1351PrintLog(void) { +// disp_refresh--; +// if (!disp_refresh) { +// disp_refresh = Settings->display_refresh; +// if (!disp_screen_buffer_cols) { DisplayAllocScreenBuffer(); } - renderer->clearDisplay(); - renderer->setTextSize(Settings->display_size); - renderer->setCursor(0,0); - for (byte i = 0; i < last_row; i++) { - strlcpy(disp_screen_buffer[i], disp_screen_buffer[i +1], disp_screen_buffer_cols); - renderer->println(disp_screen_buffer[i]); - } - strlcpy(disp_screen_buffer[last_row], txt, disp_screen_buffer_cols); - DisplayFillScreen(last_row); +// char* txt = DisplayLogBuffer('\370'); +// if (txt != NULL) { +// uint8_t last_row = Settings->display_rows -1; - AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "[%s]"), disp_screen_buffer[last_row]); +// renderer->clearDisplay(); +// renderer->setTextSize(Settings->display_size); +// renderer->setCursor(0,0); +// for (byte i = 0; i < last_row; i++) { +// strlcpy(disp_screen_buffer[i], disp_screen_buffer[i +1], disp_screen_buffer_cols); +// renderer->println(disp_screen_buffer[i]); +// } +// strlcpy(disp_screen_buffer[last_row], txt, disp_screen_buffer_cols); +// DisplayFillScreen(last_row); - renderer->println(disp_screen_buffer[last_row]); - renderer->Updateframe(); - } - } -} +// AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "[%s]"), disp_screen_buffer[last_row]); -void SSD1351Time(void) { - char line[12]; +// renderer->println(disp_screen_buffer[last_row]); +// renderer->Updateframe(); +// } +// } +// } - renderer->clearDisplay(); - renderer->setTextSize(2); - renderer->setCursor(0, 0); - snprintf_P(line, sizeof(line), PSTR(" %02d" D_HOUR_MINUTE_SEPARATOR "%02d" D_MINUTE_SECOND_SEPARATOR "%02d"), RtcTime.hour, RtcTime.minute, RtcTime.second); // [ 12:34:56 ] - renderer->println(line); - renderer->println(); - snprintf_P(line, sizeof(line), PSTR("%02d" D_MONTH_DAY_SEPARATOR "%02d" D_YEAR_MONTH_SEPARATOR "%04d"), RtcTime.day_of_month, RtcTime.month, RtcTime.year); // [01-02-2018] - renderer->println(line); - renderer->Updateframe(); -} +// void SSD1351Time(void) { +// char line[12]; -void SSD1351Refresh(void) { // Every second - if (Settings->display_mode) { // Mode 0 is User text - switch (Settings->display_mode) { - case 1: // Time - SSD1351Time(); - break; - case 2: // Local - case 3: // Local - case 4: // Mqtt - case 5: // Mqtt - SSD1351PrintLog(); - break; - } - } -} +// renderer->clearDisplay(); +// renderer->setTextSize(2); +// renderer->setCursor(0, 0); +// snprintf_P(line, sizeof(line), PSTR(" %02d" D_HOUR_MINUTE_SEPARATOR "%02d" D_MINUTE_SECOND_SEPARATOR "%02d"), RtcTime.hour, RtcTime.minute, RtcTime.second); // [ 12:34:56 ] +// renderer->println(line); +// renderer->println(); +// snprintf_P(line, sizeof(line), PSTR("%02d" D_MONTH_DAY_SEPARATOR "%02d" D_YEAR_MONTH_SEPARATOR "%04d"), RtcTime.day_of_month, RtcTime.month, RtcTime.year); // [01-02-2018] +// renderer->println(line); +// renderer->Updateframe(); +// } -#endif // USE_DISPLAY_MODES1TO5 +// void SSD1351Refresh(void) { // Every second +// if (Settings->display_mode) { // Mode 0 is User text +// switch (Settings->display_mode) { +// case 1: // Time +// SSD1351Time(); +// break; +// case 2: // Local +// case 3: // Local +// case 4: // Mqtt +// case 5: // Mqtt +// SSD1351PrintLog(); +// break; +// } +// } +// } -/*********************************************************************************************\ - * Interface -\*********************************************************************************************/ +// #endif // USE_DISPLAY_MODES1TO5 -bool Xdsp09(uint32_t function) { - bool result = false; +// /*********************************************************************************************\ +// * Interface +// \*********************************************************************************************/ - if (FUNC_DISPLAY_INIT_DRIVER == function) { - SSD1351_InitDriver(); - } - else if (ssd1351_init_done && (XDSP_09 == Settings->display_model)) { - switch (function) { - case FUNC_DISPLAY_MODEL: - result = true; - break; -#ifdef USE_DISPLAY_MODES1TO5 - case FUNC_DISPLAY_EVERY_SECOND: - SSD1351Refresh(); - break; -#endif // USE_DISPLAY_MODES1TO5 - } - } - return result; -} -#endif // USE_DISPLAY_SSD1351 -#endif // USE_DISPLAY -#endif // USE_SPI +// bool Xdsp09(uint32_t function) { +// bool result = false; + +// if (FUNC_DISPLAY_INIT_DRIVER == function) { +// SSD1351_InitDriver(); +// } +// else if (ssd1351_init_done && (XDSP_09 == Settings->display_model)) { +// switch (function) { +// case FUNC_DISPLAY_MODEL: +// result = true; +// break; +// #ifdef USE_DISPLAY_MODES1TO5 +// case FUNC_DISPLAY_EVERY_SECOND: +// SSD1351Refresh(); +// break; +// #endif // USE_DISPLAY_MODES1TO5 +// } +// } +// return result; +// } +// #endif // USE_DISPLAY_SSD1351 +// #endif // USE_DISPLAY +// #endif // USE_SPI diff --git a/tasmota/tasmota_xdsp_display/xdsp_12_ST7789.ino b/tasmota/tasmota_xdsp_display/xdsp_12_ST7789.ino index 2b3c818ae..6f8af6826 100644 --- a/tasmota/tasmota_xdsp_display/xdsp_12_ST7789.ino +++ b/tasmota/tasmota_xdsp_display/xdsp_12_ST7789.ino @@ -17,193 +17,196 @@ along with this program. If not, see . */ -//#ifdef USE_SPI -#ifdef USE_SPI -#ifdef USE_DISPLAY -#ifdef USE_DISPLAY_ST7789 +// REMOVED +// DEPRECATED - USE UNIVERSAL DISPLAY INSTEAD, https://tasmota.github.io/docs/Universal-Display-Driver/#migrating-to-udisplay -#define XDSP_12 12 -#define XI2C_38 38 // See I2CDEVICES.md +// //#ifdef USE_SPI +// #ifdef USE_SPI +// #ifdef USE_DISPLAY +// #ifdef USE_DISPLAY_ST7789 -#undef COLORED -#define COLORED 1 -#undef UNCOLORED -#define UNCOLORED 0 +// #define XDSP_12 12 +// #define XI2C_38 38 // See I2CDEVICES.md -// touch panel controller -#undef FT5206_address -#define FT5206_address 0x38 +// #undef COLORED +// #define COLORED 1 +// #undef UNCOLORED +// #define UNCOLORED 0 -// using font 8 is opional (num=3) -// very badly readable, but may be useful for graphs -#undef USE_TINY_FONT -#define USE_TINY_FONT +// // touch panel controller +// #undef FT5206_address +// #define FT5206_address 0x38 + +// // using font 8 is opional (num=3) +// // very badly readable, but may be useful for graphs +// #undef USE_TINY_FONT +// #define USE_TINY_FONT -#include -#include +// #include +// #include -// currently fixed -#define BACKPLANE_PIN 2 - #ifdef USE_LANBON_L8 - #undef BACKPLANE_PIN - #define BACKPLANE_PIN 5 - #endif // USE_LANBON_L8 +// // currently fixed +// #define BACKPLANE_PIN 2 +// #ifdef USE_LANBON_L8 +// #undef BACKPLANE_PIN +// #define BACKPLANE_PIN 5 +// #endif // USE_LANBON_L8 -extern uint8_t color_type; -Arduino_ST7789 *st7789; +// extern uint8_t color_type; +// Arduino_ST7789 *st7789; -#ifdef USE_FT5206 -uint8_t st7789_ctouch_counter = 0; -#endif // USE_FT5206 -bool st7789_init_done = false; +// #ifdef USE_FT5206 +// uint8_t st7789_ctouch_counter = 0; +// #endif // USE_FT5206 +// bool st7789_init_done = false; -/*********************************************************************************************/ +// /*********************************************************************************************/ -void ST7789_InitDriver(void) { - if (PinUsed(GPIO_ST7789_DC) && // This device does not need CS which breaks SPI bus usage - ((TasmotaGlobal.soft_spi_enabled & SPI_MOSI) || (TasmotaGlobal.spi_enabled & SPI_MOSI))) { +// void ST7789_InitDriver(void) { +// if (PinUsed(GPIO_ST7789_DC) && // This device does not need CS which breaks SPI bus usage +// ((TasmotaGlobal.soft_spi_enabled & SPI_MOSI) || (TasmotaGlobal.spi_enabled & SPI_MOSI))) { - Settings->display_model = XDSP_12; +// Settings->display_model = XDSP_12; - if (!Settings->display_width) { - Settings->display_width = 240; - } - if (!Settings->display_height) { - Settings->display_height = 240; - } +// if (!Settings->display_width) { +// Settings->display_width = 240; +// } +// if (!Settings->display_height) { +// Settings->display_height = 240; +// } - // default colors - fg_color = ST7789_WHITE; - bg_color = ST7789_BLACK; +// // default colors +// fg_color = ST7789_WHITE; +// bg_color = ST7789_BLACK; - int8_t bppin = BACKPLANE_PIN; - if (PinUsed(GPIO_BACKLIGHT)) { - bppin = Pin(GPIO_BACKLIGHT); - } +// int8_t bppin = BACKPLANE_PIN; +// if (PinUsed(GPIO_BACKLIGHT)) { +// bppin = Pin(GPIO_BACKLIGHT); +// } - // init renderer, may use hardware spi - if (TasmotaGlobal.soft_spi_enabled) { - st7789 = new Arduino_ST7789(Pin(GPIO_ST7789_DC), Pin(GPIO_OLED_RESET), Pin(GPIO_SSPI_MOSI), Pin(GPIO_SSPI_SCLK), Pin(GPIO_ST7789_CS), bppin); - } - else if (TasmotaGlobal.spi_enabled) { - st7789 = new Arduino_ST7789(Pin(GPIO_ST7789_DC), Pin(GPIO_OLED_RESET), Pin(GPIO_ST7789_CS), bppin); - } +// // init renderer, may use hardware spi +// if (TasmotaGlobal.soft_spi_enabled) { +// st7789 = new Arduino_ST7789(Pin(GPIO_ST7789_DC), Pin(GPIO_OLED_RESET), Pin(GPIO_SSPI_MOSI), Pin(GPIO_SSPI_SCLK), Pin(GPIO_ST7789_CS), bppin); +// } +// else if (TasmotaGlobal.spi_enabled) { +// st7789 = new Arduino_ST7789(Pin(GPIO_ST7789_DC), Pin(GPIO_OLED_RESET), Pin(GPIO_ST7789_CS), bppin); +// } - st7789->init(Settings->display_width,Settings->display_height); - renderer = st7789; - renderer->DisplayInit(DISPLAY_INIT_MODE,Settings->display_size,Settings->display_rotate,Settings->display_font); - renderer->dim(GetDisplayDimmer16()); +// st7789->init(Settings->display_width,Settings->display_height); +// renderer = st7789; +// renderer->DisplayInit(DISPLAY_INIT_MODE,Settings->display_size,Settings->display_rotate,Settings->display_font); +// renderer->dim(GetDisplayDimmer16()); -#ifdef SHOW_SPLASH - if (!Settings->flag5.display_no_splash) { - // Welcome text - renderer->setTextColor(ST7789_WHITE,ST7789_BLACK); - renderer->setTextFont(2); - renderer->DrawStringAt(30, (Settings->display_height-12)/2, "ST7789 TFT!", ST7789_WHITE,0); - delay(1000); - } -#endif +// #ifdef SHOW_SPLASH +// if (!Settings->flag5.display_no_splash) { +// // Welcome text +// renderer->setTextColor(ST7789_WHITE,ST7789_BLACK); +// renderer->setTextFont(2); +// renderer->DrawStringAt(30, (Settings->display_height-12)/2, "ST7789 TFT!", ST7789_WHITE,0); +// delay(1000); +// } +// #endif - color_type = COLOR_COLOR; +// color_type = COLOR_COLOR; -#ifdef ESP32 -#ifdef USE_FT5206 - // start digitizer with fixed adress and pins for esp32 - #undef SDA_2 - #undef SCL_2 - #define SDA_2 23 - #define SCL_2 32 - #ifdef USE_LANBON_L8 - #undef SDA_2 - #undef SCL_2 - #define SDA_2 4 - #define SCL_2 0 - #endif // USE_LANBON_L8 - Wire1.begin(SDA_2, SCL_2, (uint32_t)400000); - FT5206_Touch_Init(Wire1); -#endif // USE_FT5206 -#endif // ESP32 +// #ifdef ESP32 +// #ifdef USE_FT5206 +// // start digitizer with fixed adress and pins for esp32 +// #undef SDA_2 +// #undef SCL_2 +// #define SDA_2 23 +// #define SCL_2 32 +// #ifdef USE_LANBON_L8 +// #undef SDA_2 +// #undef SCL_2 +// #define SDA_2 4 +// #define SCL_2 0 +// #endif // USE_LANBON_L8 +// Wire1.begin(SDA_2, SCL_2, (uint32_t)400000); +// FT5206_Touch_Init(Wire1); +// #endif // USE_FT5206 +// #endif // ESP32 - st7789_init_done = true; - AddLog(LOG_LEVEL_INFO, PSTR("DSP: ST7789")); - } -} +// st7789_init_done = true; +// AddLog(LOG_LEVEL_INFO, PSTR("DSP: ST7789")); +// } +// } -#ifdef ESP32 -#ifdef USE_FT5206 -#ifdef USE_TOUCH_BUTTONS +// #ifdef ESP32 +// #ifdef USE_FT5206 +// #ifdef USE_TOUCH_BUTTONS -void ST7789_RotConvert(int16_t *x, int16_t *y) { -int16_t temp; - if (renderer) { - uint8_t rot=renderer->getRotation(); - switch (rot) { - case 0: - break; - case 1: - temp=*y; - *y=renderer->height()-*x; - *x=temp; - break; - case 2: - *x=renderer->width()-*x; - *y=renderer->height()-*y; - break; - case 3: - temp=*y; - *y=*x; - *x=renderer->width()-temp; - break; - } - } -} +// void ST7789_RotConvert(int16_t *x, int16_t *y) { +// int16_t temp; +// if (renderer) { +// uint8_t rot=renderer->getRotation(); +// switch (rot) { +// case 0: +// break; +// case 1: +// temp=*y; +// *y=renderer->height()-*x; +// *x=temp; +// break; +// case 2: +// *x=renderer->width()-*x; +// *y=renderer->height()-*y; +// break; +// case 3: +// temp=*y; +// *y=*x; +// *x=renderer->width()-temp; +// break; +// } +// } +// } -// check digitizer hit -void ST7789_CheckTouch() { -st7789_ctouch_counter++; - if (2 == st7789_ctouch_counter) { - // every 100 ms should be enough - st7789_ctouch_counter = 0; - Touch_Check(ST7789_RotConvert); - } -} -#endif // USE_TOUCH_BUTTONS -#endif // USE_FT5206 -#endif // ESP32 +// // check digitizer hit +// void ST7789_CheckTouch() { +// st7789_ctouch_counter++; +// if (2 == st7789_ctouch_counter) { +// // every 100 ms should be enough +// st7789_ctouch_counter = 0; +// Touch_Check(ST7789_RotConvert); +// } +// } +// #endif // USE_TOUCH_BUTTONS +// #endif // USE_FT5206 +// #endif // ESP32 -/*********************************************************************************************/ -/*********************************************************************************************\ - * Interface -\*********************************************************************************************/ -bool Xdsp12(uint32_t function) -{ - bool result = false; +// /*********************************************************************************************/ +// /*********************************************************************************************\ +// * Interface +// \*********************************************************************************************/ +// bool Xdsp12(uint32_t function) +// { +// bool result = false; -//AddLog(LOG_LEVEL_INFO, PSTR("touch %d - %d"), FT5206_found, function); +// //AddLog(LOG_LEVEL_INFO, PSTR("touch %d - %d"), FT5206_found, function); - if (FUNC_DISPLAY_INIT_DRIVER == function) { - ST7789_InitDriver(); - } - else if (st7789_init_done && (XDSP_12 == Settings->display_model)) { - switch (function) { - case FUNC_DISPLAY_MODEL: - result = true; - break; - case FUNC_DISPLAY_EVERY_50_MSECOND: -#ifdef USE_FT5206 -#ifdef USE_TOUCH_BUTTONS - if (FT5206_found) { - ST7789_CheckTouch(); - } -#endif -#endif // USE_FT5206 - break; - } - } - return result; -} +// if (FUNC_DISPLAY_INIT_DRIVER == function) { +// ST7789_InitDriver(); +// } +// else if (st7789_init_done && (XDSP_12 == Settings->display_model)) { +// switch (function) { +// case FUNC_DISPLAY_MODEL: +// result = true; +// break; +// case FUNC_DISPLAY_EVERY_50_MSECOND: +// #ifdef USE_FT5206 +// #ifdef USE_TOUCH_BUTTONS +// if (FT5206_found) { +// ST7789_CheckTouch(); +// } +// #endif +// #endif // USE_FT5206 +// break; +// } +// } +// return result; +// } -#endif // USE_DISPLAY_ST7789 -#endif // USE_DISPLAY -#endif // USE_SPI +// #endif // USE_DISPLAY_ST7789 +// #endif // USE_DISPLAY +// #endif // USE_SPI