Skip to content

Minor updates for guide #34

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 1 commit into from
Oct 9, 2019
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions examples/rgb_display_pillow_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
BORDER = 20
FONTSIZE = 24

# Configuration for CS and DC pins (these are FeatherWing defaults on M0/M4):
# Configuration for CS and DC pins (these are PiTFT defaults):
cs_pin = digitalio.DigitalInOut(board.CE0)
dc_pin = digitalio.DigitalInOut(board.D25)
reset_pin = digitalio.DigitalInOut(board.D24)

# Config for display baudrate (default max is 24mhz):
BAUDRATE = 24000000
BAUDRATE = 64000000

# Setup SPI bus using hardware SPI:
spi = board.SPI()
Expand Down
2 changes: 1 addition & 1 deletion examples/rgb_display_pillow_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from PIL import Image, ImageDraw
import adafruit_rgb_display.ili9341 as ili9341

# Configuration for CS and DC pins (these are FeatherWing defaults on M0/M4):
# Configuration for CS and DC pins (these are PiTFT defaults):
cs_pin = digitalio.DigitalInOut(board.CE0)
dc_pin = digitalio.DigitalInOut(board.D25)
reset_pin = digitalio.DigitalInOut(board.D24)
Expand Down
16 changes: 5 additions & 11 deletions examples/rgb_display_pillow_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
from PIL import Image, ImageDraw, ImageFont
import adafruit_rgb_display.ili9341 as ili9341

# Configuration for CS and DC pins (these are FeatherWing defaults on M0/M4):
# Configuration for CS and DC pins (these are PiTFT defaults):
cs_pin = digitalio.DigitalInOut(board.CE0)
dc_pin = digitalio.DigitalInOut(board.D25)
reset_pin = digitalio.DigitalInOut(board.D24)

# Config for display baudrate (default max is 24mhz):
BAUDRATE = 24000000
BAUDRATE = 64000000

# Setup SPI bus using hardware SPI:
spi = board.SPI()
Expand All @@ -33,17 +33,11 @@
draw.rectangle((0, 0, width, height), outline=0, fill=(0, 0, 0))
disp.image(image, rotation)

# Draw some shapes.
# First define some constants to allow easy resizing of shapes.
# First define some constants to allow easy positioning of text.
padding = -2
top = padding
bottom = height-padding

# Move left to right keeping track of the current x position for drawing shapes.
x = 0


# Alternatively load a TTF font. Make sure the .ttf font file is in the
# Load a TTF font. Make sure the .ttf font file is in the
# same directory as the python script!
# Some other nice fonts to try: http://www.dafont.com/bitmap.php
font = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf', 24)
Expand All @@ -66,7 +60,7 @@
Temp = subprocess.check_output(cmd, shell=True).decode("utf-8")

# Write four lines of text.
y = top
y = padding
draw.text((x, y), IP, font=font, fill="#FFFFFF")
y += font.getsize(IP)[1]
draw.text((x, y), CPU, font=font, fill="#FFFF00")
Expand Down