Skip to content

Commit ae389c1

Browse files
committed
adding 2.4" featherwing
1 parent 10e9e68 commit ae389c1

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# The MIT License (MIT)
2+
#
3+
# Copyright (c) 2019 Melissa LeBlanc-Williams, Foamyguy for Adafruit Industries LLC
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in
13+
# all copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
# THE SOFTWARE.
22+
"""
23+
`adafruit_featherwing.tft_featherwing_24`
24+
====================================================
25+
26+
Helper for using the `TFT FeatherWing 2.4"`
27+
<https://www.adafruit.com/product/3315>`_.
28+
29+
* Author(s): Melissa LeBlanc-Williams, Foamyguy
30+
31+
Requires:
32+
* adafruit_ili9341
33+
* adafruit_stmpe610
34+
"""
35+
36+
__version__ = "0.0.0-auto.0"
37+
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_FeatherWing.git"
38+
39+
import board
40+
import digitalio
41+
import displayio
42+
import adafruit_ili9341
43+
from adafruit_stmpe610 import Adafruit_STMPE610_SPI
44+
import sdcardio
45+
import storage
46+
47+
48+
class TFTFeatherWing24:
49+
"""Class representing an `TFT FeatherWing 2.4
50+
<https://www.adafruit.com/product/3315>`_.
51+
52+
"""
53+
54+
def __init__(self, i2c=None, spi=None, cs=None, dc=None):
55+
displayio.release_displays()
56+
if i2c is None:
57+
i2c = board.I2C()
58+
if spi is None:
59+
spi = board.SPI()
60+
if cs is None:
61+
cs = board.D9
62+
if dc is None:
63+
dc = board.D10
64+
65+
ts_cs = digitalio.DigitalInOut(board.D6)
66+
self.touchscreen = Adafruit_STMPE610_SPI(spi, ts_cs)
67+
68+
display_bus = displayio.FourWire(
69+
spi, command=dc, chip_select=cs
70+
)
71+
self.display = adafruit_ili9341.ILI9341(display_bus, width=320, height=240)
72+
73+
sd_cs = board.D5
74+
self._sdcard = None
75+
try:
76+
self._sdcard = sdcardio.SDCard(spi, sd_cs)
77+
vfs = storage.VfsFat(self._sdcard)
78+
storage.mount(vfs, "/sd")
79+
except OSError as error:
80+
print("No SD card found:", error)

0 commit comments

Comments
 (0)