hal_gfx_event.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file hal_gfx_event.h
5 * @author BLE Driver Team
6 * @brief Header file containing functions prototypes of Graphics library.
7 *
8 ****************************************************************************************
9 * @attention
10 #####Copyright (c) 2019 GOODIX
11 All rights reserved.
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
15 * Redistributions of source code must retain the above copyright
16 notice, this list of conditions and the following disclaimer.
17 * Redistributions in binary form must reproduce the above copyright
18 notice, this list of conditions and the following disclaimer in the
19 documentation and/or other materials provided with the distribution.
20 * Neither the name of GOODIX nor the names of its contributors may be used
21 to endorse or promote products derived from this software without
22 specific prior written permission.
23
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 POSSIBILITY OF SUCH DAMAGE.
35 ****************************************************************************************
36 */
37
38 /** @addtogroup GRAPHICS_SDK Graphics
39 * @{
40 */
41
42 /** @addtogroup HAL_GFX HAL GFX
43 * @{
44 */
45
46 /** @defgroup HAL_GFX_EVENT GFX EVENT
47 * @brief graphics event. Deprecated, Not suggessted to use
48 * @{
49 */
50
51 #ifndef HAL_GFX_EVENT_H__
52 #define HAL_GFX_EVENT_H__
53
54 #include "hal_gfx_sys_defs.h"
55
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59
60 /**
61 * @defgroup HAL_GFX_EVENT_MACRO Defines
62 * @{
63 */
64
65 #define HAL_GFX_EVENT_HIDE_CURSOR (1 << 1) /**< hide cursor event */
66 /** @} */
67
68
69 /** @addtogroup HAL_GFX_EVENT_ENUM Enumerations
70 * @{
71 */
72
73 /**
74 * @brief Mouse Event for Graphics
75 */
76 typedef enum {
77 MOUSE_EVENT_NONE = 0, /**< none event */
78 MOUSE_EVENT_LEFT_CLICK, /**< left click event */
79 MOUSE_EVENT_LEFT_RELEASE, /**< left release event */
80 MOUSE_EVENT_MIDDLE_CLICK, /**< middle click event */
81 MOUSE_EVENT_MIDDLE_RELEASE, /**< middle release event */
82 MOUSE_EVENT_RIGHT_CLICK, /**< right click event */
83 MOUSE_EVENT_RIGHT_RELEASE, /**< right release event */
84 MOUSE_EVENT_SCROLL_UP, /**< scroll up event */
85 MOUSE_EVENT_SCROLL_DOWN, /**< scroll down event */
86 MOUSE_EVENT_MAX /**< max event flag */
87 } hal_gfx_mouse_event_t;
88
89 /**
90 * @brief KeyBoard Event for Graphics
91 */
92 typedef enum {
93 KB_EVENT_NONE = 0,
94 KB_EVENT_PRESS,
95 KB_EVENT_HOLD,
96 KB_EVENT_RELEASE,
97 KB_EVENT_MAX
98 } hal_gfx_kb_event_t;
99
100 /**
101 * @brief Mouse State for Graphics
102 */
103 typedef enum {
104 MOUSE_STATE_NONE = 0,
105 MOUSE_STATE_LEFT_CLICKED = 1,
106 MOUSE_STATE_MIDDLE_CLICKED = 1U<<1,
107 MOUSE_STATE_RIGHT_CLICKED = 1U<<2
108 } hal_gfx_mouse_state_t;
109
110 /** @} */
111
112 /** @addtogroup HAL_GFX_EVENT_STRUCT Structure
113 * @{
114 */
115
116 /**
117 * @brief Event Structure for Graphics
118 */
119 typedef struct {
120 int mouse_x; /**< x-coordinate for mouse */
121 int mouse_y; /**< y-coordinate for mouse */
122 int mouse_dx; /**< delta x-coordinate for mouse */
123 int mouse_dy; /**< delta y-coordinate for mouse */
124 int mouse_event; /**< mouse event */
125 int mouse_state; /**< mouse state */
126 int kb_event; /**< keyboard event */
127 char kb_key; /**< keyboard key value */
128 int timer_id; /**< timer id */
129 uint32_t timer_expirations; /**< expire time */
130 } hal_gfx_event_t;
131
132 /** @} */
133
134
135 /**
136 * @defgroup HAL_GFX_EVENT_FUNCTION Functions
137 * @{
138 */
139
140 /**
141 *****************************************************************************************
142 * @brief event init function
143 *
144 * @param[in] flags: event flags
145 * @param[in] mouse_init_x: init x-coord for mouse
146 * @param[in] mouse_init_y: init y-coord for mouse
147 * @param[in] mouse_max_x: max x-coord for mouse
148 * @param[in] mouse_max_y: max y-coord for mouse
149 *
150 * @return init result
151 *****************************************************************************************
152 */
153 int hal_gfx_event_init(int flags, int mouse_init_x, int mouse_init_y, int mouse_max_x, int mouse_max_y);
154
155 /**
156 *****************************************************************************************
157 * @brief wait event init function
158 *
159 * @param[in] event: point to event structure
160 * @param[in] block_until_event: block time till event happens
161 *
162 * @return wait result
163 *****************************************************************************************
164 */
165 int hal_gfx_event_wait(hal_gfx_event_t *event, int block_until_event);
166
167 /**
168 *****************************************************************************************
169 * @brief force setting cursy to [x,y]
170 *
171 * @param[in] x: x-coord to set
172 * @param[in] y: y-coord to set
173 *
174 * @return none
175 *****************************************************************************************
176 */
177 void hal_gfx_event_force_cursor_xy(int x, int y);
178
179 /**
180 *****************************************************************************************
181 * @brief Init triple framebuffer (Not USED)
182 *
183 * @param[in] layer: graphics layer to set
184 * @param[in] fb0_phys: layer0's phical address
185 * @param[in] fb1_phys: layer1's phical address
186 * @param[in] fb2_phys: layer2's phical address
187 *
188 * @return none
189 *****************************************************************************************
190 */
191 uintptr_t hal_gfx_init_triple_fb(int layer, uintptr_t fb0_phys, uintptr_t fb1_phys, uintptr_t fb2_phys);
192
193 /**
194 *****************************************************************************************
195 * @brief Swap layer to current layer
196 *
197 * @param[in] layer: graphics layer to set
198 *
199 * @return layer's phical address
200 *****************************************************************************************
201 */
202 uintptr_t hal_gfx_swap_fb(int layer);
203
204 /**
205 *****************************************************************************************
206 * @brief Create a timer, need to porting
207 *
208 * @return timer id
209 *****************************************************************************************
210 */
211 int hal_gfx_timer_create(void);
212
213 /**
214 *****************************************************************************************
215 * @brief Destroy timer, need to porting
216 *
217 * @param[in] timer_id: timer id
218 *
219 * @return none
220 *****************************************************************************************
221 */
222 void hal_gfx_timer_destroy(int timer_id);
223
224 /**
225 *****************************************************************************************
226 * @brief Set periodic timer, need to porting
227 *
228 * @param[in] timer_id: timer id
229 * @param[in] timeout_milisecs: periodic time
230 *
231 * @return 1 - successful; 0 -fail
232 *****************************************************************************************
233 */
234 int hal_gfx_timer_set_periodic(int timer_id, uint32_t timeout_milisecs);
235
236 /**
237 *****************************************************************************************
238 * @brief Set one-shot timer, need to porting
239 *
240 * @param[in] timer_id: timer id
241 * @param[in] timeout_milisecs: timeout time
242 *
243 * @return 1 - successful; 0 -fail
244 *****************************************************************************************
245 */
246 int hal_gfx_timer_set_oneshot(int timer_id, uint32_t timeout_milisecs);
247
248 /**
249 *****************************************************************************************
250 * @brief Stop timer, need to porting
251 *
252 * @param[in] timer_id: timer id
253 *
254 * @return none
255 *****************************************************************************************
256 */
257 void hal_gfx_timer_stop(int timer_id);
258 /** @} */
259
260 #ifdef __cplusplus
261 }
262 #endif
263
264 #endif //HAL_GFX_EVENT_H__
265 /** @} */
266 /** @} */
267 /** @} */
268
hal_gfx_timer_destroy
void hal_gfx_timer_destroy(int timer_id)
Destroy timer, need to porting.
hal_gfx_event_init
int hal_gfx_event_init(int flags, int mouse_init_x, int mouse_init_y, int mouse_max_x, int mouse_max_y)
event init function
MOUSE_STATE_NONE
@ MOUSE_STATE_NONE
Definition: hal_gfx_event.h:104
hal_gfx_event_force_cursor_xy
void hal_gfx_event_force_cursor_xy(int x, int y)
force setting cursy to [x,y]
MOUSE_EVENT_MAX
@ MOUSE_EVENT_MAX
max event flag
Definition: hal_gfx_event.h:86
hal_gfx_init_triple_fb
uintptr_t hal_gfx_init_triple_fb(int layer, uintptr_t fb0_phys, uintptr_t fb1_phys, uintptr_t fb2_phys)
Init triple framebuffer (Not USED)
MOUSE_STATE_MIDDLE_CLICKED
@ MOUSE_STATE_MIDDLE_CLICKED
Definition: hal_gfx_event.h:106
KB_EVENT_MAX
@ KB_EVENT_MAX
Definition: hal_gfx_event.h:97
hal_gfx_swap_fb
uintptr_t hal_gfx_swap_fb(int layer)
Swap layer to current layer.
MOUSE_EVENT_RIGHT_CLICK
@ MOUSE_EVENT_RIGHT_CLICK
right click event
Definition: hal_gfx_event.h:82
hal_gfx_timer_stop
void hal_gfx_timer_stop(int timer_id)
Stop timer, need to porting.
hal_gfx_event_t::mouse_event
int mouse_event
mouse event
Definition: hal_gfx_event.h:124
hal_gfx_timer_create
int hal_gfx_timer_create(void)
Create a timer, need to porting.
KB_EVENT_NONE
@ KB_EVENT_NONE
Definition: hal_gfx_event.h:93
MOUSE_EVENT_LEFT_RELEASE
@ MOUSE_EVENT_LEFT_RELEASE
left release event
Definition: hal_gfx_event.h:79
MOUSE_EVENT_SCROLL_DOWN
@ MOUSE_EVENT_SCROLL_DOWN
scroll down event
Definition: hal_gfx_event.h:85
hal_gfx_event_t::mouse_dx
int mouse_dx
delta x-coordinate for mouse
Definition: hal_gfx_event.h:122
hal_gfx_event_t::timer_id
int timer_id
timer id
Definition: hal_gfx_event.h:128
hal_gfx_kb_event_t
hal_gfx_kb_event_t
KeyBoard Event for Graphics.
Definition: hal_gfx_event.h:92
hal_gfx_event_t::kb_key
char kb_key
keyboard key value
Definition: hal_gfx_event.h:127
KB_EVENT_HOLD
@ KB_EVENT_HOLD
Definition: hal_gfx_event.h:95
hal_gfx_sys_defs.h
KB_EVENT_PRESS
@ KB_EVENT_PRESS
Definition: hal_gfx_event.h:94
hal_gfx_event_t
Event Structure for Graphics.
Definition: hal_gfx_event.h:119
hal_gfx_event_t::kb_event
int kb_event
keyboard event
Definition: hal_gfx_event.h:126
hal_gfx_timer_set_periodic
int hal_gfx_timer_set_periodic(int timer_id, uint32_t timeout_milisecs)
Set periodic timer, need to porting.
MOUSE_EVENT_MIDDLE_RELEASE
@ MOUSE_EVENT_MIDDLE_RELEASE
middle release event
Definition: hal_gfx_event.h:81
MOUSE_STATE_RIGHT_CLICKED
@ MOUSE_STATE_RIGHT_CLICKED
Definition: hal_gfx_event.h:107
MOUSE_EVENT_NONE
@ MOUSE_EVENT_NONE
none event
Definition: hal_gfx_event.h:77
hal_gfx_timer_set_oneshot
int hal_gfx_timer_set_oneshot(int timer_id, uint32_t timeout_milisecs)
Set one-shot timer, need to porting.
hal_gfx_event_wait
int hal_gfx_event_wait(hal_gfx_event_t *event, int block_until_event)
wait event init function
hal_gfx_mouse_event_t
hal_gfx_mouse_event_t
Mouse Event for Graphics.
Definition: hal_gfx_event.h:76
KB_EVENT_RELEASE
@ KB_EVENT_RELEASE
Definition: hal_gfx_event.h:96
hal_gfx_event_t::mouse_dy
int mouse_dy
delta y-coordinate for mouse
Definition: hal_gfx_event.h:123
MOUSE_EVENT_LEFT_CLICK
@ MOUSE_EVENT_LEFT_CLICK
left click event
Definition: hal_gfx_event.h:78
hal_gfx_event_t::timer_expirations
uint32_t timer_expirations
expire time
Definition: hal_gfx_event.h:129
hal_gfx_mouse_state_t
hal_gfx_mouse_state_t
Mouse State for Graphics.
Definition: hal_gfx_event.h:103
hal_gfx_event_t::mouse_x
int mouse_x
x-coordinate for mouse
Definition: hal_gfx_event.h:120
MOUSE_EVENT_SCROLL_UP
@ MOUSE_EVENT_SCROLL_UP
scroll up event
Definition: hal_gfx_event.h:84
MOUSE_EVENT_RIGHT_RELEASE
@ MOUSE_EVENT_RIGHT_RELEASE
right release event
Definition: hal_gfx_event.h:83
MOUSE_EVENT_MIDDLE_CLICK
@ MOUSE_EVENT_MIDDLE_CLICK
middle click event
Definition: hal_gfx_event.h:80
hal_gfx_event_t::mouse_state
int mouse_state
mouse state
Definition: hal_gfx_event.h:125
hal_gfx_event_t::mouse_y
int mouse_y
y-coordinate for mouse
Definition: hal_gfx_event.h:121
MOUSE_STATE_LEFT_CLICKED
@ MOUSE_STATE_LEFT_CLICKED
Definition: hal_gfx_event.h:105