mikroSDK Reference Manual
lv_hal_disp.h
Go to the documentation of this file.
1
8#ifndef LV_HAL_DISP_H
9#define LV_HAL_DISP_H
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15/*********************
16 * INCLUDES
17 *********************/
18#include <stdint.h>
19#include <stdbool.h>
20#include "lv_hal.h"
21#include "../draw/lv_draw.h"
22#include "../misc/lv_color.h"
23#include "../misc/lv_area.h"
24#include "../misc/lv_ll.h"
25#include "../misc/lv_timer.h"
26
27/*********************
28 * DEFINES
29 *********************/
30#ifndef LV_INV_BUF_SIZE
31#define LV_INV_BUF_SIZE 32 /*Buffer size for invalid areas*/
32#endif
33
34#ifndef LV_ATTRIBUTE_FLUSH_READY
35#define LV_ATTRIBUTE_FLUSH_READY
36#endif
37
38/**********************
39 * TYPEDEFS
40 **********************/
41
42struct _lv_obj_t;
43struct _lv_disp_t;
44struct _lv_disp_drv_t;
45struct _lv_theme_t;
46
50typedef struct _lv_disp_draw_buf_t {
51 void * buf1;
52 void * buf2;
54 /*Internal, used by the library*/
55 void * buf_act;
56 uint32_t size; /*In pixel count*/
57 /*1: flushing is in progress. (It can't be a bit field because when it's cleared from IRQ Read-Modify-Write issue might occur)*/
58 volatile int flushing;
59 /*1: It was the last chunk to flush. (It can't be a bit field because when it's cleared from IRQ Read-Modify-Write issue might occur)*/
60 volatile int flushing_last;
61 volatile uint32_t last_area : 1; /*1: the last area is being rendered*/
62 volatile uint32_t last_part : 1; /*1: the last part of the current area is being rendered*/
64
65typedef enum {
66 LV_DISP_ROT_NONE = 0,
67 LV_DISP_ROT_90,
68 LV_DISP_ROT_180,
69 LV_DISP_ROT_270
70} lv_disp_rot_t;
71
77typedef struct _lv_disp_drv_t {
78
79 lv_coord_t hor_res;
80 lv_coord_t ver_res;
82 lv_coord_t
84 lv_coord_t
86 lv_coord_t
88 lv_coord_t offset_y;
93
94 uint32_t direct_mode : 1;
95 uint32_t full_refresh : 1;
96 uint32_t sw_rotate : 1;
97 uint32_t antialiasing : 1;
98 uint32_t rotated : 2;
99 uint32_t screen_transp : 1;
102 uint32_t dpi : 10;
106 void (*flush_cb)(struct _lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p);
107
110 void (*rounder_cb)(struct _lv_disp_drv_t * disp_drv, lv_area_t * area);
111
115 void (*set_px_cb)(struct _lv_disp_drv_t * disp_drv, uint8_t * buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y,
116 lv_color_t color, lv_opa_t opa);
117
118 void (*clear_cb)(struct _lv_disp_drv_t * disp_drv, uint8_t * buf, uint32_t size);
119
120
123 void (*monitor_cb)(struct _lv_disp_drv_t * disp_drv, uint32_t time, uint32_t px);
124
128 void (*wait_cb)(struct _lv_disp_drv_t * disp_drv);
129
131 void (*clean_dcache_cb)(struct _lv_disp_drv_t * disp_drv);
132
134 void (*drv_update_cb)(struct _lv_disp_drv_t * disp_drv);
135
137 void (*render_start_cb)(struct _lv_disp_drv_t * disp_drv);
138
142
143 lv_draw_ctx_t * draw_ctx;
144 void (*draw_ctx_init)(struct _lv_disp_drv_t * disp_drv, lv_draw_ctx_t * draw_ctx);
145 void (*draw_ctx_deinit)(struct _lv_disp_drv_t * disp_drv, lv_draw_ctx_t * draw_ctx);
146 size_t draw_ctx_size;
147
148#if LV_USE_USER_DATA
149 void * user_data;
150#endif
151
153
158typedef struct _lv_disp_t {
161
164
166 struct _lv_theme_t * theme;
167
169 struct _lv_obj_t ** screens;
175 uint32_t screen_cnt;
177 1;
178uint8_t del_prev :
179 1;
182 lv_opa_t bg_opa;
183 lv_color_t bg_color;
184 const void * bg_img;
187 lv_area_t inv_areas[LV_INV_BUF_SIZE];
188 uint8_t inv_area_joined[LV_INV_BUF_SIZE];
189 uint16_t inv_p;
190 int32_t inv_en_cnt;
191
192 /*Miscellaneous data*/
195
196/**********************
197 * GLOBAL PROTOTYPES
198 **********************/
199
207
223void lv_disp_draw_buf_init(lv_disp_draw_buf_t * draw_buf, void * buf1, void * buf2, uint32_t size_in_px_cnt);
224
232
239
245
251
257
264
271
278
285
292
299
306
312lv_coord_t lv_disp_get_dpi(const lv_disp_t * disp);
313
314
320void lv_disp_set_rotation(lv_disp_t * disp, lv_disp_rot_t rotation);
321
327lv_disp_rot_t lv_disp_get_rotation(lv_disp_t * disp);
328
330
335LV_ATTRIBUTE_FLUSH_READY void lv_disp_flush_ready(lv_disp_drv_t * disp_drv);
336
343LV_ATTRIBUTE_FLUSH_READY bool lv_disp_flush_is_last(lv_disp_drv_t * disp_drv);
344
346
353
360
361void lv_disp_drv_use_generic_set_px_cb(lv_disp_drv_t * disp_drv, lv_img_cf_t cf);
362
363/**********************
364 * MACROS
365 **********************/
366
367#ifdef __cplusplus
368} /*extern "C"*/
369#endif
370
371#endif
void lv_disp_draw_buf_init(lv_disp_draw_buf_t *draw_buf, void *buf1, void *buf2, uint32_t size_in_px_cnt)
void lv_disp_drv_update(lv_disp_t *disp, lv_disp_drv_t *new_drv)
lv_disp_rot_t lv_disp_get_rotation(lv_disp_t *disp)
lv_coord_t lv_disp_get_physical_ver_res(lv_disp_t *disp)
void lv_disp_drv_init(lv_disp_drv_t *driver)
lv_coord_t lv_disp_get_hor_res(lv_disp_t *disp)
struct _lv_disp_t lv_disp_t
lv_coord_t lv_disp_get_dpi(const lv_disp_t *disp)
lv_coord_t lv_disp_get_physical_hor_res(lv_disp_t *disp)
void lv_disp_set_default(lv_disp_t *disp)
lv_disp_draw_buf_t * lv_disp_get_draw_buf(lv_disp_t *disp)
lv_disp_t * lv_disp_get_default(void)
void lv_disp_set_rotation(lv_disp_t *disp, lv_disp_rot_t rotation)
lv_disp_t * lv_disp_get_next(lv_disp_t *disp)
struct _lv_disp_draw_buf_t lv_disp_draw_buf_t
bool lv_disp_get_antialiasing(lv_disp_t *disp)
lv_coord_t lv_disp_get_offset_y(lv_disp_t *disp)
lv_coord_t lv_disp_get_ver_res(lv_disp_t *disp)
struct _lv_disp_drv_t lv_disp_drv_t
lv_disp_t * lv_disp_drv_register(lv_disp_drv_t *driver)
lv_coord_t lv_disp_get_offset_x(lv_disp_t *disp)
void lv_disp_remove(lv_disp_t *disp)
Definition lv_hal_disp.h:50
void * buf1
Definition lv_hal_disp.h:51
void * buf2
Definition lv_hal_disp.h:52
Definition lv_hal_disp.h:77
void(* flush_cb)(struct _lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p)
Definition lv_hal_disp.h:106
void(* set_px_cb)(struct _lv_disp_drv_t *disp_drv, uint8_t *buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y, lv_color_t color, lv_opa_t opa)
Definition lv_hal_disp.h:115
void(* rounder_cb)(struct _lv_disp_drv_t *disp_drv, lv_area_t *area)
Definition lv_hal_disp.h:110
uint32_t sw_rotate
Definition lv_hal_disp.h:96
uint32_t dpi
Definition lv_hal_disp.h:102
uint32_t antialiasing
Definition lv_hal_disp.h:97
lv_coord_t ver_res
Definition lv_hal_disp.h:80
lv_disp_draw_buf_t * draw_buf
Definition lv_hal_disp.h:92
lv_coord_t offset_y
Definition lv_hal_disp.h:88
void(* drv_update_cb)(struct _lv_disp_drv_t *disp_drv)
Definition lv_hal_disp.h:134
void(* wait_cb)(struct _lv_disp_drv_t *disp_drv)
Definition lv_hal_disp.h:128
uint32_t direct_mode
Definition lv_hal_disp.h:94
void(* clean_dcache_cb)(struct _lv_disp_drv_t *disp_drv)
Definition lv_hal_disp.h:131
lv_coord_t hor_res
Definition lv_hal_disp.h:79
lv_coord_t physical_hor_res
Definition lv_hal_disp.h:83
uint32_t rotated
Definition lv_hal_disp.h:98
lv_coord_t offset_x
Definition lv_hal_disp.h:87
void(* monitor_cb)(struct _lv_disp_drv_t *disp_drv, uint32_t time, uint32_t px)
Definition lv_hal_disp.h:123
uint32_t full_refresh
Definition lv_hal_disp.h:95
lv_coord_t physical_ver_res
Definition lv_hal_disp.h:85
lv_color_t color_chroma_key
Definition lv_hal_disp.h:141
void(* render_start_cb)(struct _lv_disp_drv_t *disp_drv)
Definition lv_hal_disp.h:137
Definition lv_hal_disp.h:158
uint8_t del_prev
Definition lv_hal_disp.h:179
uint8_t rendering_in_progress
Definition lv_hal_disp.h:180
struct _lv_obj_t ** screens
Definition lv_hal_disp.h:169
struct _lv_obj_t * sys_layer
Definition lv_hal_disp.h:174
uint32_t last_activity_time
Definition lv_hal_disp.h:193
lv_opa_t bg_opa
Definition lv_hal_disp.h:182
lv_color_t bg_color
Definition lv_hal_disp.h:183
lv_area_t inv_areas[LV_INV_BUF_SIZE]
Definition lv_hal_disp.h:187
const void * bg_img
Definition lv_hal_disp.h:184
uint8_t draw_prev_over_act
Definition lv_hal_disp.h:177
lv_timer_t * refr_timer
Definition lv_hal_disp.h:163
struct _lv_obj_t * scr_to_load
Definition lv_hal_disp.h:172
struct _lv_obj_t * act_scr
Definition lv_hal_disp.h:170
struct _lv_disp_drv_t * driver
Definition lv_hal_disp.h:160
struct _lv_obj_t * prev_scr
Definition lv_hal_disp.h:171
struct _lv_obj_t * top_layer
Definition lv_hal_disp.h:173
Definition lv_draw.h:59
Definition lv_obj.h:174
Definition lv_theme.h:31
Definition lv_timer.h:44
Definition lv_area.h:43