init_sequence_tl034wvs05 = bytes(( b'\xff\x05w\x01\x00\x00\x13' b'\xef\x01\x08' b'\xff\x05w\x01\x00\x00\x10' b'\xc0\x02;\x00' b'\xc1\x02\x12\n' b'\xc2\x02\x07\x03' b'\xc3\x01\x02' b'\xcc\x01\x10' b'\xcd\x01\x08' b'\xb0\x10\x0f\x11\x17\x15\x15\t\x0c\x08\x08&\x04Y\x16f-\x1f' b'\xb1\x10\x0f\x11\x17\x15\x15\t\x0c\x08\x08&\x04Y\x16f-\x1f' b'\xff\x05w\x01\x00\x00\x11' b'\xb0\x01m' b'\xb1\x01:' b'\xb2\x01\x01' b'\xb3\x01\x80' b'\xb5\x01I' b'\xb7\x01\x85' b'\xb8\x01 ' b'\xc1\x01x' b'\xc2\x01x' b'\xd0\x01\x88' b'\xe0\x03\x00\x00\x02' b'\xe1\x0b\x07\x00\t\x00\x06\x00\x08\x00\x0033' b'\xe2\r\x11\x1133\xf6\x00\xf6\x00\xf6\x00\xf6\x00\x00' b'\xe3\x04\x00\x00\x11\x11' b'\xe4\x02DD' b'\xe5\x10\x0f\xf3=\xff\x11\xf5=\xff\x0b\xef=\xff\r\xf1=\xff' b'\xe6\x04\x00\x00\x11\x11' b'\xe7\x02DD' b'\xe8\x10\x0e\xf2=\xff\x10\xf4=\xff\n\xee=\xff\x0c\xf0=\xff' b'\xe9\x026\x00' b'\xeb\x07\x00\x01\xe4\xe4D\xaa\x10' b'\xec\x02<\x00' b'\xed\x10\xffEg\xfa\x01+\xcf\xff\xff\xfc\xb2\x10\xafvT\xff' b'\xef\x06\x10\r\x04\x08?\x1f' b'\xff\x05w\x01\x00\x00\x00' b'5\x01\x00' b':\x01f' b'\x11\x80x' b')\x802' ))
tft_timings = { "frequency": 16000000, "width": 480, "height": 480, "hsync_pulse_width": 20, "hsync_front_porch": 40, "hsync_back_porch": 40, "vsync_pulse_width": 10, "vsync_front_porch": 40, "vsync_back_porch": 40, "hsync_idle_low": False, "vsync_idle_low": False, "de_idle_high": False, "pclk_active_high": False, "pclk_idle_high": False, }
from displayio import release_displays release_displays() import displayio import busio import board import dotclockframebuffer from framebufferio import FramebufferDisplay tft_pins = dict(board.TFT_PINS) tft_timings = { "frequency": 16000000, "width": 480, "height": 480, "hsync_pulse_width": 20, "hsync_front_porch": 40, "hsync_back_porch": 40, "vsync_pulse_width": 10, "vsync_front_porch": 40, "vsync_back_porch": 40, "hsync_idle_low": False, "vsync_idle_low": False, "de_idle_high": False, "pclk_active_high": False, "pclk_idle_high": False, } init_sequence_tl034wvs05 = bytes(( b'\xff\x05w\x01\x00\x00\x13' b'\xef\x01\x08' b'\xff\x05w\x01\x00\x00\x10' b'\xc0\x02;\x00' b'\xc1\x02\x12\n' b'\xc2\x02\x07\x03' b'\xc3\x01\x02' b'\xcc\x01\x10' b'\xcd\x01\x08' b'\xb0\x10\x0f\x11\x17\x15\x15\t\x0c\x08\x08&\x04Y\x16f-\x1f' b'\xb1\x10\x0f\x11\x17\x15\x15\t\x0c\x08\x08&\x04Y\x16f-\x1f' b'\xff\x05w\x01\x00\x00\x11' b'\xb0\x01m' b'\xb1\x01:' b'\xb2\x01\x01' b'\xb3\x01\x80' b'\xb5\x01I' b'\xb7\x01\x85' b'\xb8\x01 ' b'\xc1\x01x' b'\xc2\x01x' b'\xd0\x01\x88' b'\xe0\x03\x00\x00\x02' b'\xe1\x0b\x07\x00\t\x00\x06\x00\x08\x00\x0033' b'\xe2\r\x11\x1133\xf6\x00\xf6\x00\xf6\x00\xf6\x00\x00' b'\xe3\x04\x00\x00\x11\x11' b'\xe4\x02DD' b'\xe5\x10\x0f\xf3=\xff\x11\xf5=\xff\x0b\xef=\xff\r\xf1=\xff' b'\xe6\x04\x00\x00\x11\x11' b'\xe7\x02DD' b'\xe8\x10\x0e\xf2=\xff\x10\xf4=\xff\n\xee=\xff\x0c\xf0=\xff' b'\xe9\x026\x00' b'\xeb\x07\x00\x01\xe4\xe4D\xaa\x10' b'\xec\x02<\x00' b'\xed\x10\xffEg\xfa\x01+\xcf\xff\xff\xfc\xb2\x10\xafvT\xff' b'\xef\x06\x10\r\x04\x08?\x1f' b'\xff\x05w\x01\x00\x00\x00' b'5\x01\x00' b':\x01f' b'\x11\x80x' b')\x802' )) board.I2C().deinit() i2c = busio.I2C(board.SCL, board.SDA) tft_io_expander = dict(board.TFT_IO_EXPANDER) #tft_io_expander['i2c_address'] = 0x38 # uncomment for rev B dotclockframebuffer.ioexpander_send_init_sequence(i2c, init_sequence_tl034wvs05, **tft_io_expander) i2c.deinit() bitmap = displayio.OnDiskBitmap("/display-ruler-720p.bmp") fb = dotclockframebuffer.DotClockFramebuffer(**tft_pins, **tft_timings) display = FramebufferDisplay(fb, auto_refresh=False) # Create a TileGrid to hold the bitmap tile_grid = displayio.TileGrid(bitmap, pixel_shader=bitmap.pixel_shader) # Create a Group to hold the TileGrid group = displayio.Group() # Add the TileGrid to the Group group.append(tile_grid) # Add the Group to the Display display.root_group = group display.auto_refresh = True # Loop forever so you can enjoy your image while True: pass
Download the following image into the root folder of of your CIRCUITPY drive:
Go ahead and save the example you your CircuitPython code.py and run the code. Your display should now look like this:
Text editor powered by tinymce.