Skip to content

Commit 769d429

Browse files
committed
TTGO T-Display separate example is added
1 parent 7ed6344 commit 769d429

File tree

17 files changed

+118
-13
lines changed

17 files changed

+118
-13
lines changed

component.mk

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ COMPONENT_SRCDIRS := ./src \
99
./src/v2/gui \
1010
./src/v2/lcd \
1111
./src/v2/lcd/lcdany \
12+
./src/v2/lcd/lcdwio \
13+
./src/v2/lcd/lcdttgo \
1214
./src/v2/lcd/pcd8544 \
1315
./src/v2/lcd/ssd1306 \
1416
./src/v2/lcd/sh1107 \
@@ -18,6 +20,7 @@ COMPONENT_SRCDIRS := ./src \
1820
./src/v2/lcd/ssd1331 \
1921
./src/v2/lcd/ssd1351 \
2022
./src/v2/lcd/st7735 \
23+
./src/v2/lcd/st7789 \
2124
./src/v2/lcd/il9163 \
2225
./src/v2/lcd/ili9341 \
2326
./src/canvas \

examples/demos/il9163_demo/il9163_demo.ino

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "lcdgfx_gui.h"
3434
#include "owl.h"
3535

36+
// The parameters are RST pin, BUS number, CS pin, DC pin, FREQ (0 means default), CLK pin, MOSI pin
3637
DisplayIL9163_128x128x16_SPI display(3,{-1, 4, 5, 0,-1,-1}); // Use this line for Atmega328p
3738
//DisplayIL9163_128x128x16_SPI display(3,{-1, -1, 4, 0, -1, -1}); // FOR ATTINY
3839
//DisplayIL9163_128x128x16_SPI display(-1,{-1, 0, 1, 0, -1, -1); // Use this line for nano pi (RST not used, 0=CE, gpio1=D/C)

examples/demos/ili9341_demo/ili9341_demo.ino

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "lcdgfx_gui.h"
3434
#include "owl.h"
3535

36+
// The parameters are RST pin, BUS number, CS pin, DC pin, FREQ (0 means default), CLK pin, MOSI pin
3637
DisplayILI9341_240x320x16_SPI display(3,{-1, 4, 5, 0,-1,-1}); // Use this line for Atmega328p
3738
//DisplayILI9341_240x320x16_SPI display(3,{-1, -1, 4, 0, -1, -1}); // FOR ATTINY
3839
//DisplayILI9341_240x320x16_SPI display(-1,{-1, 0, 1, 0, -1, -1); // Use this line for nano pi (RST not used, 0=CE, gpio1=D/C)

examples/demos/pcd8544_demo/pcd8544_demo.ino

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include "lcdgfx_gui.h"
4040
#include "owl.h"
4141

42+
// The parameters are RST pin, BUS number, CS pin, DC pin, FREQ (0 means default), CLK pin, MOSI pin
4243
DisplayPCD8544_84x48_SPI display(3,{-1, 4, 5, 0,-1,-1}); // Use this line for Atmega328p
4344
//DisplayPCD8544_84x48_SPI display(3,{-1, -1, 4, 0, -1, -1}); // FOR ATTINY
4445
//DisplayPCD8544_84x48_SPI display(-1,{-1, 0, 1, 0, -1, -1); // Use this line for nano pi (RST not used, 0=CE, gpio1=D/C)

examples/demos/ssd1306_demo/ssd1306_demo.ino

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include "owl.h"
4242

4343
DisplaySSD1306_128x64_I2C display(-1); // or (-1,{busId, addr, scl, sda, frequency}). This line is suitable for most platforms by default
44+
// The parameters are RST pin, BUS number, CS pin, DC pin, FREQ (0 means default), CLK pin, MOSI pin
4445
//DisplaySSD1306_128x64_SPI display(-1,{-1, 0, 1, 0, -1, -1); // Use this line for nano pi (RST not used, 0=CE, gpio1=D/C)
4546
//DisplaySSD1306_128x64_SPI display(3,{-1, 4, 5, 0,-1,-1}); // Use this line for Atmega328p (3=RST, 4=CE, 5=D/C)
4647
//DisplaySSD1306_128x64_SPI display(24,{-1, 0, 23, 0,-1,-1}); // Use this line for Raspberry (gpio24=RST, 0=CE, gpio23=D/C)

examples/demos/ssd1325_demo/ssd1325_demo.ino

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "lcdgfx_gui.h"
3434
#include "sova.h"
3535

36+
// The parameters are RST pin, BUS number, CS pin, DC pin, FREQ (0 means default), CLK pin, MOSI pin
3637
DisplaySSD1325_128x64_SPI display(3,{-1, 4, 5, 0,-1,-1}); // Use this line for Atmega328p (3=RST, 4=CE, 5=D/C)
3738
//DisplaySSD1325_128x64_I2C display(-1); // or (-1,{busId, addr, scl, sda, frequency}). This line is suitable for most platforms by default
3839
//DisplaySSD1325_128x64_SPI display(-1,{-1, 0, 1, 0, -1, -1); // Use this line for nano pi (RST not used, 0=CE, gpio1=D/C)

examples/demos/ssd1327_demo/ssd1327_demo.ino

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "lcdgfx_gui.h"
3434
#include "sova.h"
3535

36+
// The parameters are RST pin, BUS number, CS pin, DC pin, FREQ (0 means default), CLK pin, MOSI pin
3637
DisplaySSD1327_128x128_SPI display(3,{-1, 4, 5, 0,-1,-1}); // Use this line for Atmega328p (3=RST, 4=CE, 5=D/C)
3738
//DisplaySSD1327_128x128_I2C display(-1); // or (-1,{busId, addr, scl, sda, frequency}). This line is suitable for most platforms by default
3839
//DisplaySSD1327_128x128_SPI display(-1,{-1, 0, 1, 0, -1, -1); // Use this line for nano pi (RST not used, 0=CE, gpio1=D/C)

examples/demos/ssd1331_demo/ssd1331_demo.ino

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "lcdgfx_gui.h"
3434
#include "sova.h"
3535

36+
// The parameters are RST pin, BUS number, CS pin, DC pin, FREQ (0 means default), CLK pin, MOSI pin
3637
DisplaySSD1331_96x64x8_SPI display(3,{-1, 4, 5, 0,-1,-1}); // Use this line for Atmega328p
3738
//DisplaySSD1331_96x64x8_SPI display(4,{-1, -1, 5, 0,-1,-1}); // Use this line for ESP8266 Arduino style rst=4, CS=-1, DC=5
3839
// And ESP8266 RTOS IDF. GPIO4 is D2, GPIO5 is D1 on NodeMCU boards

examples/demos/ssd1331_demo_16bit/ssd1331_demo_16bit.ino

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "lcdgfx_gui.h"
3434
#include "sova.h"
3535

36+
// The parameters are RST pin, BUS number, CS pin, DC pin, FREQ (0 means default), CLK pin, MOSI pin
3637
DisplaySSD1331_96x64x16_SPI display(3,{-1, 4, 5, 0,-1,-1}); // Use this line for Atmega328p
3738
//DisplaySSD1331_96x64x16_SPI display(4,{-1, -1, 5, 0,-1,-1}); // Use this line for ESP8266 Arduino style rst=4, CS=-1, DC=5
3839
// And ESP8266 RTOS IDF. GPIO4 is D2, GPIO5 is D1 on NodeMCU boards

examples/demos/ssd1351_demo/ssd1351_demo.ino

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "lcdgfx_gui.h"
3434
#include "owl.h"
3535

36+
// The parameters are RST pin, BUS number, CS pin, DC pin, FREQ (0 means default), CLK pin, MOSI pin
3637
DisplaySSD1351_128x128x16_SPI display(3,{-1, 4, 5, 0,-1,-1}); // Use this line for Atmega328p
3738
//DisplaySSD1351_128x128x16_SPI display(22,{-1, 5, 21, 0,-1,-1}); // Use this line for ESP32 (VSPI) (gpio22=RST, gpio5=CE for VSPI, gpio21=D/C
3839
//DisplaySSD1351_128x128x16_SPI display(24,{-1, 0, 23, 0,-1,-1}); // Use this line for Raspberry Pi

examples/demos/st7735_demo/st7735_demo.ino

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "lcdgfx_gui.h"
3434
#include "owl.h"
3535

36+
// The parameters are RST pin, BUS number, CS pin, DC pin, FREQ (0 means default), CLK pin, MOSI pin
3637
DisplayST7735_128x160x16_SPI display(3,{-1, 4, 5, 0,-1,-1}); // Use this line for Atmega328p
3738
//DisplayST7735_80x160x16_SPI display(3,{-1, 4, 5, 0,-1,-1}); // Use this line for Atmega328p
3839
//DisplayST7735_128x160x16_SPI display(3,{-1, -1, 4, 0, -1, -1}); // FOR ATTINY

examples/demos/st7789_demo/st7789_demo.ino

+4-5
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,16 @@
3535

3636
#define TFT_BL 4
3737

38-
39-
DisplayST7789_135x240x16_SPI display(23,{-1, 5, 16, 0, 18, 19}); // Use this line for ESP32 (VSPI) TTGO (gpio23=RST, gpio5=CE for VSPI, gpio16=D/C)
40-
//DisplayST7789_135x240x16_CustomSPI<EspSpi> display(23, 16, -1, 5, 16, 18, 19, 32000000); // ESP32 TTGO RST, DC, BUS, CS, DC, CLK, MOSI, FREQ
41-
//DisplayST7789_135x240x16_SPI display(3,{-1, 4, 5, 0,-1,-1}); // Use this line for Atmega328p
42-
//DisplayST7789_135x240x16_SPI display(3,{-1, 4, 5, 0,-1,-1}); // Use this line for Atmega328p
38+
// The parameters are RST pin, BUS number, CS pin, DC pin, FREQ (0 means default), CLK pin, MOSI pin
39+
DisplayST7789_135x240x16_SPI display(3,{-1, 4, 5, 0,-1,-1}); // Use this line for Atmega328p
40+
//DisplayST7789_135x240x16_SPI display(22,{-1, 5, 21, 0, -1, -1}); // Use this line for ESP32 (VSPI) TTGO (gpio23=RST, gpio5=CE for VSPI, gpio16=D/C)
4341
//DisplayST7789_135x240x16_SPI display(3,{-1, -1, 4, 0, -1, -1}); // FOR ATTINY
4442
//DisplayST7789_135x240x16_SPI display(-1,{-1, 0, 1, 0, -1, -1); // Use this line for nano pi (RST not used, 0=CE, gpio1=D/C)
4543
//DisplayST7789_135x240x16_SPI display(24,{-1, 0, 23, 0,-1,-1}); // Use this line for Raspberry (gpio24=RST, 0=CE, gpio23=D/C)
4644
//DisplayST7789_135x240x16_SPI display(22,{-1, 5, 21, 0,-1,-1}); // Use this line for ESP32 (VSPI) (gpio22=RST, gpio5=CE for VSPI, gpio21=D/C)
4745
//DisplayST7789_135x240x16_SPI display(4,{-1, -1, 5, 0,-1,-1}); // Use this line for ESP8266 Arduino style rst=4, CS=-1, DC=5
4846
// And ESP8266 RTOS IDF. GPIO4 is D2, GPIO5 is D1 on NodeMCU boards
47+
//DisplayST7789_135x240x16_CustomSPI<EspSpi> display(23, 16, -1, 5, 16, 18, 19, 32000000); // ESP32 TTGO RST, DC, BUS, CS, DC, CLK, MOSI, FREQ
4948

5049

5150
/*

examples/ttgo/t_display/t_display.ino

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
MIT License
33
4-
Copyright (c) 2019-2020, Alexey Dynda
4+
Copyright (c) 2022, Alexey Dynda
55
66
Permission is hereby granted, free of charge, to any person obtaining a copy
77
of this software and associated documentation files (the "Software"), to deal
@@ -35,10 +35,10 @@
3535

3636
#define TFT_BL 4
3737

38-
39-
DisplayST7789_135x240x16_SPI display(23,{-1, 5, 16, 0, 18, 19}); // Use this line for ESP32 (VSPI) (gpio23=RST, gpio5=CE for VSPI, gpio16=D/C)
40-
//DisplayST7789_135x240x16_CustomSPI<EspSpi> display(23, 16, -1, 5, 16, 18, 19, 32000000); // RST, DC, BUS, CS, DC, CLK, MOSI, FREQ
41-
38+
DisplayTTGO_135x240x16 display;
39+
// Use the constructor below, if the one above doesn't work for you
40+
// ESP32 HAL SPI implemented in this library can handle only 32MHz
41+
//DisplayST7789_135x240x16_CustomSPI<EspSpi> display(23, 16, -1, 5, 16, 18, 19, 32000000); // ESP32 TTGO RST, DC, BUS, CS, DC, CLK, MOSI, FREQ
4242

4343
/*
4444
* Heart image below is defined directly in flash memory.
@@ -99,8 +99,8 @@ static void bitmapDemo()
9999
* Refer to C++ documentation.
100100
*/
101101
NanoPoint sprite;
102-
NanoEngine16<DisplayST7789_135x240x16_SPI> engine( display );
103-
//NanoEngine16<DisplayST7789_135x240x16_CustomSPI<EspSpi>> engine( display );
102+
NanoEngine16<DisplayTTGO_135x240x16> engine( display );
103+
// NanoEngine16<DisplayST7789_135x240x16_CustomSPI<EspSpi>> engine( display );
104104
static void spriteDemo()
105105
{
106106
// We not need to clear screen, engine will do it for us

src/Makefile.src

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22
#
3-
# Copyright (c) 2018-2021, Alexey Dynda
3+
# Copyright (c) 2018-2022, Alexey Dynda
44
#
55
# Permission is hereby granted, free of charge, to any person obtaining a copy
66
# of this software and associated documentation files (the "Software"), to deal
@@ -44,6 +44,7 @@ OBJS += v2/utf8.o \
4444
v2/lcd/lcd_common.o \
4545
v2/lcd/lcdany/lcd_any.o \
4646
v2/lcd/lcdwio/lcd_wio.o \
47+
v2/lcd/lcdttgo/lcd_ttgo.o \
4748
v2/lcd/pcd8544/lcd_pcd8544.o \
4849
v2/lcd/sh1106/lcd_sh1106.o \
4950
v2/lcd/sh1107/lcd_sh1107.o \

src/lcdgfx.h

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
#include "v2/lcd/lcdany/lcd_any.h"
3838
#include "v2/lcd/lcdwio/lcd_wio.h"
39+
#include "v2/lcd/lcdttgo/lcd_ttgo.h"
3940
#include "v2/lcd/pcd8544/lcd_pcd8544.h"
4041
#include "v2/lcd/sh1106/lcd_sh1106.h"
4142
#include "v2/lcd/sh1107/lcd_sh1107.h"

src/v2/lcd/lcdttgo/lcd_ttgo.cpp

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
MIT License
3+
4+
Copyright (c) 2022, Alexey Dynda
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.
23+
*/
24+
25+
#if defined(__XTENSA__) || defined(__linux__)
26+
27+
#include "lcd_ttgo.h"
28+
29+
DisplayTTGO_135x240x16::DisplayTTGO_135x240x16()
30+
: DisplayST7789_135x240x16_SPI(23, {-1, 5, 16, 0, 18, 19})
31+
{
32+
}
33+
34+
#endif
35+
36+
/**
37+
* @}
38+
*/

src/v2/lcd/lcdttgo/lcd_ttgo.h

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
MIT License
3+
4+
Copyright (c) 2022, Alexey Dynda
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.
23+
*/
24+
/**
25+
* @file lcd_wio.h support for LCD ILI9341 display installed in wio terminal console
26+
*/
27+
28+
#pragma once
29+
30+
#if defined(__XTENSA__) || defined(__linux__)
31+
32+
#include "lcd_hal/io.h"
33+
#include "v2/lcd/st7789/lcd_st7789.h"
34+
35+
/**
36+
* @ingroup LCD_INTERFACE_API_V2
37+
* @{
38+
*/
39+
40+
/**
41+
* Class implements TTGO T-Display 135x240x16 lcd display in 16 bit mode over SPI
42+
*/
43+
class DisplayTTGO_135x240x16: public DisplayST7789_135x240x16_SPI
44+
{
45+
public:
46+
DisplayTTGO_135x240x16();
47+
};
48+
49+
#endif
50+
51+
/**
52+
* @}
53+
*/

0 commit comments

Comments
 (0)