|
WPI ECE 2049 STM32 Adafruit TFT 1.8" Shield
|
#include "stdint.h"#include "stm32h5xx_hal.h"#include "stdbool.h"#include "Adafruit_ST7735_Macros.h"#include "Adafruit_ST77xx_Macros.h"#include "gfxfont.h"#include "stm32h5xx_hal_spi.h"Go to the source code of this file.
Typedefs | |
| typedef struct ST7735_Handle | ST7735_Handle |
| Internal handle used to store the instance of an Adafruit_ST7735 class for use in the C API functions. This struct is not intended to be used outside of this API and should be treated as an opaque handle. Provides a C compatible structure to store the C++ class instance for the ST7735 display. | |
Functions | |
| 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_init (uint8_t options) |
| Function used to initialize the display using the given options. | |
| void | Display_setRotation (uint8_t m) |
| Function to change rotation of 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. Typically not used as singleton. | |
| void | Display_enableDisplay (bool enable) |
| Turns the display on or off. | |
| void | Display_enableTearing (bool enable) |
| Enables a display tearing correction pin. Unused on the TFT 1.8" display. | |
| void | Display_enableSleep (bool enable) |
| Enables whether the display should be able to enter sleep mode when given a command. Not typically used. | |
| 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 setAddrWindow. | |
| 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 setAddrWindow. | |
| 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_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_invertDisplay (bool i) |
| Function to invert the display colors. 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_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 setAddrWindow. | |
| 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 automatically calls setAddrWindow. | |
| void | Display_fillScreen (uint16_t color) |
| Function to fill the entire screen with a single color. Singleton function that automatically calls setAddrWindow. | |
| 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_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. | |
| 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_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 automatically calls setAddrWindow. | |
| 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_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 automatically calls setAddrWindow. | |
| 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. | |
| 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. | |
| 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_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_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_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_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 automatically calls setAddrWindow. | |
| 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 calls setAddrWindow. | |
| 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. Singleton function that automatically calls setAddrWindow. | |
| 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_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 setAddrWindow. | |
| 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. | |
| 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 take up on the display. Singleton function that does not call setAddrWindow. | |
| void | Display_setTextSize (uint8_t sx, uint8_t sy) |
| Function to set the text size for the display. | |
| void | Display_setFont (const GFXfont *f) |
| Function to set the font for the display. | |
| 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. Singleton function that does not call setAddrWindow. | |
| void | Display_setTextColor (uint16_t c) |
| Sets the color used to draw text on the display. | |
| void | Display_setTextColorWithBg (uint16_t c, uint16_t bg) |
| Sets the text color and background color behind the characters. | |
| void | Display_setTextWrap (bool w) |
| Sets whether text should wrap when it reaches the edge of the display. | |
| void | Display_cp437 (bool x) |
| Sets whether to use the CP437 character set. If false, will use standard ASCII. If true, will use CP437 which has some additional characters in the 128-255 range. Singleton function that does not call setAddrWindow. | |
| int16_t | Display_width () |
| Get the width of the initialized display. Adjusts based on the current rotation of the display. | |
| int16_t | Display_height () |
| Get the height of the initialized display. Adjusts based on the current rotation of the display. | |
| uint8_t | Display_getRotation () |
| Get the current rotation of the display. | |
| int16_t | Display_getCursorX () |
| Gets the current x coord of the display's cursor. | |
| int16_t | Display_getCursorY () |
| Gets the current y coord of the display's cursor. | |
| void | Display_print (const char *str) |
| Print a string of text to the display. | |
| void | Display_println (const char *str) |
| Print a string of text to the display followed by a newline. | |
| typedef struct ST7735_Handle ST7735_Handle |
Internal handle used to store the instance of an Adafruit_ST7735 class for use in the C API functions. This struct is not intended to be used outside of this API and should be treated as an opaque handle. Provides a C compatible structure to store the C++ class instance for the ST7735 display.
| 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.
| r | 8-bit red value |
| g | 8-bit green value |
| b | 8-bit blue value |
| void Display_cp437 | ( | bool | x | ) |
Sets whether to use the CP437 character set. If false, will use standard ASCII. If true, will use CP437 which has some additional characters in the 128-255 range. Singleton function that does not call setAddrWindow.
| x | true to enable CP437 character set, false to use standard ASCII |
| 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.
| spi_handle | The handle for the STM32 hardware spi instance that has been set up for the TFT display |
| cs | The pin number for the TFT display's CS pin. Will come from a macro with the pin label generated by STM32CubeMX |
| cs_port | The STM32 GPIO port for the TFT display's CS pin. Predefined macro for the GPIO port associated with the CS pin |
| dc | The pin number for the TFT display's DC pin. Will come from a macro with the pin label generated by STM32CubeMX |
| dc_port | The STM32 GPIO port for the TFT display's DC pin. Predefined macro for the GPIO port associated with the DC pin |
| 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.
| x | Top-left corner x coord of the bitmap |
| y | Top-left corner y coord of the bitmap |
| bitmap | Pointer to the bitmap data |
| w | Width of the bitmap |
| h | Height of the bitmap |
| color | Color to draw the bitmap |
| 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 automatically calls setAddrWindow.
| x | Top-left corner x coord of the bitmap |
| y | Top-left corner y coord of the bitmap |
| bitmap | Pointer to the bitmap data |
| w | Width of the bitmap |
| h | Height of the bitmap |
| color | Color to draw the bitmap |
| bg | Background color of the bitmap |
| 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.
| x | Top-left corner x coord of the character |
| y | Top-left corner y coord of the character |
| c | Character to draw |
| color | Color of the character |
| bg | Background color of the character |
| size_x | Horizontal scaling factor |
| size_y | Vertical scaling factor |
| 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.
| x0 | Center x coord of the circle |
| y0 | Center y coord of the circle |
| r | Radius of the circle |
| color | Color of the circle |
| 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 automatically calls setAddrWindow.
| x0 | Center x coord of the circle |
| y0 | Center y coord of the circle |
| r | Radius of the circle |
| cornername | Corner of the circle to draw. Mask bit #1, #2, #4, and #8 to indicate which quarters of the circle should be drawn |
| color | Color of the circle |
| 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.
| x0 | Center x coord of the ellipse |
| y0 | Center y coord of the ellipse |
| rw | Radius along the x-axis |
| rh | Radius along the y-axis |
| color | Color of the ellipse |
| 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.
| x | Starting x coord for the line |
| y | The y coord to draw the line on |
| w | The width of the line |
| color | Color to draw the line in |
| 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.
| x | X coord to draw the line on |
| y | Starting y coord for the line |
| h | Height of the line |
| color | Color to draw the line in |
| 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.
| x | Top-left corner x coord of the bitmap |
| y | Top-left corner y coord of the bitmap |
| bitmap | Pointer to the bitmap data |
| w | Width of the bitmap |
| h | Height of the bitmap |
| 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 setAddrWindow.
| x | Top-left corner x coord of the bitmap |
| y | Top-left corner y coord of the bitmap |
| bitmap | Pointer to the bitmap data |
| w | Width of the bitmap |
| h | Height of the bitmap |
| mask | Pointer to the mask data (1=bit mask where 1 is set and 0 is clear) |
| 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.
| x0 | Starting x coord of the line |
| y0 | Starting y coord of the line |
| x1 | Ending x coord of the line |
| y1 | Ending y coord of the line |
| color | Color of the line |
| 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 setAddrWindow.
| x | X coord of the pixel |
| y | Y coord of the pixel |
| color | Color to set the pixel |
| 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.
| x | Starting x coord of the rectangle |
| y | Starting y coord of the rectangle |
| w | Width of the rectangle |
| h | Height of the rectangle |
| color | Color of the rectangle |
| 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 setAddrWindow.
| x | Starting x coord to draw the bitmap at the top left corner |
| y | Starting y coord to draw the bitmap at the top left corner |
| pcolors | Pointer to the bitmap data in an array of 16-bit color values in 565 RGB format |
| w | Width of the bitmap |
| h | Height of the bitmap |
| 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 automatically calls setAddrWindow.
| x | Starting x coord to draw the bitmap at the top left corner |
| y | Starting y coord to draw the bitmap at the top left corner |
| pcolors | Pointer to the bitmap data in an array of 16-bit color values in 565 RGB format |
| w | Width of the bitmap |
| h | Height of the bitmap |
| mask | Pointer to the mask data in an array of 8-bit values |
| 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.
| x0 | Top-left corner x coord of the rectangle |
| y0 | Top-left corner y coord of the rectangle |
| w | Width of the rectangle |
| h | Height of the rectangle |
| radius | Radius of the rounded corners |
| color | Color of the rectangle |
| 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.
| x0 | First vertex x coord of the triangle |
| y0 | First vertex y coord of the triangle |
| x1 | Second vertex x coord of the triangle |
| y1 | Second vertex y coord of the triangle |
| x2 | Third vertex x coord of the triangle |
| y2 | Third vertex y coord of the triangle |
| color | Color of the triangle |
| 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 calls setAddrWindow.
| x | Top-left corner x coord of the bitmap |
| y | Top-left corner y coord of the bitmap |
| bitmap | Pointer to the bitmap data |
| w | Width of the bitmap |
| h | Height of the bitmap |
| color | Color to draw the bitmap |
| 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. Singleton function that automatically calls setAddrWindow.
| x | Top-left corner x coord of the bitmap |
| y | Top-left corner y coord of the bitmap |
| bitmap | Pointer to the bitmap data |
| w | Width of the bitmap |
| h | Height of the bitmap |
| color | Color to draw the bitmap |
| bg | Background color of the bitmap |
| void Display_enableDisplay | ( | bool | enable | ) |
Turns the display on or off.
| enable | True turns the display on, false turns the display off |
| void Display_enableSleep | ( | bool | enable | ) |
Enables whether the display should be able to enter sleep mode when given a command. Not typically used.
| enable | True enables sleeping, flase disables sleeping |
| void Display_enableTearing | ( | bool | enable | ) |
Enables a display tearing correction pin. Unused on the TFT 1.8" display.
| enable | True turns enables tearing correct, false disables tearing correction |
| 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.
| x0 | Center x coord of the circle |
| y0 | Center y coord of the circle |
| r | Radius of the circle |
| color | Color of the circle |
| 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 automatically calls setAddrWindow.
| x0 | Center x coord of the circle |
| y0 | Center y coord of the circle |
| r | Radius of the circle |
| cornername | Corner of the circle to draw. Mask bit #1, #2, #4, and #8 to indicate which quarters of the circle should be drawn |
| delta | Offset from the circle's radius |
| color | Color of the circle |
| 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.
| x0 | Center x coord of the ellipse |
| y0 | Center y coord of the ellipse |
| rw | Radius along the x-axis |
| rh | Radius along the y-axis |
| color | Color of the ellipse |
| 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 setAddrWindow.
| x | X coord of the top left corner of the rectangle |
| y | Y coord of the top left corner of the rectangle |
| w | Width of the rectangle |
| h | Height of the rectangle |
| color | Color to fill the rectangle with. In the (565) bit RGB format |
| 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.
| x0 | Top-left corner x coord of the rectangle |
| y0 | Top-left corner y coord of the rectangle |
| w | Width of the rectangle |
| h | Height of the rectangle |
| radius | Radius of the rounded corners |
| color | Color of the rectangle |
| void Display_fillScreen | ( | uint16_t | color | ) |
Function to fill the entire screen with a single color. Singleton function that automatically calls setAddrWindow.
| color | Color to fill the screen with |
| 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.
| x0 | First vertex x coord of the triangle |
| y0 | First vertex y coord of the triangle |
| x1 | Second vertex x coord of the triangle |
| y1 | Second vertex y coord of the triangle |
| x2 | Third vertex x coord of the triangle |
| y2 | Third vertex y coord of the triangle |
| color | Color of the triangle |
| int16_t Display_getCursorX | ( | ) |
Gets the current x coord of the display's cursor.
| int16_t Display_getCursorY | ( | ) |
Gets the current y coord of the display's cursor.
| uint8_t Display_getRotation | ( | ) |
Get the current rotation of the display.
| 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 take up on the display. Singleton function that does not call setAddrWindow.
| string | Pointer to the string of text |
| x | Top-left corner x coord of the text |
| y | Top-left corner y coord of the text |
| x1 | Pointer to store the top-left corner x coord of the bounding box |
| y1 | Pointer to store the top-left corner y coord of the bounding box |
| w | Pointer to store the width of the bounding box |
| h | Pointer to store the height of the bounding box |
| int16_t Display_height | ( | ) |
Get the height of the initialized display. Adjusts based on the current rotation of the display.
| void Display_init | ( | uint8_t | options | ) |
Function used to initialize the display using the given options.
| options | One of the preset Adafruit INITR intialization options presets. Can be found in Adafruit_ST7735_Macros.h |
| void Display_invertDisplay | ( | bool | i | ) |
Function to invert the display colors. Singleton function that automatically calls setAddrWindow.
| i | True inverts the display, false sets the display to normal colors |
| void Display_print | ( | const char * | str | ) |
Print a string of text to the display.
| str | Pointer to the string of text to print |
| void Display_println | ( | const char * | str | ) |
Print a string of text to the display followed by a newline.
| str | Pointer to the string of text to print |
| 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. Typically not used as singleton.
| x | Starting x pixel |
| y | Starting y pixel |
| w | Width of window |
| h | Height of window |
| 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. Singleton function that does not call setAddrWindow.
| x | x coord of the cursor |
| y | y coord of the cursor |
| void Display_setFont | ( | const GFXfont * | f | ) |
Function to set the font for the display.
| f | Pointer to the font to set. Fonts are defined in header files stored in Core/Inc/graphics/Fonts. |
| void Display_setRotation | ( | uint8_t | m | ) |
Function to change rotation of display.
| m | How many 90 degree turns to apply to the display. 0 is no change, 1 rotates clockwise by 90 degrees, 2 clockwise 180 degrees, and 3 clockwise 270 degrees |
| void Display_setTextColor | ( | uint16_t | c | ) |
Sets the color used to draw text on the display.
| c | Color to set the text to |
| void Display_setTextColorWithBg | ( | uint16_t | c, |
| uint16_t | bg ) |
Sets the text color and background color behind the characters.
| c | Color to draw the text in |
| bg | Color to draw behind the text |
| void Display_setTextSize | ( | uint8_t | sx, |
| uint8_t | sy ) |
Function to set the text size for the display.
| sx | Horizontal size |
| sy | Vertical size |
| void Display_setTextWrap | ( | bool | w | ) |
Sets whether text should wrap when it reaches the edge of the display.
| w | true to enable text wrapping, false to clip text at the edge of the display |
| int16_t Display_width | ( | ) |
Get the width of the initialized display. Adjusts based on the current rotation of the display.