-
Notifications
You must be signed in to change notification settings - Fork 4
Added tri-color support #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,19 @@ | ||
Simple test | ||
------------ | ||
|
||
Ensure your device works with this simple test. | ||
Ensure your device works with this simple test. This simple test is for the 2.9" Flexible Monochrome display. | ||
|
||
.. literalinclude:: ../examples/uc8151d_simpletest.py | ||
:caption: examples/uc8151d_simpletest.py | ||
:linenos: | ||
|
||
Device Specific Examples | ||
------------------------ | ||
|
||
.. literalinclude:: ../examples/uc8151d_1.54_grayscale.py | ||
:caption: examples/uc8151d_1.54_grayscale.py | ||
:linenos: | ||
|
||
.. literalinclude:: ../examples/uc8151d_2.9_color.py | ||
:caption: examples/uc8151d_2.9_color.py | ||
:linenos: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries | ||
# SPDX-License-Identifier: MIT | ||
|
||
"""Simple test script for Adafruit 2.9" 296x128 tri-color display | ||
Supported products: | ||
* Adafruit 2.9" Tri-Color Display Breakout | ||
* https://www.adafruit.com/product/1028 | ||
""" | ||
|
||
import time | ||
import board | ||
import displayio | ||
import adafruit_uc8151d | ||
|
||
# Used to ensure the display is free in CircuitPython | ||
displayio.release_displays() | ||
|
||
# Define the pins needed for display use | ||
# This pinout is for a Feather M4 and may be different for other boards | ||
spi = board.SPI() # Uses SCK and MOSI | ||
epd_cs = board.D9 | ||
epd_dc = board.D10 | ||
epd_reset = board.D5 | ||
epd_busy = board.D6 | ||
|
||
# Create the displayio connection to the display pins | ||
display_bus = displayio.FourWire( | ||
spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000 | ||
) | ||
time.sleep(1) # Wait a bit | ||
|
||
# Create the display object - the third color is red (0xff0000) | ||
display = adafruit_uc8151d.UC8151D( | ||
display_bus, | ||
width=296, | ||
height=128, | ||
rotation=270, | ||
busy_pin=epd_busy, | ||
highlight_color=0xFF0000, | ||
) | ||
|
||
# Create a display group for our screen objects | ||
g = displayio.Group() | ||
|
||
# Display a ruler graphic from the root directory of the CIRCUITPY drive | ||
with open("/display-ruler.bmp", "rb") as f: | ||
pic = displayio.OnDiskBitmap(f) | ||
# Create a Tilegrid with the bitmap and put in the displayio group | ||
# 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) | ||
|
||
# Place the display group on the screen | ||
display.show(g) | ||
|
||
# Refresh the display to have it actually show the image | ||
# NOTE: Do not refresh eInk displays sooner than 180 seconds | ||
display.refresh() | ||
print("refreshed") | ||
|
||
time.sleep(180) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@makermelissa is it OK to wait 200ms for both the b/w and the tri-color LCD?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's been this way for quite a while. I really only updated the comment to match the actual value. The additional delay is probably because CP is a little slower than Arduino. Either way it works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the values are the same between the color and b/w displays in Arduino (10ms in that case).