mirror of
https://github.com/Decscots/Lockpick_RCM
synced 2024-12-19 02:51:16 +00:00
173 lines
5.4 KiB
C
173 lines
5.4 KiB
C
/**
|
|
* @file hal_disp.h
|
|
*
|
|
* @description Display Driver HAL interface header file
|
|
*
|
|
*/
|
|
|
|
#ifndef HAL_DISP_H
|
|
#define HAL_DISP_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*********************
|
|
* INCLUDES
|
|
*********************/
|
|
#include <stdint.h>
|
|
#include "lv_hal.h"
|
|
#include "../lv_misc/lv_color.h"
|
|
#include "../lv_misc/lv_area.h"
|
|
|
|
/*********************
|
|
* DEFINES
|
|
*********************/
|
|
|
|
/**********************
|
|
* TYPEDEFS
|
|
**********************/
|
|
|
|
/**
|
|
* Display Driver structure to be registered by HAL
|
|
*/
|
|
typedef struct _disp_drv_t {
|
|
/*Write the internal buffer (VDB) to the display. 'lv_flush_ready()' has to be called when finished*/
|
|
void (*disp_flush)(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t * color_p);
|
|
|
|
/*Fill an area with a color on the display*/
|
|
void (*disp_fill)(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t color);
|
|
|
|
/*Write pixel map (e.g. image) to the display*/
|
|
void (*disp_map)(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t * color_p);
|
|
|
|
/*Optional interface functions to use GPU*/
|
|
#if USE_LV_GPU
|
|
/*Blend two memories using opacity (GPU only)*/
|
|
void (*mem_blend)(lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa);
|
|
|
|
/*Fill a memory with a color (GPU only)*/
|
|
void (*mem_fill)(lv_color_t * dest, uint32_t length, lv_color_t color);
|
|
#endif
|
|
|
|
#if LV_VDB_SIZE
|
|
/*Optional: Set a pixel in a buffer according to the requirements of the display*/
|
|
void (*vdb_wr)(uint8_t * buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y, lv_color_t color, lv_opa_t opa);
|
|
#endif
|
|
} lv_disp_drv_t;
|
|
|
|
typedef struct _disp_t {
|
|
lv_disp_drv_t driver;
|
|
struct _disp_t *next;
|
|
} lv_disp_t;
|
|
|
|
/**********************
|
|
* GLOBAL PROTOTYPES
|
|
**********************/
|
|
|
|
/**
|
|
* Initialize a display driver with default values.
|
|
* It is used to surly have known values in the fields ant not memory junk.
|
|
* After it you can set the fields.
|
|
* @param driver pointer to driver variable to initialize
|
|
*/
|
|
void lv_disp_drv_init(lv_disp_drv_t *driver);
|
|
|
|
/**
|
|
* Register an initialized display driver.
|
|
* Automatically set the first display as active.
|
|
* @param driver pointer to an initialized 'lv_disp_drv_t' variable (can be local variable)
|
|
* @return pointer to the new display or NULL on error
|
|
*/
|
|
lv_disp_t * lv_disp_drv_register(lv_disp_drv_t *driver);
|
|
|
|
/**
|
|
* Set the active display
|
|
* @param disp pointer to a display (return value of 'lv_disp_register')
|
|
*/
|
|
void lv_disp_set_active(lv_disp_t * disp);
|
|
|
|
/**
|
|
* Get a pointer to the active display
|
|
* @return pointer to the active display
|
|
*/
|
|
lv_disp_t * lv_disp_get_active(void);
|
|
|
|
/**
|
|
* Get the next display.
|
|
* @param disp pointer to the current display. NULL to initialize.
|
|
* @return the next display or NULL if no more. Give the first display when the parameter is NULL
|
|
*/
|
|
lv_disp_t * lv_disp_next(lv_disp_t * disp);
|
|
|
|
/**
|
|
* Fill a rectangular area with a color on the active display
|
|
* @param x1 left coordinate of the rectangle
|
|
* @param x2 right coordinate of the rectangle
|
|
* @param y1 top coordinate of the rectangle
|
|
* @param y2 bottom coordinate of the rectangle
|
|
* @param color_p pointer to an array of colors
|
|
*/
|
|
void lv_disp_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t *color_p);
|
|
|
|
/**
|
|
* Fill a rectangular area with a color on the active display
|
|
* @param x1 left coordinate of the rectangle
|
|
* @param x2 right coordinate of the rectangle
|
|
* @param y1 top coordinate of the rectangle
|
|
* @param y2 bottom coordinate of the rectangle
|
|
* @param color fill color
|
|
*/
|
|
void lv_disp_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t color);
|
|
|
|
/**
|
|
* Put a color map to a rectangular area on the active display
|
|
* @param x1 left coordinate of the rectangle
|
|
* @param x2 right coordinate of the rectangle
|
|
* @param y1 top coordinate of the rectangle
|
|
* @param y2 bottom coordinate of the rectangle
|
|
* @param color_map pointer to an array of colors
|
|
*/
|
|
void lv_disp_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t * color_map);
|
|
|
|
#if USE_LV_GPU
|
|
/**
|
|
* Blend pixels to a destination memory from a source memory
|
|
* In 'lv_disp_drv_t' 'mem_blend' is optional. (NULL if not available)
|
|
* @param dest a memory address. Blend 'src' here.
|
|
* @param src pointer to pixel map. Blend it to 'dest'.
|
|
* @param length number of pixels in 'src'
|
|
* @param opa opacity (0, LV_OPA_TRANSP: transparent ... 255, LV_OPA_COVER, fully cover)
|
|
*/
|
|
void lv_disp_mem_blend(lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa);
|
|
|
|
/**
|
|
* Fill a memory with a color (GPUs may support it)
|
|
* In 'lv_disp_drv_t' 'mem_fill' is optional. (NULL if not available)
|
|
* @param dest a memory address. Copy 'src' here.
|
|
* @param src pointer to pixel map. Copy it to 'dest'.
|
|
* @param length number of pixels in 'src'
|
|
* @param opa opacity (0, LV_OPA_TRANSP: transparent ... 255, LV_OPA_COVER, fully cover)
|
|
*/
|
|
void lv_disp_mem_fill(lv_color_t * dest, uint32_t length, lv_color_t color);
|
|
/**
|
|
* Shows if memory blending (by GPU) is supported or not
|
|
* @return false: 'mem_blend' is not supported in the driver; true: 'mem_blend' is supported in the driver
|
|
*/
|
|
bool lv_disp_is_mem_blend_supported(void);
|
|
|
|
/**
|
|
* Shows if memory fill (by GPU) is supported or not
|
|
* @return false: 'mem_fill' is not supported in the drover; true: 'mem_fill' is supported in the driver
|
|
*/
|
|
bool lv_disp_is_mem_fill_supported(void);
|
|
#endif
|
|
/**********************
|
|
* MACROS
|
|
**********************/
|
|
|
|
#ifdef __cplusplus
|
|
} /* extern "C" */
|
|
#endif
|
|
|
|
#endif
|