Skip to content

Commit 953458c

Browse files
committed
feature: Support st7735 driver
Signed-off-by: lbuque <1102390310@qq.com>
1 parent c6ba495 commit 953458c

File tree

19 files changed

+765
-31
lines changed

19 files changed

+765
-31
lines changed
Loading
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
from machine import Pin, SPI
2+
import time
3+
import lcd
4+
5+
6+
# waveshare
7+
# cmd(int) args(bytes) delay(ms)
8+
init_waveshare = (
9+
(0x11, b'', 120),
10+
(0x21, b'', 0),
11+
(0xB1, b'\x05\x3A\x3A', 0),
12+
(0xB2, b'\x05\x3A\x3A', 0),
13+
(0xB3, b'\x05\x3A\x3A\x05\x3A\x3A', 0),
14+
(0xB4, b'\x03', 0),
15+
(0xC0, b'\x62\x02\x04', 0),
16+
(0xC1, b'\xC0', 0),
17+
(0xC2, b'\x0D\x00', 0),
18+
(0xC3, b'\x8D\x6A', 0),
19+
(0xC4, b'\x8D\xEE', 0),
20+
(0xC5, b'\x0E', 0),
21+
(0xE0, b'\x10\x0E\x02\x03\x0E\x07\x02\x07\x0A\x12\x27\x37\x00\x0D\x0E\x10', 0),
22+
(0xE1, b'\x10\x0E\x03\x03\x0F\x06\x02\x08\x0A\x13\x26\x36\x00\x0D\x0E\x10', 0),
23+
(0x3A, b'\x05', 0),
24+
(0x36, b'\xA8', 0),
25+
(0x29, b'', 0)
26+
)
27+
28+
29+
# tft_espi 1
30+
# cmd(int) args(bytes) delay(ms)
31+
init_tft_espi_1 = (
32+
(0x11, b'', 500),
33+
(0xB1, b'\x01\x2C\x2D', 0),
34+
(0xB2, b'\x01\x2C\x2D', 0),
35+
(0xB3, b'\x01\x2C\x2D\x01\x2C\x2D', 0),
36+
(0xB4, b'\x07', 0),
37+
(0xC0, b'\xA2\x02\x84', 0),
38+
(0xC1, b'\xC5', 0),
39+
(0xC2, b'\x0A\x00', 0),
40+
(0xC3, b'\x8A\x2A', 0),
41+
(0xC4, b'\x8A\xEE', 0),
42+
(0xC5, b'\x0E', 0),
43+
(0x20, b'', 0),
44+
(0x36, b'\xC8', 0),
45+
(0x3A, b'\x05', 0),
46+
(0x2A, b'\x00\x02\x00\x81', 0),
47+
(0x2B, b'\x00\x01\x00\xA0', 0),
48+
(0xE0, b'\x02\x1c\x07\x12\x37\x32\x29\x2d\x29\x25\x2B\x39\x00\x01\x03\x10', 0),
49+
(0xE1, b'\x03\x1d\x07\x06\x2E\x2C\x29\x2D\x2E\x2E\x37\x3F\x00\x00\x02\x10', 0),
50+
(0x13, b'', 100),
51+
(0x29, b'', 100)
52+
)
53+
54+
# tft_espi 2
55+
# cmd(int) args(bytes) delay(ms)
56+
init_tft_espi_2 = (
57+
(0x11, b'', 500),
58+
(0xB1, b'\x01\x2C\x2D', 0),
59+
(0xB2, b'\x01\x2C\x2D', 0),
60+
(0xB3, b'\x01\x2C\x2D\x01\x2C\x2D', 0),
61+
(0xB4, b'\x07', 0),
62+
(0xC0, b'\xA2\x02\x84', 0),
63+
(0xC1, b'\xC5', 0),
64+
(0xC2, b'\x0A\x00', 0),
65+
(0xC3, b'\x8A\x2A', 0),
66+
(0xC4, b'\x8A\xEE', 0),
67+
(0xC5, b'\x0E', 0),
68+
(0x20, b'', 0),
69+
(0x36, b'\xC8', 0),
70+
(0x3A, b'\x05', 0),
71+
(0x2A, b'\x00\x02\x00\x81', 0),
72+
(0x2B, b'\x00\x01\x00\xA0', 0),
73+
(0xE0, b'\x02\x1c\x07\x12\x37\x32\x29\x2d\x29\x25\x2B\x39\x00\x01\x03\x10', 0),
74+
(0xE1, b'\x03\x1d\x07\x06\x2E\x2C\x29\x2D\x2E\x2E\x37\x3F\x00\x00\x02\x10', 0),
75+
(0x13, b'', 100),
76+
(0x29, b'', 100)
77+
)
78+
79+
def config():
80+
hspi = SPI(2, sck=Pin(18), mosi=Pin(19), miso=None)
81+
panel = lcd.SPIPanel(spi=hspi, command=Pin(23), cs=Pin(5), pclk=60000000, width=80, height=160)
82+
st = lcd.ST7735(panel, reset=Pin(26), backlight=Pin(27))
83+
st.backlight_on()
84+
st.reset()
85+
st.custom_init(init_tft_espi_2)
86+
st.invert_color(True)
87+
st.rotation(3)
88+
return st
File renamed without changes.

lcd/rgb_panel.c renamed to lcd/bus/dpi/rgb_panel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "rgb_panel.h"
22

33
#if USE_ESP_LCD
4-
#include "hal/esp32.h"
4+
#include "esp32.h"
55
#endif
66

77
#include "py/obj.h"
File renamed without changes.

lcd/i80_panel.c renamed to lcd/bus/i80/i80_panel.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
#include "lcd_panel.h"
33

44
#if USE_ESP_LCD
5-
#include "hal/esp32.h"
5+
#include "hal/esp32/esp32.h"
66
#else
7-
#include "hal/soft8080.h"
7+
#include "hal/commom/soft8080.h"
88
#endif
99

1010
#include "mphalport.h"
File renamed without changes.

lcd/spi_panel.c renamed to lcd/bus/spi/spi_panel.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#include "spi_panel.h"
22
#include "lcd_panel.h"
33

4+
45
#if USE_ESP_LCD
5-
#include "hal/esp32.h"
6+
#include "hal/esp32/esp32.h"
67
#else
7-
#include "hal/soft8080.h"
8+
#include "hal/commom/soft8080.h"
89
#endif
910

1011
#include "mphalport.h"
File renamed without changes.

0 commit comments

Comments
 (0)