Open deshipu opened 3 years ago
I'm trying to make the Stage library run on the Meowbit, but in order to do that, I need to re-initialize the display. I'm doing it with this code:
import board import digitalio import gamepad import stage import displayio import busio import time _TFT_INIT = ( b"\x01\x80\x96" # SWRESET and Delay 150ms b"\x11\x80\xff" # SLPOUT and Delay b"\xb1\x03\x01\x2C\x2D" # _FRMCTR1 b"\xb2\x03\x01\x2C\x2D" # _FRMCTR2 b"\xb3\x06\x01\x2C\x2D\x01\x2C\x2D" # _FRMCTR3 b"\xb4\x01\x07" # _INVCTR line inversion b"\xc0\x03\xa2\x02\x84" # _PWCTR1 GVDD = 4.7V, 1.0uA b"\xc1\x01\xc5" # _PWCTR2 VGH=14.7V, VGL=-7.35V b"\xc2\x02\x0a\x00" # _PWCTR3 Opamp current small, Boost frequency b"\xc3\x02\x8a\x2a" b"\xc4\x02\x8a\xee" b"\xc5\x01\x0e" # _VMCTR1 VCOMH = 4V, VOML = -1.1V b"\x20\x00" # _INVOFF b"\x36\x01\xa0" # _MADCTL # 1 clk cycle nonoverlap, 2 cycle gate rise, 3 sycle osc equalie, # fix on VTL b"\x3a\x01\x05" # COLMOD - 16bit color b"\xe0\x10\x02\x1c\x07\x12\x37\x32\x29\x2d\x29\x25\x2B\x39\x00\x01\x03\x10" # _GMCTRP1 Gamma b"\xe1\x10\x03\x1d\x07\x06\x2E\x2C\x29\x2D\x2E\x2E\x37\x3F\x00\x00\x02\x10" # _GMCTRN1 b"\x13\x80\x0a" # _NORON b"\x29\x80\x64" # _DISPON ) displayio.release_displays() _tft_spi = busio.SPI(clock=board.DISP_SCK, MOSI=board.DISP_MOSI) _tft_spi.try_lock() _tft_spi.configure(baudrate=24000000) _tft_spi.unlock() _fourwire = displayio.FourWire(_tft_spi, command=board.DISP_DC, chip_select=board.DISP_CS) _reset = digitalio.DigitalInOut(board.DISP_RST) _reset.switch_to_output(value=0) time.sleep(0.05) _reset.value = 1 time.sleep(0.05) display = displayio.Display(_fourwire, _TFT_INIT, width=160, height=128, rotation=0, backlight_pin=board.TFT_LITE) del _TFT_INIT display.auto_brightness = True
Unfortunately running this results in:
ValueError: DISP_SCK in use
It looks like the pins are not properly released by the release_displays call.
release_displays
I suspect this is a lower level pin reset problem because I believe the release_displays code itself is port-agnostic.
I'm trying to make the Stage library run on the Meowbit, but in order to do that, I need to re-initialize the display. I'm doing it with this code:
Unfortunately running this results in:
It looks like the pins are not properly released by the
release_displays
call.