-
Notifications
You must be signed in to change notification settings - Fork 20
File changes for PyPI and examples for Pi #18
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
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
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,68 @@ | ||
""" | ||
This test will initialize the display using displayio and draw a solid green | ||
background, a smaller purple rectangle, and some yellow text. | ||
|
||
Pinouts are for the 1.14" Mini PiTFT and should be run in CPython. | ||
""" | ||
import board | ||
import terminalio | ||
import displayio | ||
from adafruit_display_text import label | ||
from adafruit_st7789 import ST7789 | ||
|
||
# First set some parameters used for shapes and text | ||
BORDER = 20 | ||
FONTSCALE = 2 | ||
BACKGROUND_COLOR = 0x00FF00 # Bright Green | ||
FOREGROUND_COLOR = 0xAA0088 # Purple | ||
TEXT_COLOR = 0xFFFF00 | ||
|
||
# Release any resources currently in use for the displays | ||
displayio.release_displays() | ||
|
||
spi = board.SPI() | ||
tft_cs = board.CE0 | ||
tft_dc = board.D25 | ||
|
||
display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs) | ||
display = ST7789( | ||
display_bus, rotation=90, width=240, height=135, rowstart=40, colstart=53 | ||
) | ||
|
||
# Make the display context | ||
splash = displayio.Group(max_size=10) | ||
display.show(splash) | ||
|
||
color_bitmap = displayio.Bitmap(display.width, display.height, 1) | ||
color_palette = displayio.Palette(1) | ||
color_palette[0] = BACKGROUND_COLOR | ||
|
||
bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0) | ||
splash.append(bg_sprite) | ||
|
||
# Draw a smaller inner rectangle | ||
inner_bitmap = displayio.Bitmap( | ||
display.width - BORDER * 2, display.height - BORDER * 2, 1 | ||
) | ||
inner_palette = displayio.Palette(1) | ||
inner_palette[0] = FOREGROUND_COLOR | ||
inner_sprite = displayio.TileGrid( | ||
inner_bitmap, pixel_shader=inner_palette, x=BORDER, y=BORDER | ||
) | ||
splash.append(inner_sprite) | ||
|
||
# Draw a label | ||
text = "Hello World!" | ||
text_area = label.Label(terminalio.FONT, text=text, color=TEXT_COLOR) | ||
text_width = text_area.bounding_box[2] * FONTSCALE | ||
text_group = displayio.Group( | ||
max_size=10, | ||
scale=FONTSCALE, | ||
x=display.width // 2 - text_width // 2, | ||
y=display.height // 2, | ||
) | ||
text_group.append(text_area) # Subgroup for text scaling | ||
splash.append(text_group) | ||
|
||
while True: | ||
pass |
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,58 @@ | ||
""" | ||
This test will initialize the display using displayio and draw a solid green | ||
background, a smaller purple rectangle, and some yellow text. | ||
|
||
Pinouts are for the 1.3" TFT Bonnet and should be run in CPython. | ||
""" | ||
import board | ||
import terminalio | ||
import displayio | ||
from adafruit_display_text import label | ||
from adafruit_st7789 import ST7789 | ||
|
||
# Release any resources currently in use for the displays | ||
displayio.release_displays() | ||
|
||
spi = board.SPI() | ||
tft_cs = board.CE0 | ||
tft_dc = board.D25 | ||
tft_lite = board.D26 | ||
|
||
display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs) | ||
|
||
display = ST7789( | ||
display_bus, | ||
width=240, | ||
height=240, | ||
rowstart=80, | ||
rotation=180, | ||
backlight_pin=tft_lite, | ||
) | ||
|
||
# Make the display context | ||
splash = displayio.Group(max_size=10) | ||
display.show(splash) | ||
|
||
color_bitmap = displayio.Bitmap(240, 240, 1) | ||
color_palette = displayio.Palette(1) | ||
color_palette[0] = 0x00FF00 # Bright Green | ||
|
||
bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0) | ||
splash.append(bg_sprite) | ||
|
||
# Draw a smaller inner rectangle | ||
inner_bitmap = displayio.Bitmap(200, 200, 1) | ||
inner_palette = displayio.Palette(1) | ||
inner_palette[0] = 0xAA0088 # Purple | ||
inner_sprite = displayio.TileGrid(inner_bitmap, pixel_shader=inner_palette, x=20, y=20) | ||
splash.append(inner_sprite) | ||
|
||
# Draw a label | ||
text_group = displayio.Group(max_size=10, scale=2, x=50, y=120) | ||
text = "Hello World!" | ||
text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00) | ||
text_group.append(text_area) # Subgroup for text scaling | ||
splash.append(text_group) | ||
|
||
while True: | ||
pass |
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,50 @@ | ||
""" | ||
This test will initialize the display using displayio and draw a solid green | ||
background, a smaller purple rectangle, and some yellow text. | ||
|
||
Pinouts are for the 1.3" PiTFT and should be run in CPython. | ||
""" | ||
import board | ||
import terminalio | ||
import displayio | ||
from adafruit_display_text import label | ||
from adafruit_st7789 import ST7789 | ||
|
||
# Release any resources currently in use for the displays | ||
displayio.release_displays() | ||
|
||
spi = board.SPI() | ||
tft_cs = board.CE0 | ||
tft_dc = board.D25 | ||
|
||
display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs) | ||
|
||
display = ST7789(display_bus, width=240, height=240, rowstart=80, rotation=180) | ||
|
||
# Make the display context | ||
splash = displayio.Group(max_size=10) | ||
display.show(splash) | ||
|
||
color_bitmap = displayio.Bitmap(240, 240, 1) | ||
color_palette = displayio.Palette(1) | ||
color_palette[0] = 0x00FF00 # Bright Green | ||
|
||
bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0) | ||
splash.append(bg_sprite) | ||
|
||
# Draw a smaller inner rectangle | ||
inner_bitmap = displayio.Bitmap(200, 200, 1) | ||
inner_palette = displayio.Palette(1) | ||
inner_palette[0] = 0xAA0088 # Purple | ||
inner_sprite = displayio.TileGrid(inner_bitmap, pixel_shader=inner_palette, x=20, y=20) | ||
splash.append(inner_sprite) | ||
|
||
# Draw a label | ||
text_group = displayio.Group(max_size=10, scale=2, x=50, y=120) | ||
text = "Hello World!" | ||
text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00) | ||
text_group.append(text_area) # Subgroup for text scaling | ||
splash.append(text_group) | ||
|
||
while True: | ||
pass |
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
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,2 +1,2 @@ | ||
Adafruit-Blinka | ||
|
||
adafruit-blinka-displayio |
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,50 @@ | ||
"""A setuptools based setup module. | ||
See: | ||
https://packaging.python.org/en/latest/distributing.html | ||
https://github.com/pypa/sampleproject | ||
""" | ||
|
||
from setuptools import setup, find_packages | ||
|
||
# To use a consistent encoding | ||
from codecs import open | ||
from os import path | ||
|
||
here = path.abspath(path.dirname(__file__)) | ||
|
||
# Get the long description from the README file | ||
with open(path.join(here, "README.rst"), encoding="utf-8") as f: | ||
long_description = f.read() | ||
|
||
setup( | ||
name="adafruit-circuitpython-st7789", | ||
use_scm_version=True, | ||
setup_requires=["setuptools_scm"], | ||
description="displayio driver for ST7789 TFT-LCD displays.", | ||
long_description=long_description, | ||
long_description_content_type="text/x-rst", | ||
# The project's main homepage. | ||
url="https://github.com/adafruit/Adafruit_CircuitPython_ST7789", | ||
# Author details | ||
author="Adafruit Industries", | ||
author_email="circuitpython@adafruit.com", | ||
install_requires=["Adafruit-Blinka", "adafruit-blinka-displayio",], | ||
# Choose your license | ||
license="MIT", | ||
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers | ||
classifiers=[ | ||
"Development Status :: 3 - Alpha", | ||
"Intended Audience :: Developers", | ||
"Topic :: Software Development :: Libraries", | ||
"Topic :: System :: Hardware", | ||
"License :: OSI Approved :: MIT License", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.4", | ||
"Programming Language :: Python :: 3.5", | ||
], | ||
# What does your project relate to? | ||
keywords="adafruit blinka circuitpython micropython st7789 display tft lcd displayio", | ||
# You can just specify the packages manually here if your project is | ||
# simple. Or you can use find_packages(). | ||
py_modules=["adafruit_st7789"], | ||
) |
This file was deleted.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.