Skip to content

Commit ca135db

Browse files
authored
Merge pull request #3 from adafruit/TheKitty-patch-1
Cleanup and comment, reviewed by Ladyada
2 parents 8fc5cae + edeb288 commit ca135db

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

examples/il0373_2.13_color.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,53 @@
1-
"""Simple test script for 2.13" 212x104 tri-color display.
2-
1+
"""Simple test script for Adafruit 2.13" 212x104 tri-color display
32
Supported products:
43
* Adafruit 2.13" Tri-Color Display Breakout
5-
* https://www.adafruit.com/product/4086
6-
"""
4+
* https://www.adafruit.com/product/4086 (breakout) or
5+
* https://www.adafruit.com/product/4128 (FeatherWing)
6+
"""
77

88
import time
99
import board
1010
import displayio
1111
import adafruit_il0373
1212

13+
# Used to ensure the display is free in CircuitPython
1314
displayio.release_displays()
1415

15-
# This pinout works on a Feather M4 and may need to be altered for other boards.
16-
spi = board.SPI() # Uses SCK and MOSI
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
1719
epd_cs = board.D9
1820
epd_dc = board.D10
1921
epd_reset = board.D5
2022
epd_busy = board.D6
2123

22-
display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset,
23-
baudrate=1000000)
24-
time.sleep(1)
24+
# Create the displayio connection to the display pins
25+
display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs,
26+
reset=epd_reset, baudrate=1000000)
27+
time.sleep(1) # Wait a bit
2528

26-
display = adafruit_il0373.IL0373(display_bus, width=212, height=104, rotation=90, busy_pin=epd_busy,
29+
# Create the display object - the third color is red (0xff0000)
30+
display = adafruit_il0373.IL0373(display_bus, width=212, height=104,
31+
rotation=90, busy_pin=epd_busy,
2732
highlight_color=0xff0000)
2833

34+
# Create a display group for our screen objects
2935
g = displayio.Group()
3036

37+
# Display a ruler graphic from the root directory of the CIRCUITPY drive
3138
f = open("/display-ruler.bmp", "rb")
3239

3340
pic = displayio.OnDiskBitmap(f)
41+
# Create a Tilegrid with the bitmap and put in the displayio group
3442
t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())
3543
g.append(t)
3644

45+
# Place the display group on the screen
3746
display.show(g)
3847

48+
# Refresh the display to have it actually show
49+
# NOTE: Do not refresh eInk displays more often than seconds or more!
3950
display.refresh()
40-
4151
print("refreshed")
4252

4353
time.sleep(120)

0 commit comments

Comments
 (0)