il0373_2.13_color.py
1 """Simple test script for Adafruit 2.13" 212x104 tri-color display 2 Supported products: 3 * Adafruit 2.13" Tri-Color Display Breakout 4 * https://www.adafruit.com/product/4086 (breakout) or 5 * https://www.adafruit.com/product/4128 (FeatherWing) 6 """ 7 8 import time 9 import board 10 import displayio 11 import adafruit_il0373 12 13 # Used to ensure the display is free in CircuitPython 14 displayio.release_displays() 15 16 # Define the pins needed for display use 17 # This pinout is for a Feather M4 and may be different for other boards 18 spi = board.SPI() # Uses SCK and MOSI 19 epd_cs = board.D9 20 epd_dc = board.D10 21 epd_reset = board.D5 22 epd_busy = board.D6 23 24 # Create the displayio connection to the display pins 25 display_bus = displayio.FourWire( 26 spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000 27 ) 28 time.sleep(1) # Wait a bit 29 30 # Create the display object - the third color is red (0xff0000) 31 display = adafruit_il0373.IL0373( 32 display_bus, 33 width=212, 34 height=104, 35 rotation=90, 36 busy_pin=epd_busy, 37 highlight_color=0xFF0000, 38 ) 39 40 # Create a display group for our screen objects 41 g = displayio.Group() 42 43 # Display a ruler graphic from the root directory of the CIRCUITPY drive 44 f = open("/display-ruler.bmp", "rb") 45 46 pic = displayio.OnDiskBitmap(f) 47 # Create a Tilegrid with the bitmap and put in the displayio group 48 t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter()) 49 g.append(t) 50 51 # Place the display group on the screen 52 display.show(g) 53 54 # Refresh the display to have it actually show the image 55 # NOTE: Do not refresh eInk displays sooner than 180 seconds 56 display.refresh() 57 print("refreshed") 58 59 time.sleep(180)