lego-esp32s3-gameboy/components/st7789/include/st7789.h

68 lines
1.5 KiB
C

/**
* @file st7789.h
* @brief ST7789 Display Driver for Waveshare ESP32-S3-Touch-LCD-2
*
* 2.0" TFT Display, 240x320 resolution
*/
#pragma once
#include <stdint.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Initialize ST7789 display
* @return ESP_OK on success
*/
esp_err_t st7789_init(void);
/**
* @brief Set backlight brightness
* @param brightness 0-100%
*/
void st7789_set_backlight(uint8_t brightness);
/**
* @brief Clear screen to color
* @param color 16-bit RGB565 color
*/
void st7789_fill_screen(uint16_t color);
/**
* @brief Draw pixel
* @param x X coordinate
* @param y Y coordinate
* @param color 16-bit RGB565 color
*/
void st7789_draw_pixel(int16_t x, int16_t y, uint16_t color);
/**
* @brief Draw buffer (framebuffer)
* @param buffer Pointer to RGB565 framebuffer
* @param x X start position
* @param y Y start position
* @param width Width of buffer
* @param height Height of buffer
*/
void st7789_draw_buffer(const uint16_t *buffer, int16_t x, int16_t y,
int16_t width, int16_t height);
/**
* @brief Draw buffer that is already byte-swapped (optimized, no allocation)
* @param buffer Pointer to pre-swapped BGR565 framebuffer
* @param x X start position
* @param y Y start position
* @param width Width of buffer
* @param height Height of buffer
*/
void st7789_draw_buffer_preswapped(const uint16_t *buffer, int16_t x, int16_t y,
int16_t width, int16_t height);
#ifdef __cplusplus
}
#endif