|
13 | 13 | import board
|
14 | 14 | import busio
|
15 | 15 | import displayio
|
16 |
| -import digitalio |
17 | 16 | import terminalio
|
18 | 17 | import adafruit_ssd1680
|
19 | 18 |
|
|
29 | 28 | epd_busy = board.EPD_BUSY
|
30 | 29 |
|
31 | 30 | display_bus = displayio.FourWire(
|
32 |
| - spi, |
33 |
| - command=epd_dc, |
34 |
| - chip_select=epd_cs, |
35 |
| - reset=epd_reset, |
36 |
| - baudrate=1000000 |
| 31 | + spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000 |
37 | 32 | )
|
38 | 33 | display = adafruit_ssd1680.SSD1680(
|
39 |
| - display_bus, |
40 |
| - colstart=8, |
41 |
| - width=250, |
42 |
| - height=122, |
43 |
| - busy_pin=epd_busy, |
44 |
| - highlight_color=0xFFFFFF, |
45 |
| - rotation=270, |
46 |
| - seconds_per_frame=10 |
| 34 | + display_bus, |
| 35 | + colstart=8, |
| 36 | + width=250, |
| 37 | + height=122, |
| 38 | + busy_pin=epd_busy, |
| 39 | + highlight_color=0xFFFFFF, |
| 40 | + rotation=270, |
| 41 | + seconds_per_frame=10, |
47 | 42 | )
|
48 | 43 |
|
49 | 44 | # Make the display context
|
|
52 | 47 |
|
53 | 48 | palette = displayio.Palette(2)
|
54 | 49 | palette[0] = 0x000000
|
55 |
| -palette[1] = 0xffffff |
| 50 | +palette[1] = 0xFFFFFF |
56 | 51 |
|
57 |
| -zero_glyph = terminalio.FONT.get_glyph(ord('0')) |
| 52 | +zero_glyph = terminalio.FONT.get_glyph(ord("0")) |
58 | 53 |
|
59 | 54 | padding = max(zero_glyph.height, zero_glyph.width) + 1
|
60 |
| -label = displayio.TileGrid(terminalio.FONT.bitmap, pixel_shader=palette, tile_width=zero_glyph.width, tile_height=zero_glyph.height) |
| 55 | +label = displayio.TileGrid( |
| 56 | + terminalio.FONT.bitmap, |
| 57 | + pixel_shader=palette, |
| 58 | + tile_width=zero_glyph.width, |
| 59 | + tile_height=zero_glyph.height, |
| 60 | +) |
61 | 61 | main_group.append(label)
|
62 | 62 |
|
63 | 63 | # Number each of the 4 corners
|
64 | 64 | i = 0
|
65 | 65 | while True:
|
66 | 66 | if i % 2 == 0:
|
67 |
| - label.x = padding |
| 67 | + label.x = padding |
68 | 68 | else:
|
69 |
| - label.x = display.width - padding - zero_glyph.width |
| 69 | + label.x = display.width - padding - zero_glyph.width |
70 | 70 | if (i % 4) // 2 == 0:
|
71 |
| - label.y = padding |
| 71 | + label.y = padding |
72 | 72 | else:
|
73 |
| - label.y = display.height - padding - zero_glyph.height |
| 73 | + label.y = display.height - padding - zero_glyph.height |
74 | 74 |
|
75 | 75 | label[0] = zero_glyph.tile_index + i
|
76 | 76 |
|
|
0 commit comments