1- """
2- Simple bitmap test script for 2.7" 264x176 Tri-Color display shield
3- Supported products:
4- * Adafruit 2.7" Tri-Color ePaper Display Shield
5- https://www.adafruit.com/product/4229
6-
7- This program requires the adafruit_il91874 library in /lib
8- for CircuitPython 5.0 and above which has displayio support.
9- """
10-
11- import time
12- import board
13- import displayio
14- import adafruit_il91874
15-
16- # Used to ensure the display is free in CircuitPython
17- displayio .release_displays ()
18-
19- # Define the pins needed for display use on the Metro
20- spi = board .SPI ()
21- epd_cs = board .D10
22- epd_dc = board .D9
23-
24- # Create the displayio connection to the display pins
25- display_bus = displayio .FourWire (spi , command = epd_dc , chip_select = epd_cs ,
26- baudrate = 1000000 )
27- time .sleep (1 ) # Wait a bit
28-
29- # Create the display object - the third color is red (0xff0000)
30- display = adafruit_il91874 .IL91874 (display_bus , width = 264 , height = 176 ,
31- highlight_color = 0xff0000 , rotation = 90 )
32-
33- # Create a display group for our screen objects
34- g = displayio .Group ()
35-
36- # Display a ruler graphic from the root directory of the CIRCUITPY drive
37- f = open ("/display-ruler.bmp" , "rb" )
38-
39- pic = displayio .OnDiskBitmap (f )
40- # Create a Tilegrid with the bitmap and put in the displayio group
41- t = displayio .TileGrid (pic , pixel_shader = displayio .ColorConverter ())
42- g .append (t )
43-
44- # Place the display group on the screen
45- display .show (g )
46-
47- # Refresh the display to have it actually show
48- # NOTE: Do not refresh eInk displays more often than 180 seconds!
49- display .refresh ()
50-
51- time .sleep (180 )
52- while True :
53- pass
1+ """
2+ Simple bitmap test script for 2.7" 264x176 Tri-Color display shield
3+ Supported products:
4+ * Adafruit 2.7" Tri-Color ePaper Display Shield
5+ https://www.adafruit.com/product/4229
6+
7+ This program requires the adafruit_il91874 library in /lib
8+ for CircuitPython 5.0 and above which has displayio support.
9+ """
10+
11+ import time
12+ import board
13+ import displayio
14+ import adafruit_il91874
15+
16+ # Used to ensure the display is free in CircuitPython
17+ displayio .release_displays ()
18+
19+ # Define the pins needed for display use on the Metro
20+ spi = board .SPI ()
21+ epd_cs = board .D10
22+ epd_dc = board .D9
23+
24+ # Create the displayio connection to the display pins
25+ display_bus = displayio .FourWire (spi , command = epd_dc , chip_select = epd_cs ,
26+ baudrate = 1000000 )
27+ time .sleep (1 ) # Wait a bit
28+
29+ # Create the display object - the third color is red (0xff0000)
30+ display = adafruit_il91874 .IL91874 (display_bus , width = 264 , height = 176 ,
31+ highlight_color = 0xff0000 , rotation = 90 )
32+
33+ # Create a display group for our screen objects
34+ g = displayio .Group ()
35+
36+ # Display a ruler graphic from the root directory of the CIRCUITPY drive
37+ f = open ("/display-ruler.bmp" , "rb" )
38+
39+ pic = displayio .OnDiskBitmap (f )
40+ # Create a Tilegrid with the bitmap and put in the displayio group
41+ t = displayio .TileGrid (pic , pixel_shader = displayio .ColorConverter ())
42+ g .append (t )
43+
44+ # Place the display group on the screen
45+ display .show (g )
46+
47+ # Refresh the display to have it actually show
48+ # NOTE: Do not refresh eInk displays more often than 180 seconds!
49+ display .refresh ()
50+
51+ time .sleep (180 )
52+ while True :
53+ pass
0 commit comments