From 2db643ce4fcf546630da5d5a8034477f07e81111 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Mon, 2 Oct 2023 08:26:33 -0700 Subject: [PATCH 1/4] Add an example for the 2.13 inch eink bonnet --- examples/ssd1680_2.13_mono_eink_bonnet.py | 75 +++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 examples/ssd1680_2.13_mono_eink_bonnet.py diff --git a/examples/ssd1680_2.13_mono_eink_bonnet.py b/examples/ssd1680_2.13_mono_eink_bonnet.py new file mode 100644 index 0000000..e6f3cb7 --- /dev/null +++ b/examples/ssd1680_2.13_mono_eink_bonnet.py @@ -0,0 +1,75 @@ +# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries +# SPDX-FileCopyrightText: Copyright (c) 2021 Melissa LeBlanc-Williams for Adafruit Industries +# +# SPDX-License-Identifier: Unlicense + +"""Simple test script for 2.13" 250x122 tri-color display. +Supported products: + * Adafruit 2.13" Tri-Color eInk Display Breakout + * https://www.adafruit.com/product/4947 + * Adafruit 2.13" Tri-Color eInk Display FeatherWing + * https://www.adafruit.com/product/4814 + * Adafruit 2.13" Mono eInk Display FeatherWing + * https://www.adafruit.com/product/4195 + + +""" + +import time +import board +import displayio +import adafruit_ssd1680 + +displayio.release_displays() + +# This pinout works on a Metro M4 and may need to be altered for other boards. +spi = board.SPI() # Uses SCK and MOSI +epd_cs = board.CE0 +epd_dc = board.D22 +epd_reset = board.D27 # Set to None for FeatherWing +epd_busy = board.D17 # Set to None for FeatherWing + +display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000) +time.sleep(1) + +# For issues with display not updating top/bottom rows correctly set colstart to 8 +display = adafruit_ssd1680.SSD1680( + display_bus, + colstart=8, + width=250, + height=122, + busy_pin=epd_busy, + highlight_color=0xFF0000, + rotation=90, +) + + +g = displayio.Group() + +with open("display-ruler.bmp", "rb") as f: + pic = displayio.OnDiskBitmap(f) + # CircuitPython 6 & 7 compatible + t = displayio.TileGrid( + pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter()) + ) + # CircuitPython 7 compatible only + # t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader) + g.append(t) + + display.show(g) + + display.refresh() + + print("refreshed") + + time.sleep(display.time_to_refresh + 5) + # Always refresh a little longer. It's not a problem to refresh + # a few seconds more, but it's terrible to refresh too early + # (the display will throw an exception when if the refresh + # is too soon) + print("waited correct time") + + +# Keep the display the same +while True: + time.sleep(10) From 7b7b2f1e5b3f45254a7303d983e8779344d579ca Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Mon, 2 Oct 2023 08:41:18 -0700 Subject: [PATCH 2/4] Run pre-commit --- examples/ssd1680_2.13_mono_eink_bonnet.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/ssd1680_2.13_mono_eink_bonnet.py b/examples/ssd1680_2.13_mono_eink_bonnet.py index e6f3cb7..502d1ae 100644 --- a/examples/ssd1680_2.13_mono_eink_bonnet.py +++ b/examples/ssd1680_2.13_mono_eink_bonnet.py @@ -29,7 +29,9 @@ epd_reset = board.D27 # Set to None for FeatherWing epd_busy = board.D17 # Set to None for FeatherWing -display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000) +display_bus = displayio.FourWire( + spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000 +) time.sleep(1) # For issues with display not updating top/bottom rows correctly set colstart to 8 From e3f28b48b4a5c4eebd4d8009de2f657afee02d19 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Mon, 2 Oct 2023 09:19:50 -0700 Subject: [PATCH 3/4] Remove obsolete code --- examples/ssd1680_2.13_mono_eink_bonnet.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/examples/ssd1680_2.13_mono_eink_bonnet.py b/examples/ssd1680_2.13_mono_eink_bonnet.py index 502d1ae..0b2203e 100644 --- a/examples/ssd1680_2.13_mono_eink_bonnet.py +++ b/examples/ssd1680_2.13_mono_eink_bonnet.py @@ -50,12 +50,7 @@ with open("display-ruler.bmp", "rb") as f: pic = displayio.OnDiskBitmap(f) - # CircuitPython 6 & 7 compatible - t = displayio.TileGrid( - pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter()) - ) - # CircuitPython 7 compatible only - # t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader) + t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader) g.append(t) display.show(g) From 8e63ed5e691033289f8dad5e73d0a24a04bca8f9 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Mon, 2 Oct 2023 13:53:17 -0700 Subject: [PATCH 4/4] Drop colstart from examples when it matches new default --- examples/ssd1680_2.13_featherwing.py | 1 - examples/ssd1680_2.13_mono_eink_bonnet.py | 1 - examples/ssd1680_2.13_tricolor_breakout.py | 1 - examples/ssd1680_four_corners.py | 1 - examples/ssd1680_simpletest.py | 1 - 5 files changed, 5 deletions(-) diff --git a/examples/ssd1680_2.13_featherwing.py b/examples/ssd1680_2.13_featherwing.py index c194735..c0b0dc9 100644 --- a/examples/ssd1680_2.13_featherwing.py +++ b/examples/ssd1680_2.13_featherwing.py @@ -33,7 +33,6 @@ display = adafruit_ssd1680.SSD1680( display_bus, - colstart=8, width=250, height=122, highlight_color=0xFF0000, diff --git a/examples/ssd1680_2.13_mono_eink_bonnet.py b/examples/ssd1680_2.13_mono_eink_bonnet.py index 0b2203e..be9cd41 100644 --- a/examples/ssd1680_2.13_mono_eink_bonnet.py +++ b/examples/ssd1680_2.13_mono_eink_bonnet.py @@ -37,7 +37,6 @@ # For issues with display not updating top/bottom rows correctly set colstart to 8 display = adafruit_ssd1680.SSD1680( display_bus, - colstart=8, width=250, height=122, busy_pin=epd_busy, diff --git a/examples/ssd1680_2.13_tricolor_breakout.py b/examples/ssd1680_2.13_tricolor_breakout.py index 7f6992d..089fdeb 100644 --- a/examples/ssd1680_2.13_tricolor_breakout.py +++ b/examples/ssd1680_2.13_tricolor_breakout.py @@ -32,7 +32,6 @@ display = adafruit_ssd1680.SSD1680( display_bus, - colstart=8, width=250, height=122, highlight_color=0xFF0000, diff --git a/examples/ssd1680_four_corners.py b/examples/ssd1680_four_corners.py index 28f9a76..007a3c7 100644 --- a/examples/ssd1680_four_corners.py +++ b/examples/ssd1680_four_corners.py @@ -32,7 +32,6 @@ ) display = adafruit_ssd1680.SSD1680( display_bus, - colstart=8, width=250, height=122, busy_pin=epd_busy, diff --git a/examples/ssd1680_simpletest.py b/examples/ssd1680_simpletest.py index a59d230..37b2dd1 100644 --- a/examples/ssd1680_simpletest.py +++ b/examples/ssd1680_simpletest.py @@ -37,7 +37,6 @@ # For issues with display not updating top/bottom rows correctly set colstart to 8 display = adafruit_ssd1680.SSD1680( display_bus, - colstart=8, width=250, height=122, busy_pin=epd_busy,