Skip to content

Commit 2cec797

Browse files
authored
Merge pull request #25 from DJDevon3/local
TFT Featherwing Code & BMP Examples
2 parents 4320046 + 28b5144 commit 2cec797

5 files changed

+42
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# SPDX-FileCopyrightText: 2022 DJDevon3 for Adafruit Industries
2+
# SPDX-License-Identifier: MIT
3+
"""Screenshot on a 3.5" TFT Featherwing (integrated SD Card)"""
4+
# pylint:disable=invalid-name
5+
import board
6+
import digitalio
7+
import displayio
8+
import adafruit_sdcard
9+
import storage
10+
from adafruit_hx8357 import HX8357
11+
from adafruit_bitmapsaver import save_pixels
12+
13+
displayio.release_displays()
14+
15+
# 3.5" TFT Featherwing is 480x320 pixels
16+
DISPLAY_WIDTH = 480
17+
DISPLAY_HEIGHT = 320
18+
19+
# Initialize Protocol Busses and SD Card
20+
spi = board.SPI()
21+
cs = digitalio.DigitalInOut(board.D5)
22+
sdcard = adafruit_sdcard.SDCard(spi, cs)
23+
vfs = storage.VfsFat(sdcard)
24+
displayio.release_displays()
25+
26+
# Setup Pinouts according to your feather board
27+
tft_cs = board.D9
28+
tft_dc = board.D10
29+
display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs)
30+
display = HX8357(display_bus, width=DISPLAY_WIDTH, height=DISPLAY_HEIGHT)
31+
32+
# Mount Virtual File System
33+
virtual_root = "/sd"
34+
storage.mount(vfs, virtual_root)
35+
36+
print("Taking Screenshot... ")
37+
save_pixels("/sd/screenshot.bmp", display)
38+
print("Screenshot taken")

guide/tft_featherwing_screenshot1.bmp

450 KB
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# SPDX-FileCopyrightText: 2022 DJDevon3 for Adafruit Industries
2+
# SPDX-License-Identifier: MIT

guide/tft_featherwing_screenshot2.bmp

450 KB
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# SPDX-FileCopyrightText: 2022 DJDevon3 for Adafruit Industries
2+
# SPDX-License-Identifier: MIT

0 commit comments

Comments
 (0)