|
ST7789V3 1.47 Inch LCD Driver
Public API reference for the ST7789V3 display driver
|
Public API for the ST7789V3 SPI display driver. More...


Go to the source code of this file.
Data Structures | |
| struct | ST7789V3_Config |
| Runtime configuration and hardware binding for one display instance. More... | |
Macros | |
Controller Command Macros | |
Controller command values used by the ST7789V3 display. | |
| #define | ST7789V3_rst |
| #define | ST7789V3_backlight |
| #define | Sleep_Out 0x11U |
| #define | Sleep_In 0x10U |
| #define | Display_On_Register 0x29U |
| #define | Display_Off_Register 0x28U |
| #define | CASET 0x2AU |
| #define | RASET 0x2BU |
| #define | RAMWR 0x2CU |
| #define | COLMODE 0x3AU |
| #define | MADCTL 0x36U |
| #define | INVOFF_REG 0x20U |
| #define | INVON_REG 0x21U |
Color Constants | |
Predefined 24-bit RGB888 colors in 0xRRGGBB format. | |
| #define | BLACK 0x000000U |
| #define | WHITE 0xFFFFFFU |
| #define | RED 0xFF0000U |
| #define | GREEN 0x00FF00U |
| #define | BLUE 0x0000FFU |
| #define | YELLOW 0xFFFF00U |
| #define | CYAN 0x00FFFFU |
| #define | MAGENTA 0xFF00FFU |
| #define | ORANGE 0xFF6A00U |
| #define | PINK 0xFF69B4U |
| #define | PURPLE 0x800080U |
| #define | LIME 0x32FF00U |
| #define | NAVY 0x000080U |
| #define | DARK_GREEN 0x006400U |
| #define | MAROON 0x800000U |
| #define | OLIVE 0x808000U |
| #define | TEAL 0x008080U |
| #define | SILVER 0xC0C0C0U |
| #define | GRAY 0x808080U |
| #define | DARK_GRAY 0x404040U |
| #define | LIGHT_GRAY 0xD3D3D3U |
| #define | GOLD 0xFFD700U |
| #define | SKY_BLUE 0x87CEEBU |
Functions | |
Core Control API | |
Functions for initialization and controller-level display control. | |
| void | ST7789V3_init (ST7789V3_Config *config) |
| Initialize the display and apply the default startup sequence. | |
| int8_t | SetWindow (ST7789V3_Config *config, uint16_t X_Start, uint16_t X_End, uint16_t Y_Start, uint16_t Y_End) |
| Set the active drawing window on the display. | |
| int8_t | SetColorMode (ST7789V3_Config *config, Color_Mode bitdepth) |
| Set the controller pixel format. | |
| void | DISPLAYON (ST7789V3_Config *config) |
| Enable display output. | |
| void | DISPLAYOFF (ST7789V3_Config *config) |
| Disable display output. | |
| void | HardReset (ST7789V3_Config *config) |
| Toggle the hardware reset line using the driver's reset sequence. | |
| void | InvertDisplay (ST7789V3_Config *config, Inversion_Mode Inversion) |
| Enable or disable display inversion. | |
| void | SleepMode (ST7789V3_Config *config, Sleep_State sleepstate) |
| Put the display into sleep mode or wake it up. | |
Drawing API | |
Functions for rendering pixels, text, and basic shapes. | |
| int8_t | DrawPixel (ST7789V3_Config *config, uint16_t x, uint16_t y, uint32_t hexcolor) |
| Draw a single pixel using a 24-bit RGB888 input color. | |
| void | DrawChar (ST7789V3_Config *config, uint16_t x, uint16_t y, char user_char, uint32_t hexcolor, const FontDef *font) |
| Draw a single printable ASCII character. | |
| void | FillScreen (ST7789V3_Config *config, uint32_t hexcolor) |
| Fill the entire display with a single color. | |
| void | SetRotation (ST7789V3_Config *config, Orientation orientation) |
| Change the logical display rotation. | |
| void | DrawString (ST7789V3_Config *config, uint16_t x, uint16_t y, const char *str, uint32_t hexcolor, const FontDef *font) |
| Draw a null-terminated string. | |
| void | DrawLine (ST7789V3_Config *config, uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint32_t hexcolor) |
| Draw a line between two points using Bresenham's algorithm. | |
| void | DrawRectangle (ST7789V3_Config *config, uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint32_t hexcolor) |
| Draw an unfilled rectangle outline. | |
| void | DrawFilledRectangle (ST7789V3_Config *config, uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint32_t hexcolor) |
| Draw a filled rectangle. | |
| void | DrawCircle (ST7789V3_Config *config, uint16_t x_center, uint16_t y_center, uint16_t radius, uint32_t hexcolor) |
| Draw a circle outline using the midpoint circle algorithm. | |
| void | DrawFilledCircle (ST7789V3_Config *config, uint16_t x_center, uint16_t y_center, uint16_t radius, uint32_t hexcolor) |
| Draw a filled circle using the midpoint circle algorithm. | |
DMA API | |
Optional non-blocking transfer helpers. | |
| int8_t | ST7789V3_WriteBuffer_DMA (ST7789V3_Config *config, const uint8_t *buf, uint16_t len) |
| Start a non-blocking DMA write of pixel data to the display. | |
| void | ST7789V3_DMA_Complete (ST7789V3_Config *config) |
| Finish a successful DMA transfer and run the completion callback. | |
| void | ST7789V3_DMA_Error (ST7789V3_Config *config) |
| Finish a failed DMA transfer and run the error callback. | |
Enums and Types | |
Public state, mode, and callback types used by the driver. | |
| enum | GPIO_Pinstate { HIGH = 1 , LOW = 0 } |
| Logical output level used by GPIO control callbacks. More... | |
| enum | Trans_State { DATA = 1 , CMD = 0 } |
| Select whether the current SPI byte stream is command or pixel/data content. More... | |
| enum | Color_Mode { bit_12 = 0x03U , bit_16 = 0x05U , bit_18 = 0x06U } |
| Pixel format written to the display controller. More... | |
| enum | Inversion_Mode { INVON = 1 , INVOFF = 0 } |
| Display inversion mode selection. More... | |
| enum | Sleep_State { Asleep = 0 , Awake = 1 } |
| Sleep state selection for the display. More... | |
| enum | Orientation { Portrait = 0 , Landscape = 1 , Portrait_Inverted = 2 , Landscape_Inverted = 3 } |
| Logical display orientation used by SetRotation. More... | |
| enum | ST7789V3_State { ST7789_STATE_READY = 0 , ST7789_STATE_BUSY = 1 , ST7789_STATE_ERROR = 2 } |
| Driver transfer state used for DMA operations. More... | |
| typedef struct ST7789V3_Config | ST7789V3_Config |
| Forward declaration of the driver configuration structure. | |
| typedef void(* | ST7789V3_Callback) (ST7789V3_Config *config, void *user_data) |
| Callback signature used for DMA completion and error notifications. | |
Public API for the ST7789V3 SPI display driver.
This module provides a small, platform-agnostic interface for controlling an ST7789V3-based display over SPI. The application supplies the hardware access callbacks in ST7789V3_Config, then uses the driver to initialize the display, configure core display settings, draw graphics primitives, and optionally stream pixel buffers with DMA.
Typical responsibilities handled by this header include:
Example setup: