Skip to content

Change direct write code for Feather to add correct offset #2474

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 2 commits into from
Apr 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions CircuitPython_gifio/Feather/code-multi-feather-direct.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: MIT
#
# Play Multiple GIF files on a n ESP32-S2 Feather TFT
# Play Multiple GIF files on an ESP32-S2 Feather TFT
# Requires CircuitPython 8.1.0-beta.1 or later
# Updated 4/4/2023

Expand Down Expand Up @@ -30,10 +30,10 @@ def get_files(base):
button.switch_to_input(pull=digitalio.Pull.UP)

display = board.DISPLAY

# Take over display to drive directly
display.auto_refresh = False
display_bus = display.bus

COL_OFFSET = 40 # The Feather TFT needs to have the display
ROW_OFFSET = 53 # offset by these values for direct writes

files = get_files("/")
for i in range(len(files)):
Expand All @@ -58,9 +58,11 @@ def get_files(base):
print("Button Press, Advance\n")
break
next_delay = odg.next_frame()
display_bus.send(42, struct.pack(">hh", 0, odg.bitmap.width - 1))
display_bus.send(43, struct.pack(">hh", 0, odg.bitmap.height - 1))
display_bus.send(44, odg.bitmap)
display.bus.send(42, struct.pack(">hh", COL_OFFSET,
odg.bitmap.width - 1 + COL_OFFSET))
display.bus.send(43, struct.pack(">hh", ROW_OFFSET,
odg.bitmap.height - 1 + ROW_OFFSET))
display.bus.send(44, odg.bitmap)
# End while
# Clean up memory
odg.deinit()
Expand Down