def __init__(
     self,
     spi: Optional[SPI] = None,
     cs: Optional[Pin] = None,
     dc: Optional[Pin] = None,
     ts_cs: Optional[Pin] = None,
     sd_cs: Optional[Pin] = None,
 ):
     super().__init__(spi, cs, dc, ts_cs, sd_cs)
     self.display = HX8357(self._display_bus, width=480, height=320)
Example #2
0
 def __init__(self, spi=None, cs=None, dc=None, ts_cs=None, sd_cs=None):
     super().__init__(spi, cs, dc, ts_cs, sd_cs)
     self.display = HX8357(self._display_bus, width=480, height=320)
Example #3
0
import board
import terminalio
import displayio
from adafruit_display_text import label
from adafruit_hx8357 import HX8357

# Release any resources currently in use for the displays
displayio.release_displays()

spi = board.SPI()
tft_cs = board.CE0
tft_dc = board.D25

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

display = HX8357(display_bus, width=480, height=320)

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

color_bitmap = displayio.Bitmap(display.width, display.height, 1)
color_palette = displayio.Palette(1)
color_palette[0] = 0x00FF00  # Bright Green

bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0)
splash.append(bg_sprite)

# Draw a smaller inner rectangle
inner_bitmap = displayio.Bitmap(display.width - 40, display.height - 40, 1)
inner_palette = displayio.Palette(1)