Screen Hardware (TFT) Class
This class implements the screen API for real hardware. The class communicates with the hardware via MicroPython, basically passing calls to the TFT (st7735) driver.
- class firmware.screen_tft.ScreenTFT
Bases:
ScreenBaseThis class implements the screen API, specifically for hardware, ST7735 TFT usage inside MicroPython. This class actually communicates with the screen via the st7735 driver, providing a drawing surface that is actually shown to the user.
- BLACK = 0
Black color definition copied in from the st7735 driver class
- BLUE = 31
Blue color definition copied in from the st7735 driver class
- GRAY = 33808
Gray color definition copied in from the st7735 driver class
- GREEN = 2016
Green color definition copied in from the st7735 driver class
- PIN_CS = 17
Pico pin connected to screen CS terminal
- PIN_DC = 16
Pico pin connected to screen DC terminal
- PIN_LED = 21
Pico pin connected to screen LED+ terminal
- PIN_RESET = 20
Pico pin connected to screen RESET terminal
- PIN_RGB_INVERT = 10
Pico pin used to trigger RGB invert mode if jumped to GND
- PIN_SCI_SCK = 18
Pico pin connected to screen SCI/SCK terminal
- PIN_SDA_MOSI = 19
Pico pin connected to screen SDA/MOSI terminal
- RED = 63488
Red color definition copied in from the st7735 driver class
- WHITE = 65535
White color definition copied in from the st7735 driver class
- YELLOW = 65504
Yellow color definition copied in from the st7735 driver class
- circle(point: tuple, radius: int, color: int) None
This function uses the st7735 driver to draw a hollow circle at the given point and radius, with the given color
- Parameters:
point – Center point of the circle
radius – Radius of the circle
color – Color of the circle
- Returns:
Nothing
- draw_qr(y_offset: int, qr_bits: list, scale: int = 3) None
This function uses the st7735 to render a set of bits as black and white rectangles, such as a QR code.
- Parameters:
y_offset – The top margin above the rendered bits
qr_bits – The bits to render, as a list of lists of ones and zeroes
scale – The render scale to make it show up easier on the screen
- Returns:
Nothing
- fill(color: int) None
This function uses the st7735 driver to fill the draw surface with the provided color.
- Parameters:
color – The color to fill
- Returns:
Nothing
- fillrect(point: tuple, size: tuple, color: int) None
This function uses the st7735 driver to draw a filled rectangle at the given point, size, with the given color
- Parameters:
point – Top left point of the rectangle
size – The size (width, height) of the rectangle box
color – The rectangle fill color
- Returns:
Nothing
- hline(point: tuple, length: int, color: int) None
This function uses the st7735 driver to draw a horizontal line at the given point, length and color
- Parameters:
point – Left point of the horizontal line
length – Length of the line to draw
color – Line color
- Returns:
Nothing
- rect(point: tuple, size: tuple, color: int) None
This function uses the st7735 driver to draw a rectangle at the given point and size, with the given color
- Parameters:
point – Top left point of the rectangle
size – The size (width, height) of the rectangle box
color – The rectangle outline color
- Returns:
Nothing
- text(point: tuple, text: str, color: int, size: int = 1, nowrap=True) None
This function uses the st7735 driver to render text at the given point with the given color and size
- Parameters:
point – Top left point of the text string
text – The text string to render
color – The text color
size – The size of the font
nowrap – A flag to determine whether to not wrap text
- Returns:
Nothing
- vline(point: tuple, length: int, color: int) None
This function uses the st7735 driver to draw a vertical line at the given point, length and color
- Parameters:
point – Top point of the horizontal line
length – Length of the line to draw
color – Line color
- Returns:
Nothing