-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from makermelissa/master
Added the ST7735 Display Driver
- Loading branch information
Showing
7 changed files
with
94 additions
and
73 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
.. use this format as the module name: "adafruit_foo.foo" | ||
.. automodule:: adafruit_st7735 | ||
:members: | ||
:members: |
This file contains 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 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 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,21 +1,38 @@ | ||
import adafruit_st7735 | ||
""" | ||
This test will initialize the display using displayio | ||
and draw a solid red background | ||
""" | ||
|
||
import board | ||
import busio | ||
import displayio | ||
import time | ||
from adafruit_st7735 import ST7735 | ||
|
||
spi = board.SPI() | ||
tft_cs = board.D5 | ||
tft_dc = board.D6 | ||
|
||
displayio.release_displays() | ||
display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=board.D9) | ||
|
||
display = ST7735(display_bus, width=128, height=128) | ||
|
||
# Make the display context | ||
splash = displayio.Group(max_size=10) | ||
display.show(splash) | ||
|
||
spi = busio.SPI(board.SCL, board.SDA) | ||
bus = displayio.FourWire(spi, chip_select=board.D9, command=board.D7, reset=board.D8) | ||
display = adafruit_st7735.ST7735(bus, width=128, height=128) | ||
color_bitmap = displayio.Bitmap(128, 128, 1) | ||
color_palette = displayio.Palette(1) | ||
color_palette[0] = 0xFF0000 | ||
|
||
s = displayio.Shape(10, 10) | ||
p = displayio.Palette(2) | ||
p[1] = 0xff0000 | ||
s = displayio.Sprite(s, pixel_shader=p, position=(0,0)) | ||
everything = displayio.Group(max_size=10) | ||
everything.append(s) | ||
display.show(everything) | ||
try: | ||
bg_sprite = displayio.TileGrid(color_bitmap, | ||
pixel_shader=color_palette, | ||
position=(0, 0)) | ||
except TypeError: | ||
bg_sprite = displayio.TileGrid(color_bitmap, | ||
pixel_shader=color_palette, | ||
x=0, y=0) | ||
splash.append(bg_sprite) | ||
|
||
time.sleep(10) | ||
while True: | ||
pass |