import board
import displayio
import terminalio
import busio
from adafruit_display_text import label
from adafruit_bitmap_font import bitmap_font
import adafruit_displayio_ssd1306
import time
# setup screen
def setup_screen():
global DISPLAY_WIDTH
bigfont = bitmap_font.load_font("CompactaBdHUNormal-50.bdf")
this = displayio.Group()
screen_title = label.Label(terminalio.FONT, text="DUMMY", color=0xFFFFFF, x=3, y=6)
this.append(screen_title)
screen_main = label.Label(bigfont, text="888", color=0xFFFFFF, x=3, y=17)
this.append(screen_main)
screen_indicator_labels = displayio.Group(x=60, y=6)
this.append(screen_indicator_labels)
screen_indicator_BPM_label = label.Label(terminalio.FONT, text="CLK IN", color=0xFFFFFF, x=0, y=0)
screen_indicator_labels.append(screen_indicator_BPM_label)
screen_indicator_DIV_label = label.Label(terminalio.FONT, text="CLKDIV", color=0xFFFFFF, x=0, y=10)
screen_indicator_labels.append(screen_indicator_DIV_label)
screen_indicator_LFO1_label = label.Label(terminalio.FONT, text=" LFO1", color=0xFFFFFF, x=0, y=20)
screen_indicator_labels.append(screen_indicator_LFO1_label)
screen_indicator_LFO2_label = label.Label(terminalio.FONT, text=" LFO2", color=0xFFFFFF, x=0, y=30)
screen_indicator_labels.append(screen_indicator_LFO2_label)
screen_indicator_CONV_label = label.Label(terminalio.FONT, text=" CONV", color=0xFFFFFF, x=0, y=40)
screen_indicator_labels.append(screen_indicator_CONV_label)
screen_indicator_XXX_label = label.Label(terminalio.FONT, text=" XXX", color=0xFFFFFF, x=0, y=50)
screen_indicator_labels.append(screen_indicator_XXX_label)
screen_indicators = displayio.Group(x=100, y=6)
this.append(screen_indicators)
screen_indicator_BPM = label.Label(terminalio.FONT, text="888", color=0xFFFFFF, x=0, y=0)
screen_indicators.append(screen_indicator_BPM)
screen_indicator_DIV = label.Label(terminalio.FONT, text="*1", color=0xFFFFFF, x=0, y=10)
screen_indicators.append(screen_indicator_DIV)
screen_indicator_LFO1 = label.Label(terminalio.FONT, text="888", color=0xFFFFFF, x=0, y=20)
screen_indicators.append(screen_indicator_LFO1)
screen_indicator_LFO2 = label.Label(terminalio.FONT, text="888", color=0xFFFFFF, x=0, y=30)
screen_indicators.append(screen_indicator_LFO2)
screen_indicator_CONV = label.Label(terminalio.FONT, text="888", color=0xFFFFFF, x=0, y=40)
screen_indicators.append(screen_indicator_CONV)
return this
def main():
# setup for STEMMA OLED
displayio.release_displays()
# Use for I2C
i2c = busio.I2C(scl=board.GP21, sda=board.GP20)
display_bus = displayio.I2CDisplay(i2c, device_address=0x3C)
global DISPLAY_WIDTH
DISPLAY_WIDTH = 128
DISPLAY_HEIGHT = 64
BORDER = 5
display = adafruit_displayio_ssd1306.SSD1306(display_bus, width=DISPLAY_WIDTH, height=DISPLAY_HEIGHT)
# create the displayio screen
screen = setup_screen()
display.show(screen)
display.refresh()
while True:
time.sleep(1)
main()