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