Skip to content

Commit e959eb6

Browse files
committed
Add ST7789 PIO driver to example boot.py
1 parent 9e3ec32 commit e959eb6

File tree

1 file changed

+31
-14
lines changed

1 file changed

+31
-14
lines changed

examples/boot.py

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,38 @@
1111

1212
# Initialize display, if available
1313
try:
14-
# Import a display driver module. This example assumes the ST7789, which is
15-
# a very popular display driver for embedded systems. Moreover, this example
16-
# uses an SPI-based driver, so it should work on any platform, but it's not
17-
# always the fastest option
18-
from cv2_drivers.displays import st7789_spi
14+
# Import a display driver module. Multiple options are provided below, so
15+
# you can choose the one that best fits your needs. You may need to adjust
16+
# the parameters based on your specific display and board configuration
17+
import cv2_drivers.displays as displays
1918

20-
# Create a display object. This will depend on the display driver you are
21-
# using, and you may need to adjust the parameters based on your specific
22-
# display and board configuration
23-
display = st7789_spi.ST7789_SPI(width=240,
24-
height=320,
25-
spi=spi,
26-
pin_dc=16,
27-
pin_cs=17,
28-
rotation=1)
19+
############################################################################
20+
# ST7789 - A very popular display for embedded systems
21+
############################################################################
22+
23+
# SPI interface. This should work on any platform, but it's not always the
24+
# fastest option (24Mbps on RP2350)
25+
display = displays.st7789_spi.ST7789_SPI(
26+
width=240,
27+
height=320,
28+
spi=spi,
29+
pin_dc=16,
30+
pin_cs=17,
31+
rotation=1
32+
)
33+
34+
# PIO interface. This is only available on Raspberry Pi RP2 processors,
35+
# and is much faster than the SPI interface (up to 75Mbps on RP2350)
36+
# display = displays.st7789_pio.ST7789_PIO(
37+
# width=240,
38+
# height=320,
39+
# sm_id=1,
40+
# pin_clk=18,
41+
# pin_tx=19,
42+
# pin_dc=16,
43+
# pin_cs=17,
44+
# rotation=1
45+
# )
2946
except ImportError:
3047
print("boot.py - Display driver module not found, skipping display initialization.")
3148

0 commit comments

Comments
 (0)