adafruit_ra8875.ra8875
¶
A Driver Library for the RA8875
Author(s): Melissa LeBlanc-Williams
Implementation Notes¶
Hardware:
RA8875 Driver Board for 40-pin TFT Touch Displays - 800x480: https://www.adafruit.com/product/1590
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
- class adafruit_ra8875.ra8875.RA8875(spi: SPI, cs: DigitalInOut, rst: DigitalInOut | None = None, width: int = 800, height: int = 480, baudrate: int = 6000000, polarity: int = 0, phase: int = 0)¶
Graphics Library Class for the Display. Contains all the hardware accelerated geometry Functions. For full display functionality, use this class. Valid display sizes are currently 800x480 and 480x272.
- curve(x_center: int, y_center: int, h_axis: int, v_axis: int, curve_part: int, color: int) None ¶
Draw a Curve (HW Accelerated) This is basically a quarter of an ellipse.
- Parameters:
x_center (int) – The X coordinate of the focal point of the curve
y_center (int) – The Y coordinate of the focal point of the curve
h_axis (int) – The length of the horizontal axis of the full ellipse
v_axis (int) – The length of the vertical axis of the full ellipse
curve_part (byte) – A number between 0-3 specifying the quarter section
color (int) – The color of the curve
- ellipse(x_center: int, y_center: int, h_axis: int, v_axis: int, color: int) None ¶
Draw an ellipse (HW Accelerated)
- fill(color: int) None ¶
Fill the Entire Screen (HW Accelerated)
- Parameters:
color (int) – The color to Fill the screen
- fill_circle(x_center: int, y_center: int, radius: int, color: int) None ¶
Draw a filled circle (HW Accelerated)
- fill_curve(x_center: int, y_center: int, h_axis: int, v_axis: int, curve_part: int, color: int) None ¶
Draw a Filled Curve (HW Accelerated) This is basically a quarter of an ellipse.
- Parameters:
x_center (int) – The X coordinate of the focal point of the curve
y_center (int) – The Y coordinate of the focal point of the curve
h_axis (int) – The length of the horizontal axis of the full ellipse
v_axis (int) – The length of the vertical axis of the full ellipse
curve_part (byte) – A number between 0-3 specifying the quarter section
color (int) – The color of the curve
- fill_ellipse(x_center: int, y_center: int, h_axis: int, v_axis: int, color: int) None ¶
Draw a Filled Ellipse (HW Accelerated)
- fill_rect(x: int, y: int, width: int, height: int, color: int) None ¶
Draw a filled rectangle (HW Accelerated)
- fill_round_rect(x: int, y: int, width: int, height: int, radius: int, color: int) None ¶
Draw a filled rounded rectangle
- fill_triangle(x1: int, y1: int, x2: int, y2: int, x3: int, y3: int, color: int) None ¶
Draw a Filled Triangle (HW Accelerated)
- Parameters:
x1 (int) – The X coordinate of the first point of the triangle
y1 (int) – The Y coordinate of the first point of the triangle
x2 (int) – The X coordinate of the second point of the triangle
y2 (int) – The Y coordinate of the second point of the triangle
x3 (int) – The X coordinate of the third point of the triangle
y3 (int) – The Y coordinate of the third point of the triangle
color (int) – The color of the triangle
- round_rect(x: int, y: int, width: int, height: int, radius: int, color: int) None ¶
Draw a rounded rectangle
- triangle(x1: int, y1: int, x2: int, y2: int, x3: int, y3: int, color: int) None ¶
Draw a Triangle (HW Accelerated)
- Parameters:
x1 (int) – The X coordinate of the first point of the triangle
y1 (int) – The Y coordinate of the first point of the triangle
x2 (int) – The X coordinate of the second point of the triangle
y2 (int) – The Y coordinate of the second point of the triangle
x3 (int) – The X coordinate of the third point of the triangle
y3 (int) – The Y coordinate of the third point of the triangle
color (int) – The color of the triangle
- class adafruit_ra8875.ra8875.RA8875Display(spi: SPI, cs: DigitalInOut, rst: DigitalInOut | None = None, width: int = 800, height: int = 480, baudrate: int = 6000000, polarity: int = 0, phase: int = 0)¶
Drawing Class for the Display. Contains all the basic drawing functionality as well as the text functions. Valid display sizes are currently 800x480 and 480x272.
- Parameters:
spi (SPI) – The spi peripheral to use
cs (DigitalInOut) – The chip-select pin to use (sometimes labeled “SS”)
rst (DigitalInOut) – (optional) The reset pin if it exists (default=None)
width (int) – (optional) The width of the display in pixels (default=800)
height (int) – (optional) The height of the display in pixels (default=480)
baudrate (int) – (optional) The spi speed (default=6000000)
phase (int) – (optional) The spi phase (default=0)
polarity (int) – (optional) The spi polarity (default=0)
- pixel(x: int, y: int, color: int) None ¶
Draw a pixel at the X and Y coordinates of the specified color
- push_pixels(pixel_data: bytearray) None ¶
Push a stream of pixel data to the screen.
- Parameters:
pixel_data (bytearray) – Raw pixel data to push
- set_bgcolor(color: int) None ¶
Set the text background color
- Parameters:
color (int) – The color behind the text
- set_color(color: int) None ¶
Set the foreground color for graphics/text
- Parameters:
color (int) – The of the text or graphics
- set_window(x: int, y: int, width: int, height: int) None ¶
Set an Active Drawing Window, which can be used in conjuntion with push_pixels for faster drawing
- txt_size(scale: int) None ¶
Set the Text Size (0-3)
- Parameters:
scale (byte) – The the size to scale the Text to
- class adafruit_ra8875.ra8875.RA8875_Device(spi: SPI, cs: DigitalInOut, rst: DigitalInOut | None = None, width: int = 800, height: int = 480, baudrate: int = 6000000, polarity: int = 0, phase: int = 0)¶
Base Class for the Display. Contains all the low level stuff. As well as the touch functions. Valid display sizes are currently 800x480 and 480x272.
- Parameters:
spi (SPI) – The spi peripheral to use
cs (DigitalInOut) – The chip-select pin to use (sometimes labeled “SS”)
rst (DigitalInOut) – (optional) The reset pin if it exists (default=None)
width (int) – (optional) The width of the display in pixels (default=800)
height (int) – (optional) The height of the display in pixels (default=480)
baudrate (int) – (optional) The spi speed (default=6000000)
polarity (int) – (optional) The spi polarity (default=0)
phase (int) – (optional) The spi phase (default=0)
- brightness(level: int)¶
Configure the backlight brightness (0-255)
- Parameters:
level (byte) – The PWM Duty Cycle
- init(start_on: bool = True) None ¶
Send the Init Commands for the selected Display Size
- Parameters:
start_on (bool) – (optional) If the display should start in an On State (default=True)
- sleep(sleep: bool) None ¶
Turn the display off with and set or remove the sleep state
- Parameters:
sleep (bool) – Should we enable sleep mode
- touch_enable(touch_on: bool) None ¶
Enable touch functionality
- Parameters:
touch_on (bool) – Enable/Disable the Touch Functionality
- touch_init(tpin: DigitalInOut | None = None, enable: bool = True) None ¶
Initialize the Touchscreen
- Parameters:
tpin (DigitalInOut) – (Optional) The Touch Screen Interrupt Pin (default=None)
enable (bool) – Enable the Touch Functionality as well