2017-10-18 14:09:10 +02:00
|
|
|
/**
|
2019-02-10 11:06:47 +01:00
|
|
|
* @file lv_hal_disp.h
|
2017-10-18 14:09:10 +02:00
|
|
|
*
|
|
|
|
* @description Display Driver HAL interface header file
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-02-10 11:06:47 +01:00
|
|
|
#ifndef LV_HAL_DISP_H
|
|
|
|
#define LV_HAL_DISP_H
|
2017-10-18 14:09:10 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*********************
|
|
|
|
* INCLUDES
|
|
|
|
*********************/
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "lv_hal.h"
|
2017-11-23 20:42:14 +01:00
|
|
|
#include "../lv_misc/lv_color.h"
|
2018-08-04 01:46:00 +02:00
|
|
|
#include "../lv_misc/lv_area.h"
|
2019-02-10 11:06:47 +01:00
|
|
|
#include "../lv_misc/lv_ll.h"
|
2017-10-18 14:09:10 +02:00
|
|
|
|
|
|
|
/*********************
|
|
|
|
* DEFINES
|
|
|
|
*********************/
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* TYPEDEFS
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Display Driver structure to be registered by HAL
|
|
|
|
*/
|
|
|
|
typedef struct _disp_drv_t {
|
2019-02-02 04:46:19 +01:00
|
|
|
lv_coord_t hor_res;
|
|
|
|
|
|
|
|
lv_coord_t ver_res;
|
|
|
|
|
2017-11-29 10:46:59 +01:00
|
|
|
/*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*/
|
2017-11-28 16:15:13 +01:00
|
|
|
void (*disp_fill)(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t color);
|
2017-11-29 10:46:59 +01:00
|
|
|
|
|
|
|
/*Write pixel map (e.g. image) to the display*/
|
2017-11-28 16:15:13 +01:00
|
|
|
void (*disp_map)(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t * color_p);
|
2017-11-29 10:46:59 +01:00
|
|
|
|
2018-08-04 01:46:00 +02:00
|
|
|
/*Optional interface functions to use GPU*/
|
2017-12-07 19:22:23 +01:00
|
|
|
#if USE_LV_GPU
|
2017-11-29 10:46:59 +01:00
|
|
|
/*Blend two memories using opacity (GPU only)*/
|
2017-11-28 16:15:13 +01:00
|
|
|
void (*mem_blend)(lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa);
|
2017-11-29 10:46:59 +01:00
|
|
|
|
|
|
|
/*Fill a memory with a color (GPU only)*/
|
2017-11-28 16:15:13 +01:00
|
|
|
void (*mem_fill)(lv_color_t * dest, uint32_t length, lv_color_t color);
|
2017-12-07 19:22:23 +01:00
|
|
|
#endif
|
|
|
|
|
2018-08-04 01:46:00 +02:00
|
|
|
#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
|
2017-10-20 22:11:18 +02:00
|
|
|
} lv_disp_drv_t;
|
2017-10-18 14:09:10 +02:00
|
|
|
|
2019-02-10 11:06:47 +01:00
|
|
|
struct _lv_obj_t;
|
|
|
|
|
2017-10-20 22:11:18 +02:00
|
|
|
typedef struct _disp_t {
|
|
|
|
lv_disp_drv_t driver;
|
2019-02-02 04:46:19 +01:00
|
|
|
lv_area_t inv_buf[32];
|
|
|
|
lv_ll_t scr_ll;
|
2019-02-10 11:06:47 +01:00
|
|
|
struct _lv_obj_t * act_scr;
|
|
|
|
struct _lv_obj_t * top_layer;
|
2019-02-12 12:21:34 +01:00
|
|
|
struct _lv_obj_t * sys_layer;
|
2019-02-03 00:47:50 +01:00
|
|
|
uint8_t orientation:2;
|
2017-10-18 14:09:10 +02:00
|
|
|
} lv_disp_t;
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* GLOBAL PROTOTYPES
|
|
|
|
**********************/
|
|
|
|
|
2017-11-27 09:38:10 +01:00
|
|
|
/**
|
|
|
|
* 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);
|
2017-10-20 22:41:10 +02:00
|
|
|
|
2017-10-18 14:09:10 +02:00
|
|
|
/**
|
2017-10-20 22:41:10 +02:00
|
|
|
* 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
|
2017-10-18 14:09:10 +02:00
|
|
|
*/
|
2017-11-27 09:38:10 +01:00
|
|
|
lv_disp_t * lv_disp_drv_register(lv_disp_drv_t *driver);
|
2017-10-18 14:09:10 +02:00
|
|
|
|
|
|
|
|
2019-02-10 11:06:47 +01:00
|
|
|
lv_disp_t * lv_disp_get_last(void);
|
2017-10-18 14:09:10 +02:00
|
|
|
|
|
|
|
/**
|
2017-10-20 22:41:10 +02:00
|
|
|
* 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
|
|
|
|
*/
|
2019-02-12 12:21:34 +01:00
|
|
|
lv_disp_t * lv_disp_get_next(lv_disp_t * disp);
|
2017-10-20 22:41:10 +02:00
|
|
|
|
2017-10-18 14:09:10 +02:00
|
|
|
|
2019-02-12 12:21:34 +01:00
|
|
|
lv_coord_t lv_disp_get_hor_res(lv_disp_t * disp);
|
|
|
|
lv_coord_t lv_disp_get_ver_res(lv_disp_t * disp);
|
2017-10-18 14:09:10 +02:00
|
|
|
|
|
|
|
/**********************
|
|
|
|
* MACROS
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* extern "C" */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|