|
| 1 | +# SPDX-FileCopyrightText: 2026 Mikey Sklar, written for Adafruit Industries |
| 2 | +# |
| 3 | +# SPDX-License-Identifier: Unlicense |
| 4 | + |
| 5 | +"""4-gray grayscale example for the Adafruit 2.66" 296x152 E-Ink Display (#6392). |
| 6 | +
|
| 7 | +Displays a 4-level gray ramp (white / light gray / dark gray / black) across the |
| 8 | +full panel. Uses the FPC7519 waveform LUT, which transfers cleanly to this panel. |
| 9 | +
|
| 10 | +Tested on Adafruit Feather RP2040 ThinkInk with a panel labeled FPC-A003 1S on |
| 11 | +the ribbon connector. |
| 12 | +
|
| 13 | +Hardware: connect the 24-pin FPC ribbon directly to the ThinkInk board's ZIF connector. |
| 14 | +No external wiring required. |
| 15 | +""" |
| 16 | + |
| 17 | +import time |
| 18 | + |
| 19 | +import board |
| 20 | +import busio |
| 21 | +import displayio |
| 22 | +from fourwire import FourWire |
| 23 | + |
| 24 | +import adafruit_ssd1680 |
| 25 | + |
| 26 | +displayio.release_displays() |
| 27 | + |
| 28 | +spi = busio.SPI(board.EPD_SCK, board.EPD_MOSI) |
| 29 | +display_bus = FourWire( |
| 30 | + spi, |
| 31 | + command=board.EPD_DC, |
| 32 | + chip_select=board.EPD_CS, |
| 33 | + reset=board.EPD_RESET, |
| 34 | + baudrate=1000000, |
| 35 | +) |
| 36 | +time.sleep(1) |
| 37 | + |
| 38 | +display = adafruit_ssd1680.SSD1680( |
| 39 | + display_bus, |
| 40 | + width=296, |
| 41 | + height=152, |
| 42 | + busy_pin=board.EPD_BUSY, |
| 43 | + rotation=270, |
| 44 | + colstart=0, |
| 45 | + vcom=0x1C, |
| 46 | + vsh2=0xAE, |
| 47 | + custom_lut=adafruit_ssd1680.FPC7519_LUT, |
| 48 | + grayscale=True, |
| 49 | +) |
| 50 | + |
| 51 | +W, H = 296, 152 |
| 52 | +bmp = displayio.Bitmap(W, H, 4) |
| 53 | +pal = displayio.Palette(4) |
| 54 | +pal[0] = 0xFFFFFF # white |
| 55 | +pal[1] = 0xAAAAAA # light gray |
| 56 | +pal[2] = 0x555555 # dark gray |
| 57 | +pal[3] = 0x000000 # black |
| 58 | + |
| 59 | +COL = W // 4 |
| 60 | +for y in range(H): |
| 61 | + for x in range(W): |
| 62 | + bmp[x, y] = x // COL |
| 63 | + |
| 64 | +g = displayio.Group() |
| 65 | +g.append(displayio.TileGrid(bmp, pixel_shader=pal)) |
| 66 | +display.root_group = g |
| 67 | + |
| 68 | +print("Refreshing...") |
| 69 | +display.refresh() |
| 70 | +print("Done.") |
| 71 | + |
| 72 | +time.sleep(display.time_to_refresh + 5) |
| 73 | + |
| 74 | +while True: |
| 75 | + time.sleep(10) |
0 commit comments