Skip to content

replace depreciated .show() & displayio changes #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ Usage Example

import board
import displayio
# Starting in CircuitPython 9.x fourwire will be a seperate internal library
# rather than a component of the displayio library
try:
from fourwire import FourWire
except ImportError:
from displayio import FourWire

from adafruit_st7789 import ST7789

displayio.release_displays()
Expand All @@ -48,13 +55,13 @@ Usage Example
tft_cs = board.D5
tft_dc = board.D6

display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=board.D9)
display_bus = FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=board.D9)

display = ST7789(display_bus, width=240, height=240, rowstart=80)

# Make the display context
splash = displayio.Group()
display.show(splash)
display.root_group = splash

color_bitmap = displayio.Bitmap(240, 240, 1)
color_palette = displayio.Palette(1)
Expand Down
13 changes: 10 additions & 3 deletions adafruit_st7789.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@

"""

import displayio
# Starting in CircuitPython 9.x fourwire will be a seperate internal library
# rather than a component of the displayio library
try:
from fourwire import FourWire
from busdisplay import BusDisplay
except ImportError:
from displayio import FourWire
from displayio import Display as BusDisplay

__version__ = "0.0.0+auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_ST7789.git"
Expand All @@ -58,8 +65,8 @@


# pylint: disable=too-few-public-methods
class ST7789(displayio.Display):
class ST7789(BusDisplay):
"""ST7789 driver"""

def __init__(self, bus: displayio.FourWire, **kwargs) -> None:
def __init__(self, bus: FourWire, **kwargs) -> None:
super().__init__(bus, _INIT_SEQUENCE, **kwargs)
11 changes: 9 additions & 2 deletions examples/st7789_170x320_1.9_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
import board
import terminalio
import displayio

# Starting in CircuitPython 9.x fourwire will be a seperate internal library
# rather than a component of the displayio library
try:
from fourwire import FourWire
except ImportError:
from displayio import FourWire
from adafruit_display_text import label
from adafruit_st7789 import ST7789

Expand All @@ -22,13 +29,13 @@
tft_dc = board.D6
tft_rst = board.D9

display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=tft_rst)
display_bus = FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=tft_rst)

display = ST7789(display_bus, width=320, height=170, colstart=35, rotation=90)

# Make the display context
splash = displayio.Group()
display.show(splash)
display.root_group = splash

color_bitmap = displayio.Bitmap(display.width, display.height, 1)
color_palette = displayio.Palette(1)
Expand Down
11 changes: 9 additions & 2 deletions examples/st7789_172x320_1.47_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
import board
import terminalio
import displayio

# Starting in CircuitPython 9.x fourwire will be a seperate internal library
# rather than a component of the displayio library
try:
from fourwire import FourWire
except ImportError:
from displayio import FourWire
from adafruit_display_text import label
from adafruit_st7789 import ST7789

Expand All @@ -34,13 +41,13 @@
# tft_dc = board.GP6
# tft_rst = board.GP7

display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=tft_rst)
display_bus = FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=tft_rst)

display = ST7789(display_bus, width=320, height=172, colstart=34, rotation=270)

# Make the display context
splash = displayio.Group()
display.show(splash)
display.root_group = splash

color_bitmap = displayio.Bitmap(display.width, display.height, 1)
color_palette = displayio.Palette(1)
Expand Down
11 changes: 9 additions & 2 deletions examples/st7789_240x135_pitft_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
import board
import terminalio
import displayio

# Starting in CircuitPython 9.x fourwire will be a seperate internal library
# rather than a component of the displayio library
try:
from fourwire import FourWire
except ImportError:
from displayio import FourWire
from adafruit_display_text import label
from adafruit_st7789 import ST7789

Expand All @@ -27,14 +34,14 @@
tft_cs = board.CE0
tft_dc = board.D25

display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs)
display_bus = FourWire(spi, command=tft_dc, chip_select=tft_cs)
display = ST7789(
display_bus, rotation=90, width=240, height=135, rowstart=40, colstart=53
)

# Make the display context
splash = displayio.Group()
display.show(splash)
display.root_group = splash

color_bitmap = displayio.Bitmap(display.width, display.height, 1)
color_palette = displayio.Palette(1)
Expand Down
11 changes: 9 additions & 2 deletions examples/st7789_240x135_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
import board
import terminalio
import displayio

# Starting in CircuitPython 9.x fourwire will be a seperate internal library
# rather than a component of the displayio library
try:
from fourwire import FourWire
except ImportError:
from displayio import FourWire
from adafruit_display_text import label
from adafruit_st7789 import ST7789

Expand All @@ -25,14 +32,14 @@
tft_cs = board.D5
tft_dc = board.D6

display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs)
display_bus = FourWire(spi, command=tft_dc, chip_select=tft_cs)
display = ST7789(
display_bus, rotation=270, width=240, height=135, rowstart=40, colstart=53
)

# Make the display context
splash = displayio.Group()
display.show(splash)
display.root_group = splash

color_bitmap = displayio.Bitmap(display.width, display.height, 1)
color_palette = displayio.Palette(1)
Expand Down
11 changes: 9 additions & 2 deletions examples/st7789_240x135_simpletest_Pimoroni_Pico_Display_Pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
import busio
import terminalio
import displayio

# Starting in CircuitPython 9.x fourwire will be a seperate internal library
# rather than a component of the displayio library
try:
from fourwire import FourWire
except ImportError:
from displayio import FourWire
from adafruit_display_text import label
from adafruit_st7789 import ST7789

Expand All @@ -24,14 +31,14 @@
spi_clk = board.GP18
spi = busio.SPI(spi_clk, spi_mosi)

display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs)
display_bus = FourWire(spi, command=tft_dc, chip_select=tft_cs)
display = ST7789(
display_bus, rotation=270, width=240, height=135, rowstart=40, colstart=53
)

# Make the display context
splash = displayio.Group()
display.show(splash)
display.root_group = splash

color_bitmap = displayio.Bitmap(display.width, display.height, 1)
color_palette = displayio.Palette(1)
Expand Down
11 changes: 9 additions & 2 deletions examples/st7789_240x240_bonnet_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
import board
import terminalio
import displayio

# Starting in CircuitPython 9.x fourwire will be a seperate internal library
# rather than a component of the displayio library
try:
from fourwire import FourWire
except ImportError:
from displayio import FourWire
from adafruit_display_text import label
from adafruit_st7789 import ST7789

Expand All @@ -21,7 +28,7 @@
tft_dc = board.D25
tft_lite = board.D26

display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs)
display_bus = FourWire(spi, command=tft_dc, chip_select=tft_cs)

display = ST7789(
display_bus,
Expand All @@ -34,7 +41,7 @@

# Make the display context
splash = displayio.Group()
display.show(splash)
display.root_group = splash

color_bitmap = displayio.Bitmap(240, 240, 1)
color_palette = displayio.Palette(1)
Expand Down
11 changes: 9 additions & 2 deletions examples/st7789_240x240_pitft_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
import board
import terminalio
import displayio

# Starting in CircuitPython 9.x fourwire will be a seperate internal library
# rather than a component of the displayio library
try:
from fourwire import FourWire
except ImportError:
from displayio import FourWire
from adafruit_display_text import label
from adafruit_st7789 import ST7789

Expand All @@ -20,13 +27,13 @@
tft_cs = board.CE0
tft_dc = board.D25

display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs)
display_bus = FourWire(spi, command=tft_dc, chip_select=tft_cs)

display = ST7789(display_bus, width=240, height=240, rowstart=80, rotation=180)

# Make the display context
splash = displayio.Group()
display.show(splash)
display.root_group = splash

color_bitmap = displayio.Bitmap(240, 240, 1)
color_palette = displayio.Palette(1)
Expand Down
11 changes: 9 additions & 2 deletions examples/st7789_240x240_simpletest_Pimoroni_Pico_Explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
import busio
import terminalio
import displayio

# Starting in CircuitPython 9.x fourwire will be a seperate internal library
# rather than a component of the displayio library
try:
from fourwire import FourWire
except ImportError:
from displayio import FourWire
from adafruit_display_text import label
from adafruit_st7789 import ST7789

Expand All @@ -21,13 +28,13 @@
spi_clk = board.GP18
spi = busio.SPI(spi_clk, spi_mosi)

display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs)
display_bus = FourWire(spi, command=tft_dc, chip_select=tft_cs)

display = ST7789(display_bus, width=240, height=240, rowstart=80, rotation=180)

# Make the display context
splash = displayio.Group()
display.show(splash)
display.root_group = splash

color_bitmap = displayio.Bitmap(240, 240, 1)
color_palette = displayio.Palette(1)
Expand Down
11 changes: 9 additions & 2 deletions examples/st7789_240x240_simpletest_Waveshare_PicoLCD_1_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
import busio
import terminalio
import displayio

# Starting in CircuitPython 9.x fourwire will be a seperate internal library
# rather than a component of the displayio library
try:
from fourwire import FourWire
except ImportError:
from displayio import FourWire
from adafruit_display_text import label
from adafruit_st7789 import ST7789

Expand All @@ -23,7 +30,7 @@
backlight = board.GP13
spi = busio.SPI(spi_clk, spi_mosi)

display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=tft_rst)
display_bus = FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=tft_rst)

display = ST7789(
display_bus,
Expand All @@ -36,7 +43,7 @@

# Make the display context
splash = displayio.Group()
display.show(splash)
display.root_group = splash

color_bitmap = displayio.Bitmap(240, 240, 1)
color_palette = displayio.Palette(1)
Expand Down
13 changes: 9 additions & 4 deletions examples/st7789_280x240_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
import board
import terminalio
import displayio

# Starting in CircuitPython 9.x fourwire will be a seperate internal library
# rather than a component of the displayio library
try:
from fourwire import FourWire
except ImportError:
from displayio import FourWire
from adafruit_display_text import label
from adafruit_st7789 import ST7789

Expand All @@ -18,15 +25,13 @@
tft_cs = board.D5
tft_dc = board.D6

display_bus = displayio.FourWire(
spi, command=tft_dc, chip_select=tft_cs, reset=board.D9
)
display_bus = FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=board.D9)

display = ST7789(display_bus, width=280, height=240, rowstart=20, rotation=90)

# Make the display context
splash = displayio.Group()
display.show(splash)
display.root_group = splash

color_bitmap = displayio.Bitmap(280, 240, 1)
color_palette = displayio.Palette(1)
Expand Down
13 changes: 9 additions & 4 deletions examples/st7789_320x240_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
import board
import terminalio
import displayio

# Starting in CircuitPython 9.x fourwire will be a seperate internal library
# rather than a component of the displayio library
try:
from fourwire import FourWire
except ImportError:
from displayio import FourWire
from adafruit_display_text import label
from adafruit_st7789 import ST7789

Expand All @@ -18,15 +25,13 @@
tft_cs = board.D5
tft_dc = board.D6

display_bus = displayio.FourWire(
spi, command=tft_dc, chip_select=tft_cs, reset=board.D9
)
display_bus = FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=board.D9)

display = ST7789(display_bus, width=320, height=240, rotation=90)

# Make the display context
splash = displayio.Group()
display.show(splash)
display.root_group = splash

color_bitmap = displayio.Bitmap(320, 240, 1)
color_palette = displayio.Palette(1)
Expand Down
Loading