123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- /**
- * @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 <stdbool.h>
- #include "lv_hal.h"
- #include "../lv_misc/lv_color.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);
- #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
- } 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
|