generated from jtobinart/Temp
-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
I've written a little Adapter class for the 2 USB Version. Not sure if you accept PRs at this point
# CYD2 Library
# Tags: Micropython Cheap Yellow Device DIYmall ESP32-2432S028R CYD2USB
# Last Updated: May 03, 2025
# Author(s): Yamavu
# License: MIT
"""python/
This is a simple adapter for CYD for use with the 2-USB (USB-C and Micro USB) version
of the Cheap Yellow Display. It uses horizontal alignment for now.
ORiginal
https://github.com/jtobinart/MicroPython_CYD_ESP32-2432S028R
"""
from ili9341 import Display, color565
from xpt2046 import Touch
from cydr import CYD
class CYD2(CYD):
def __init__(self, rgb_pmw=False, speaker_gain=512, display_width=240, display_height=320, wifi_ssid=None, wifi_password=None):
super().__init__(rgb_pmw, speaker_gain, display_width, display_height, wifi_ssid, wifi_password)
self.YELLOW = color565(255, 255, 0)
self.display = Display(
spi=self.display.spi,
cs=self.display.cs,
dc=self.display.dc,
rst=self.display.rst,
width=self.display.height,
height=self.display.width,
rotation=0,
bgr=False
)
self._touch = Touch(
spi = self._touch.spi,
cs = self._touch.cs,
int_pin = self._touch.int_pin,
int_handler = self._touch_handler)
def _touch_handler(self, x, y):
'''
Interrupt Handler
This function is called each time the screen is touched.
'''
# x and y needs to be rotated
self._x = y
self._y = x
print("Touch:", self._x, self._y)
Metadata
Metadata
Assignees
Labels
No labels