1 /*
2  * Copyright (C) 2015-2020 Alibaba Group Holding Limited
3  */
4 
5 #ifndef UDISPLAY_API_H
6 #define UDISPLAY_API_H
7 
8 #include <aos/kernel.h>
9 #include <stdbool.h>
10 #include <fb_define.h>
11 #include <string.h>
12 
13 /* Here is Macro and struct definition*/
14 typedef struct _udisplay_context_t {
15     uint8_t *framebuffer;
16     uint32_t framebuffer_size;
17     fb_var_screeninfo_t var;
18     int32_t fd;
19     uint8_t fb_id;
20     bool swap;
21     aos_mutex_t mutex;
22 } udisplay_context_t;
23 
24 #define FB_PATH  "/dev/fb0"
25 
26 #define UDISPLAY_STEP_DEBUG printf("[%s][%d]excute to here\n", \
27                                         __func__, __LINE__);
28 
29 
30 /** @defgroup udisplay_aos_api udisplay
31  * @{
32  */
33 
34 /**
35  * Init the udisplay module.
36  *
37  * @retrun 0 on success, otherwise will be failed.
38  */
39 int32_t udisplay_init(void);
40 
41 /**
42  * udisplay show rect function.
43  *
44  * @param[in]  buf           Graphic Framebuffer
45  * @param[in]  x             x coordinate
46  * @param[in]  y             y coordinate
47  * @param[in]  w             Graphic Wide
48  * @param[in]  h             Graphic High
49  * @param[in]  rotate        Rotate (set true or false, The rotation angle is determined by the drivers)
50  *
51  * @return  0 on success, negative error on failure.
52  */
53 int32_t udisplay_show_rect(uint8_t *buf, uint32_t x, \
54                     uint32_t y, uint32_t w, uint32_t h, bool rotate);
55 
56 
57 /**
58  * udispaly get framebuffer from drivers.
59  *
60  * @retrun buffer on success, otherwise will return NULL.
61  */
62 uint8_t *udisplay_get_framebuffer(void);
63 
64 /**
65  * udispaly show (the buffer get from udisplay_get_framebuffer function).
66  *
67  * @retrun 0 on success, otherwise will be failed.
68  */
69 int32_t udisplay_show(void);
70 
71 
72 /**
73  * udispaly set bright
74  * before it need enable backlight
75  * the framebuffer need get from drivers
76  *
77  * @param[in]  brightness             brightness value
78  *
79  * @retrun 0 on success, otherwise will be failed.
80  */
81 int32_t udisplay_set_brightness(int32_t brightness);
82 
83 /**
84  * udispaly get bright value
85  * before it need enable backlight
86  * the framebuffer need get from drivers
87  *
88  * @retrun bright value on success, otherwise will be failed.
89  */
90 int32_t udisplay_get_brightness(void);
91 
92 /**
93  * udispaly enable backlight
94  * the framebuffer need get from drivers
95  *
96  * @retrun bright value on success, otherwise will be failed.
97  */
98 int32_t udisplay_enable_backlight(void);
99 
100 /**
101  * udispaly disable backlight
102  * the framebuffer need get from drivers
103  *
104  * @retrun bright value on success, otherwise will be failed.
105  */
106 int32_t udisplay_disable_backlight(void);
107 
108 /**
109  * @}
110  */
111 
112 #endif
113 
114