Skip to content

DJDevon3/CircuitPython_ST7796S

Repository files navigation

Introduction

DiscordBuild StatusCode Style: Black

displayio driver for ST7796S TFT LCD displays

Dependencies

This driver depends on:

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle or individual libraries can be installed using circup.

Usage Example

importboardimportdisplayioimportterminaliofromadafruit_display_textimportlabelfromcircuitpython_st7796simportST7796S# Support both 8.x.x and 9.x.x. Change when 8.x.x is discontinued as a stable release.try: fromfourwireimportFourWireexceptImportError: fromdisplayioimportFourWirespi=board.SPI() # 4.0" ST7796S Displaydisplayio.release_displays() DISPLAY_WIDTH=480DISPLAY_HEIGHT=320DISPLAY_ROTATION=180tft_cs=board.D9tft_dc=board.D10tft_rst=board.D17ts_cs=board.D6spi=board.SPI() display_bus=FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=tft_rst) display=ST7796S( display_bus, width=DISPLAY_WIDTH, height=DISPLAY_HEIGHT, rotation=DISPLAY_ROTATION ) # Quick Colors for LabelsTEXT_BLACK=0x000000TEXT_BLUE=0x0000FFTEXT_CYAN=0x00FFFFTEXT_GRAY=0x8B8B8BTEXT_GREEN=0x00FF00TEXT_LIGHTBLUE=0x90C7FFTEXT_MAGENTA=0xFF00FFTEXT_ORANGE=0xFFA500TEXT_PURPLE=0x800080TEXT_RED=0xFF0000TEXT_WHITE=0xFFFFFFTEXT_YELLOW=0xFFFF00# Label Customizationshello_label=label.Label(terminalio.FONT) hello_label.anchor_point= (0.5, 1.0) hello_label.anchored_position= (DISPLAY_WIDTH/2, DISPLAY_HEIGHT/2) hello_label.scale=3hello_label.color=TEXT_WHITE# Create Display Groupstext_group=displayio.Group() text_group.append(hello_label) display.root_group=text_groupwhileTrue: hello_label.text="HELLO WORLD!"

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

Documentation

For information on building library documentation, please check out this guide.

About

CircuitPython displayio driver for ST7796 TFT LCD displays

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages