Skip to content
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

Displayio api 9x #2755

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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
3 changes: 2 additions & 1 deletion 4x4_MIDI_Messenger/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from rainbowio import colorwheel
import keypad
import displayio
import i2cdisplaybus
import busio
import adafruit_seesaw.seesaw
import adafruit_seesaw.neopixel
Expand Down Expand Up @@ -50,7 +51,7 @@

i2c = board.STEMMA_I2C()
# STEMMA OLED setup
display_bus = displayio.I2CDisplay(i2c, device_address=0x3D, reset=oled_reset)
display_bus = i2cdisplaybus.I2CDisplayBus(i2c, device_address=0x3D, reset=oled_reset)
display = adafruit_displayio_ssd1306.SSD1306(display_bus, width=128, height=64)

splash = displayio.Group()
Expand Down
3 changes: 2 additions & 1 deletion AHT20_OLED/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

# OLED
import displayio
import i2cdisplaybus
import terminalio
from adafruit_display_text import label
import adafruit_displayio_ssd1306
Expand All @@ -25,7 +26,7 @@


#OLED
display_bus = displayio.I2CDisplay(i2c, device_address=0x3C)
display_bus = i2cdisplaybus.I2CDisplayBus(i2c, device_address=0x3C)
display = adafruit_displayio_ssd1306.SSD1306(display_bus, width=128, height=32)

# Make the display context
Expand Down
3 changes: 2 additions & 1 deletion CAN_Bus_BFF/CircuitPython/can_bus_bff_receiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import board
import terminalio
import displayio
import i2cdisplaybus
from digitalio import DigitalInOut
from adafruit_mcp2515.canio import Message, RemoteTransmissionRequest
from adafruit_mcp2515 import MCP2515 as CAN
Expand All @@ -15,7 +16,7 @@

i2c = board.STEMMA_I2C()
# STEMMA OLED setup
display_bus = displayio.I2CDisplay(i2c, device_address=0x3D, reset=None)
display_bus = i2cdisplaybus.I2CDisplayBus(i2c, device_address=0x3D, reset=None)
display = adafruit_displayio_ssd1306.SSD1306(display_bus, width=128, height=64)

cs = DigitalInOut(board.A3)
Expand Down
8 changes: 5 additions & 3 deletions CircuitPython_ESP32_Camera/esp32-kaluga-onionskin-gif/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@
import board
import busio
import bitmaptools
import fourwire
import displayio
import busdisplay
import sdcardio
import storage
import gifio
Expand All @@ -68,7 +70,7 @@ def record_pressed():

displayio.release_displays()
spi = busio.SPI(MOSI=board.LCD_MOSI, clock=board.LCD_CLK)
display_bus = displayio.FourWire(
display_bus = fourwire.FourWire(
spi,
command=board.LCD_D_C,
chip_select=board.LCD_CS,
Expand Down Expand Up @@ -101,7 +103,7 @@ def record_pressed():
b"\x29\x80\x78" # Display on then delay 0x78 (120ms)
)

display = displayio.Display(display_bus, _INIT_SEQUENCE, width=320, height=240)
display = busdisplay.BusDisplay(display_bus, _INIT_SEQUENCE, width=320, height=240)

sd_spi = busio.SPI(clock=board.IO18, MOSI=board.IO14, MISO=board.IO17)
sd_cs = board.IO12
Expand Down Expand Up @@ -193,7 +195,7 @@ def take_stop_motion_gif(n_frames=10, replay_frame_time=.3):
writer.add_frame(frame, replay_frame_time)
for i in range(1, n_frames):
print(f"{i}/{n_frames}")
old_frame.blit(0, 0, frame, x1=0, y1=0, x2=cam.width, y2=cam.height)
bitmaptools.blit(old_frame, frame, 0, 0, x1=0, y1=0, x2=cam.width, y2=cam.height)
frame = wait_record_pressed_update_display(False, cam)
writer.add_frame(frame, replay_frame_time)
print("done")
Expand Down
3 changes: 2 additions & 1 deletion CircuitPython_Flying_Toasters/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from random import seed, randint
import board
import displayio
import fourwire
from adafruit_st7789 import ST7789
import adafruit_imageload

Expand Down Expand Up @@ -63,7 +64,7 @@ def make_display():
spi.configure(baudrate=24000000) # Configure SPI for 24MHz
spi.unlock()
displayio.release_displays()
display_bus = displayio.FourWire(spi, command=board.D7, chip_select=board.D10, reset=board.D9)
display_bus = fourwire.FourWire(spi, command=board.D7, chip_select=board.D10, reset=board.D9)

return ST7789(display_bus, width=240, height=240, rowstart=80, auto_refresh=True)

Expand Down
3 changes: 2 additions & 1 deletion CircuitPython_GetSuperpower_PicoW_OpenAI/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import board
import displayio
import i2cdisplaybus
import digitalio
import keypad
import socketpool
Expand Down Expand Up @@ -75,7 +76,7 @@

# STEMMA I2C on picowbell
i2c = board.STEMMA_I2C()
display_bus = displayio.I2CDisplay(i2c, device_address=0x3D, reset=oled_reset)
display_bus = i2cdisplaybus.I2CDisplayBus(i2c, device_address=0x3D, reset=oled_reset)

WIDTH = 128
HEIGHT = 64
Expand Down
3 changes: 2 additions & 1 deletion CircuitPython_KeyPad_Calculator/code/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import board
import displayio
import i2cdisplaybus
import keypad
import adafruit_displayio_sh1107
from adafruit_hid.keyboard import Keyboard
Expand Down Expand Up @@ -57,7 +58,7 @@ def lookup(layer, key_number):
# Use for I2C
i2c = board.I2C() # uses board.SCL and board.SDA
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
display_bus = displayio.I2CDisplay(i2c, device_address=0x3C)
display_bus = i2cdisplaybus.I2CDisplayBus(i2c, device_address=0x3C)

# SH1107 is vertically oriented 64x128
WIDTH = 128
Expand Down
3 changes: 2 additions & 1 deletion CircuitPython_Knob_Sketcher/feather_sketcher/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import time
import board
import displayio
import fourwire
import digitalio
import analogio
import adafruit_ili9341
Expand Down Expand Up @@ -55,7 +56,7 @@
tft_cs = board.D9
tft_dc = board.D10
tft_rst = board.D6
display_bus = displayio.FourWire(
display_bus = fourwire.FourWire(
spi, command=tft_dc, chip_select=tft_cs, reset=tft_rst
)
display = adafruit_ili9341.ILI9341(display_bus, width=DISPLAY_WIDTH, height=DISPLAY_HEIGHT)
Expand Down
3 changes: 2 additions & 1 deletion CircuitPython_OLED_Watch/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import board
import displayio
import i2cdisplaybus
import adafruit_displayio_ssd1306
import terminalio
import adafruit_ds3231
Expand All @@ -17,7 +18,7 @@

i2c = board.I2C() # uses board.SCL and board.SDA
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
display_bus = displayio.I2CDisplay(i2c, device_address=0x3c)
display_bus = i2cdisplaybus.I2CDisplayBus(i2c, device_address=0x3c)
oled = adafruit_displayio_ssd1306.SSD1306(display_bus, width=128, height=32)

rtc = adafruit_ds3231.DS3231(i2c)
Expand Down
3 changes: 2 additions & 1 deletion CircuitPython_Scrolling_Clouds/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from random import seed, randint
import board
import displayio
import fourwire
from adafruit_st7789 import ST7789
import adafruit_imageload

Expand Down Expand Up @@ -54,7 +55,7 @@ def make_display():
spi.unlock()

displayio.release_displays()
display_bus = displayio.FourWire(spi, command=board.D7, chip_select=board.D10, reset=board.D9)
display_bus = fourwire.FourWire(spi, command=board.D7, chip_select=board.D10, reset=board.D9)

return ST7789(display_bus, width=240, height=240, rowstart=80, auto_refresh=True)

Expand Down
3 changes: 2 additions & 1 deletion CircuitPython_Sip_and_Puff/puff_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from adafruit_display_text import label
from displayio import Group
import displayio
import i2cdisplaybus
import adafruit_displayio_ssd1306
import adafruit_lps35hw

Expand Down Expand Up @@ -94,7 +95,7 @@ def _init_stuff(self):
displayio.release_displays()
i2c = board.I2C()

display_bus = displayio.I2CDisplay(i2c, device_address=0x3D)
display_bus = i2cdisplaybus.I2CDisplayBus(i2c, device_address=0x3D)
self.display = adafruit_displayio_ssd1306.SSD1306(
display_bus, width=DISPLAY_WIDTH, height=DISPLAY_HEIGHT
)
Expand Down
3 changes: 2 additions & 1 deletion CircuitPython_displayio/displayio_display_driver/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import board
import displayio
import fourwire
import adafruit_ili9341

# Release any previously configured displays
Expand All @@ -17,7 +18,7 @@
tft_dc = board.D9

# Setup the display bus
display_bus = displayio.FourWire(spi_bus, command=tft_dc, chip_select=tft_cs)
display_bus = fourwire.FourWire(spi_bus, command=tft_dc, chip_select=tft_cs)

# Setup the Display
display = adafruit_ili9341.ILI9341(display_bus, width=320, height=240)
Expand Down
6 changes: 4 additions & 2 deletions CircuitPython_displayio/displayio_display_manual/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

import board
import displayio
import busdisplay
import fourwire

# Release any previously configured displays
displayio.release_displays()
Expand All @@ -16,7 +18,7 @@
tft_dc = board.D9

# Setup the display bus
display_bus = displayio.FourWire(spi_bus, command=tft_dc, chip_select=tft_cs)
display_bus = fourwire.FourWire(spi_bus, command=tft_dc, chip_select=tft_cs)

# Setup the initialization sequence
# stolen from adafruit_ili9341.py
Expand Down Expand Up @@ -47,7 +49,7 @@
)

# Setup the Display
display = displayio.Display(display_bus, INIT_SEQUENCE, width=320, height=240)
display = busdisplay.BusDisplay(display_bus, INIT_SEQUENCE, width=320, height=240)

#
# DONE - now you can use the display however you want
Expand Down
6 changes: 4 additions & 2 deletions CircuitPython_displayio/displayio_parallelbus/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@

import board
import displayio
import busdisplay
import paralleldisplaybus

# Release any previously configured displays
displayio.release_displays()

# Setup the display bus
# Tested with a Metro M4 Express
display_bus = displayio.ParallelBus(data0=board.D13,
display_bus = paralleldisplaybus.ParallelBus(data0=board.D13,
command=board.D6,
chip_select=board.D7,
write=board.D5,
Expand Down Expand Up @@ -45,7 +47,7 @@
)

# Setup the Display
display = displayio.Display(display_bus, INIT_SEQUENCE, width=320, height=240)
display = busdisplay.BusDisplay(display_bus, INIT_SEQUENCE, width=320, height=240)

#
# DONE - now you can use the display however you want
Expand Down
3 changes: 2 additions & 1 deletion CircuitPython_qrio/adafruit_io/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import board
import busio
import displayio
import fourwire
import qrio
import socketpool
import wifi
Expand All @@ -30,7 +31,7 @@
print("Initializing display")
displayio.release_displays()
spi = busio.SPI(MOSI=board.LCD_MOSI, clock=board.LCD_CLK)
display_bus = displayio.FourWire(
display_bus = fourwire.FourWire(
spi, command=board.LCD_D_C, chip_select=board.LCD_CS, reset=board.LCD_RST
)
display = ILI9341(display_bus, width=320, height=240, rotation=90)
Expand Down
3 changes: 2 additions & 1 deletion CircuitPython_qrio/repl/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import board
import busio
import displayio
import fourwire
import qrio
import adafruit_ov2640
from adafruit_display_text.bitmap_label import Label
Expand All @@ -20,7 +21,7 @@
print("Initializing display")
displayio.release_displays()
spi = busio.SPI(MOSI=board.LCD_MOSI, clock=board.LCD_CLK)
display_bus = displayio.FourWire(
display_bus = fourwire.FourWire(
spi, command=board.LCD_D_C, chip_select=board.LCD_CS, reset=board.LCD_RST
)
display = ILI9341(display_bus, width=320, height=240, rotation=90)
Expand Down
3 changes: 2 additions & 1 deletion CircuitPython_qrio/usb_hid/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import board
import busio
import displayio
import fourwire
import qrio
import adafruit_ov2640
from adafruit_display_text.bitmap_label import Label
Expand All @@ -24,7 +25,7 @@
print("Initializing display")
displayio.release_displays()
spi = busio.SPI(MOSI=board.LCD_MOSI, clock=board.LCD_CLK)
display_bus = displayio.FourWire(
display_bus = fourwire.FourWire(
spi, command=board.LCD_D_C, chip_select=board.LCD_CS, reset=board.LCD_RST
)
display = ILI9341(display_bus, width=320, height=240, rotation=90)
Expand Down
3 changes: 2 additions & 1 deletion Circuit_Playground_O_Phonor/notes_tft/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import busio
import audiobusio
import displayio
import fourwire
from adafruit_st7789 import ST7789
from adafruit_bitmap_font import bitmap_font
from adafruit_display_text import label
Expand Down Expand Up @@ -46,7 +47,7 @@
tft_dc = board.TX
tft_backlight = board.A3

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

display = ST7789(display_bus, width=240, height=240, rowstart=80,
backlight_pin=tft_backlight, rotation=180)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import time
import board
import displayio
import fourwire
import adafruit_il0373
import terminalio
from adafruit_display_text import label
Expand All @@ -43,7 +44,7 @@
epd_busy = board.D6

# Create the displayio connection to the display pins
display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs,
display_bus = fourwire.FourWire(spi, command=epd_dc, chip_select=epd_cs,
reset=epd_reset, baudrate=1000000)
time.sleep(1) # Wait a bit

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import time
import board
import displayio
import fourwire
import adafruit_il0373
import terminalio
from adafruit_display_text import label
Expand All @@ -44,7 +45,7 @@
epd_busy = board.D6

# Create the displayio connection to the display pins
display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs,
display_bus = fourwire.FourWire(spi, command=epd_dc, chip_select=epd_cs,
reset=epd_reset, baudrate=1000000)
time.sleep(1) # Wait a bit

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import time
import board
import displayio
import fourwire
import adafruit_il91874
import terminalio
from adafruit_display_text import label
Expand All @@ -39,7 +40,7 @@
epd_dc = board.D9

# Create the displayio connection to the display pins
display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs,
display_bus = fourwire.FourWire(spi, command=epd_dc, chip_select=epd_cs,
baudrate=1000000)
time.sleep(1) # Wait a bit

Expand Down
Loading