WPI ECE 2049 STM32 Adafruit TFT 1.8" Shield
Loading...
Searching...
No Matches
Adafruit_ST7735_API.h
Go to the documentation of this file.
1
14
15#ifndef ADAFRUIT_ST7735_API_H
16#define ADAFRUIT_ST7735_API_H
17
18#include "stdint.h"
19#include "stm32h5xx_hal.h"
20#include "stdbool.h"
21
22#include "Adafruit_ST7735_Macros.h"
23#include "Adafruit_ST77xx_Macros.h"
24#include "gfxfont.h"
25#include "stm32h5xx_hal_spi.h"
26
27#ifdef __cplusplus
28extern "C" {
29#endif // __cplusplus
30
38
39//---------------------------------------------------------------------------------
40// Adafruit_ST7735.cpp function declarations
41
51void Display_create(SPI_HandleTypeDef *spi_handle, int16_t cs, GPIO_TypeDef *cs_port, int16_t dc, GPIO_TypeDef *dc_port);
52
58void Display_init(uint8_t options);
59
65void Display_setRotation(uint8_t m);
66//---------------------------------------------------------------------------------
67// Adafruit_ST77xx.cpp function declarations
68
77void Display_setAddrWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
78
84void Display_enableDisplay(bool enable);
85
91void Display_enableTearing(bool enable);
92
98void Display_enableSleep(bool enable);
99
100//---------------------------------------------------------------------------------
101// Adafruit_SPITFT.cpp function declarations
102
110void Display_drawPixel(int16_t x, int16_t y, uint16_t color);
111
121void Display_fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
122
131void Display_drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
132
141void Display_drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
142
149
158uint16_t Display_color565(uint8_t r, uint8_t g, uint8_t b);
159
169void Display_drawRGBBitmap(int16_t x, int16_t y, uint16_t *pcolors, int16_t w, int16_t h);
170
181void Display_drawRGBBitmapMask(int16_t x, int16_t y, uint16_t *pcolors, int16_t w, int16_t h, uint8_t *mask);
182
183//---------------------------------------------------------------------------------
184// Adafruit_GFX.cpp function declarations
185
191void Display_fillScreen(uint16_t color);
192
202void Display_drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color);
203
213void Display_drawRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
214
223void Display_drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color);
224
234void Display_drawCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername, uint16_t color);
235
244void Display_fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color);
245
256void Display_fillCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername, int16_t delta, uint16_t color);
257
267void Display_drawEllipse(int16_t x0, int16_t y0, int16_t rw, int16_t rh, uint16_t color);
268
278void Display_fillEllipse(int16_t x0, int16_t y0, int16_t rw, int16_t rh, uint16_t color);
279
291void Display_drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color);
292
304void Display_fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color);
305
316void Display_drawRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color);
317
328void Display_fillRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color);
329
340void Display_drawBitmap(int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h, uint16_t color);
341
353void Display_drawBitmapBg(int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h, uint16_t color, uint16_t bg);
354
365void Display_drawXBitmap(int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h, uint16_t color);
366
378void Display_drawXBitmapBg(int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h, uint16_t color, uint16_t bg);
379
389void Display_drawGrayscaleBitmap(int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h);
390
401void Display_drawGrayscaleBitmapMask(int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h, uint8_t *mask);
402
414void Display_drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg, uint8_t size_x, uint8_t size_y);
415
427void Display_getTextBounds(const char *string, int16_t x, int16_t y, int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h);
428
435void Display_setTextSize(uint8_t sx, uint8_t sy);
436
442void Display_setFont(const GFXfont *f);
443
450void Display_setCursor(int16_t x, int16_t y);
451
457void Display_setTextColor(uint16_t c);
458
465void Display_setTextColorWithBg(uint16_t c, uint16_t bg);
466
473
479void Display_cp437(bool x);
480
487
494
501
508
515
521void Display_print(const char *str);
522
528void Display_println(const char *str);
529
530#ifdef __cplusplus
531}
532#endif // __cplusplus
533
534#endif // ADAFRUIT_ST7735_API_H
void Display_drawEllipse(int16_t x0, int16_t y0, int16_t rw, int16_t rh, uint16_t color)
Function to draw a non-filled ellipse. Singleton function that automatically calls setAddrWindow.
struct ST7735_Handle ST7735_Handle
Internal handle used to store the instance of an Adafruit_ST7735 class for use in the C API functions...
Definition Adafruit_ST7735_API.h:37
void Display_drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color)
Optimized vertical line drawing function. Singleton function that automatically calls setAddrWindow.
void Display_setCursor(int16_t x, int16_t y)
Sets the cursor position for the display. The cursor is used as the starting point for drawing text....
void Display_getTextBounds(const char *string, int16_t x, int16_t y, int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h)
Gets the bounding box of a string of text. Used to determine how much space a string of text will tak...
void Display_fillCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername, int16_t delta, uint16_t color)
Function to draw a filled circle that you can choose the corner to draw. Singleton function that auto...
void Display_fillScreen(uint16_t color)
Function to fill the entire screen with a single color. Singleton function that automatically calls s...
void Display_drawPixel(int16_t x, int16_t y, uint16_t color)
Draws a single pixel with a color to the display. Singleton function that automatically calls setAddr...
void Display_drawCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername, uint16_t color)
Function to draw a circle that you can choose the corner to draw. Singleton function that automatical...
int16_t Display_getCursorY()
Gets the current y coord of the display's cursor.
int16_t Display_height()
Get the height of the initialized display. Adjusts based on the current rotation of the display.
void Display_fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
Function to draw a filled triangle. Singleton function that automatically calls setAddrWindow.
void Display_setTextSize(uint8_t sx, uint8_t sy)
Function to set the text size for the display.
void Display_fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
Fills a rectangle on the display with a color. Singleton function that automatically calls setAddrWin...
void Display_drawBitmap(int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h, uint16_t color)
Draws a monochrome bitmap to the display. Singleton function that automatically calls setAddrWindow.
void Display_enableTearing(bool enable)
Enables a display tearing correction pin. Unused on the TFT 1.8" display.
void Display_setAddrWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
Sets the address windows that the display expects to receive data in from another function call....
void Display_drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color)
Function to draw a non-filled circle. Singleton function that automatically calls setAddrWindow.
void Display_invertDisplay(bool i)
Function to invert the display colors. Singleton function that automatically calls setAddrWindow.
void Display_setFont(const GFXfont *f)
Function to set the font for the display.
void Display_init(uint8_t options)
Function used to initialize the display using the given options.
void Display_fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color)
Function to draw a filled circle. Singleton function that automatically calls setAddrWindow.
void Display_enableSleep(bool enable)
Enables whether the display should be able to enter sleep mode when given a command....
void Display_drawGrayscaleBitmap(int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h)
Draws a grayscale bitmap to the display. Singleton function that automatically calls setAddrWindow.
void Display_drawRGBBitmap(int16_t x, int16_t y, uint16_t *pcolors, int16_t w, int16_t h)
Function to draw an RGB bitmap to the display. Singleton function that automatically calls setAddrWin...
void Display_drawRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
Function to draw a non-filled rectangle. Singleton function that automatically calls setAddrWindow.
uint16_t Display_color565(uint8_t r, uint8_t g, uint8_t b)
Converts 8-bit R, G, and B values into a single 16-bit value in 565 RGB format.
void Display_print(const char *str)
Print a string of text to the display.
uint8_t Display_getRotation()
Get the current rotation of the display.
void Display_create(SPI_HandleTypeDef *spi_handle, int16_t cs, GPIO_TypeDef *cs_port, int16_t dc, GPIO_TypeDef *dc_port)
Function used to create the instance for the display's graphics.
void Display_drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)
Function to draw a line between two points. Singleton function that automatically calls setAddrWindow...
void Display_drawGrayscaleBitmapMask(int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h, uint8_t *mask)
Draws a grayscale bitmap with a mask to the display. Singleton function that automatically calls setA...
void Display_drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
Function to draw a non-filled triangle. Singleton function that automatically calls setAddrWindow.
void Display_setTextColorWithBg(uint16_t c, uint16_t bg)
Sets the text color and background color behind the characters.
void Display_fillEllipse(int16_t x0, int16_t y0, int16_t rw, int16_t rh, uint16_t color)
Function to draw a filled ellipse. Singleton function that automatically calls setAddrWindow.
int16_t Display_width()
Get the width of the initialized display. Adjusts based on the current rotation of the display.
void Display_drawRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color)
Draws a rounded non-filled rectangle. Singleton function that automatically calls setAddrWindow.
void Display_fillRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color)
Draws a filled rounded rectangle. Singleton function that automatically calls setAddrWindow.
void Display_println(const char *str)
Print a string of text to the display followed by a newline.
void Display_setRotation(uint8_t m)
Function to change rotation of display.
void Display_drawXBitmapBg(int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h, uint16_t color, uint16_t bg)
Draws an XBM format bitmap exported from GIMP to the display with a background color....
void Display_drawBitmapBg(int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h, uint16_t color, uint16_t bg)
Draws a monochrome bitmap with a background color to the display. Singleton function that automatical...
void Display_setTextWrap(bool w)
Sets whether text should wrap when it reaches the edge of the display.
void Display_setTextColor(uint16_t c)
Sets the color used to draw text on the display.
void Display_cp437(bool x)
Sets whether to use the CP437 character set. If false, will use standard ASCII. If true,...
void Display_drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color)
Optimized horizontal line drawing function. Singleton function that automatically calls setAddrWindow...
void Display_enableDisplay(bool enable)
Turns the display on or off.
void Display_drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg, uint8_t size_x, uint8_t size_y)
Draws a character to the display. Singleton function that automatically calls setAddrWindow.
int16_t Display_getCursorX()
Gets the current x coord of the display's cursor.
void Display_drawRGBBitmapMask(int16_t x, int16_t y, uint16_t *pcolors, int16_t w, int16_t h, uint8_t *mask)
Function to draw an RGB bitmap to the display with an optional mask. Singleton function that automati...
void Display_drawXBitmap(int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h, uint16_t color)
Draws an XBM format bitmap exported from GIMP to the display. Singleton function that automatically c...