hal_gfx_event.h
Go to the documentation of this file.
1 
2 /** @addtogroup GRAPHICS_SDK Graphics
3  * @{
4  */
5 
6 /** @defgroup HAL_GFX_EVENT hal_gfx_event
7  * @brief graphics event. Deprecated, Not suggessted to use
8  * @{
9  */
10 
11 #ifndef HAL_GFX_EVENT_H__
12 #define HAL_GFX_EVENT_H__
13 
14 #include "hal_gfx_sys_defs.h"
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 /**
21  * @defgroup HAL_GFX_BLENDER_MACRO Defines
22  * @{
23  */
24 
25 #define HAL_GFX_EVENT_HIDE_CURSOR (1 << 1) /**< hide cursor event */
26 /** @} */
27 
28 
29 /** @addtogroup HAL_GFX_EVENT_ENUM Enumerations
30  * @{
31  */
32 
33 /**
34  * @brief Mouse Event for Graphics
35  */
36 typedef enum {
37  MOUSE_EVENT_NONE = 0, /**< none event */
38  MOUSE_EVENT_LEFT_CLICK, /**< left click event */
39  MOUSE_EVENT_LEFT_RELEASE, /**< left release event */
40  MOUSE_EVENT_MIDDLE_CLICK, /**< middle click event */
41  MOUSE_EVENT_MIDDLE_RELEASE, /**< middle release event */
42  MOUSE_EVENT_RIGHT_CLICK, /**< right click event */
43  MOUSE_EVENT_RIGHT_RELEASE, /**< right release event */
44  MOUSE_EVENT_SCROLL_UP, /**< scroll up event */
45  MOUSE_EVENT_SCROLL_DOWN, /**< scroll down event */
46  MOUSE_EVENT_MAX /**< max event flag */
48 
49 /**
50  * @brief KeyBoard Event for Graphics
51  */
52 typedef enum {
59 
60 /**
61  * @brief Mouse State for Graphics
62  */
63 typedef enum {
69 
70 /** @} */
71 
72 /** @addtogroup HAL_GFX_EVENT_STRUCT Structure
73  * @{
74  */
75 
76 /**
77  * @brief Event Structure for Graphics
78  */
79 typedef struct {
80  int mouse_x; /**< x-coordinate for mouse */
81  int mouse_y; /**< y-coordinate for mouse */
82  int mouse_dx; /**< delta x-coordinate for mouse */
83  int mouse_dy; /**< delta y-coordinate for mouse */
84  int mouse_event; /**< mouse event */
85  int mouse_state; /**< mouse state */
86  int kb_event; /**< keyboard event */
87  char kb_key; /**< keyboard key value */
88  int timer_id; /**< timer id */
89  uint32_t timer_expirations; /**< expire time */
91 
92 /** @} */
93 
94 
95 /**
96  * @defgroup HAL_GFX_EVENT_FUNCTION Functions
97  * @{
98  */
99 
100 /**
101  *****************************************************************************************
102  * @brief event init function
103  *
104  * @param[in] flags: event flags
105  * @param[in] mouse_init_x: init x-coord for mouse
106  * @param[in] mouse_init_y: init y-coord for mouse
107  * @param[in] mouse_max_x: max x-coord for mouse
108  * @param[in] mouse_max_y: max y-coord for mouse
109  *
110  * @return init result
111  *****************************************************************************************
112  */
113 int hal_gfx_event_init(int flags, int mouse_init_x, int mouse_init_y, int mouse_max_x, int mouse_max_y);
114 
115 /**
116  *****************************************************************************************
117  * @brief wait event init function
118  *
119  * @param[in] event: point to event structure
120  * @param[in] block_until_event: block time till event happens
121  *
122  * @return wait result
123  *****************************************************************************************
124  */
125 int hal_gfx_event_wait(hal_gfx_event_t *event, int block_until_event);
126 
127 /**
128  *****************************************************************************************
129  * @brief force setting cursy to [x,y]
130  *
131  * @param[in] x: x-coord to set
132  * @param[in] y: y-coord to set
133  *
134  * @return none
135  *****************************************************************************************
136  */
137 void hal_gfx_event_force_cursor_xy(int x, int y);
138 
139 /**
140  *****************************************************************************************
141  * @brief Init triple framebuffer (Not USED)
142  *
143  * @param[in] layer: graphics layer to set
144  * @param[in] fb0_phys: layer0's phical address
145  * @param[in] fb1_phys: layer1's phical address
146  * @param[in] fb2_phys: layer2's phical address
147  *
148  * @return none
149  *****************************************************************************************
150  */
151 uintptr_t hal_gfx_init_triple_fb(int layer, uintptr_t fb0_phys, uintptr_t fb1_phys, uintptr_t fb2_phys);
152 
153 /**
154  *****************************************************************************************
155  * @brief Swap layer to current layer
156  *
157  * @param[in] layer: graphics layer to set
158  *
159  * @return layer's phical address
160  *****************************************************************************************
161  */
162 uintptr_t hal_gfx_swap_fb(int layer);
163 
164 /**
165  *****************************************************************************************
166  * @brief Create a timer, need to porting
167  *
168  * @return timer id
169  *****************************************************************************************
170  */
172 
173 /**
174  *****************************************************************************************
175  * @brief Destroy timer, need to porting
176  *
177  * @param[in] timer_id: timer id
178  *
179  * @return none
180  *****************************************************************************************
181  */
182 void hal_gfx_timer_destroy(int timer_id);
183 
184 /**
185  *****************************************************************************************
186  * @brief Set periodic timer, need to porting
187  *
188  * @param[in] timer_id: timer id
189  * @param[in] timeout_milisecs: periodic time
190  *
191  * @return 1 - successful; 0 -fail
192  *****************************************************************************************
193  */
194 int hal_gfx_timer_set_periodic(int timer_id, uint32_t timeout_milisecs);
195 
196 /**
197  *****************************************************************************************
198  * @brief Set one-shot timer, need to porting
199  *
200  * @param[in] timer_id: timer id
201  * @param[in] timeout_milisecs: timeout time
202  *
203  * @return 1 - successful; 0 -fail
204  *****************************************************************************************
205  */
206 int hal_gfx_timer_set_oneshot(int timer_id, uint32_t timeout_milisecs);
207 
208 /**
209  *****************************************************************************************
210  * @brief Stop timer, need to porting
211  *
212  * @param[in] timer_id: timer id
213  *
214  * @return none
215  *****************************************************************************************
216  */
217 void hal_gfx_timer_stop(int timer_id);
218 /** @} */
219 
220 #ifdef __cplusplus
221 }
222 #endif
223 
224 #endif //HAL_GFX_EVENT_H__
225 /** @} */
226 /** @} */
227 
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:64
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
Definition: hal_gfx_event.h:46
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:66
KB_EVENT_MAX
@ KB_EVENT_MAX
Definition: hal_gfx_event.h:57
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
Definition: hal_gfx_event.h:42
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
Definition: hal_gfx_event.h:84
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:53
MOUSE_EVENT_LEFT_RELEASE
@ MOUSE_EVENT_LEFT_RELEASE
Definition: hal_gfx_event.h:39
MOUSE_EVENT_SCROLL_DOWN
@ MOUSE_EVENT_SCROLL_DOWN
Definition: hal_gfx_event.h:45
hal_gfx_event_t::mouse_dx
int mouse_dx
Definition: hal_gfx_event.h:82
hal_gfx_event_t::timer_id
int timer_id
Definition: hal_gfx_event.h:88
hal_gfx_kb_event_t
hal_gfx_kb_event_t
KeyBoard Event for Graphics.
Definition: hal_gfx_event.h:52
hal_gfx_event_t::kb_key
char kb_key
Definition: hal_gfx_event.h:87
KB_EVENT_HOLD
@ KB_EVENT_HOLD
Definition: hal_gfx_event.h:55
hal_gfx_sys_defs.h
KB_EVENT_PRESS
@ KB_EVENT_PRESS
Definition: hal_gfx_event.h:54
hal_gfx_event_t
Event Structure for Graphics.
Definition: hal_gfx_event.h:79
hal_gfx_event_t::kb_event
int kb_event
Definition: hal_gfx_event.h:86
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
Definition: hal_gfx_event.h:41
MOUSE_STATE_RIGHT_CLICKED
@ MOUSE_STATE_RIGHT_CLICKED
Definition: hal_gfx_event.h:67
MOUSE_EVENT_NONE
@ MOUSE_EVENT_NONE
Definition: hal_gfx_event.h:37
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:36
KB_EVENT_RELEASE
@ KB_EVENT_RELEASE
Definition: hal_gfx_event.h:56
hal_gfx_event_t::mouse_dy
int mouse_dy
Definition: hal_gfx_event.h:83
MOUSE_EVENT_LEFT_CLICK
@ MOUSE_EVENT_LEFT_CLICK
Definition: hal_gfx_event.h:38
hal_gfx_event_t::timer_expirations
uint32_t timer_expirations
Definition: hal_gfx_event.h:89
hal_gfx_mouse_state_t
hal_gfx_mouse_state_t
Mouse State for Graphics.
Definition: hal_gfx_event.h:63
hal_gfx_event_t::mouse_x
int mouse_x
Definition: hal_gfx_event.h:80
MOUSE_EVENT_SCROLL_UP
@ MOUSE_EVENT_SCROLL_UP
Definition: hal_gfx_event.h:44
MOUSE_EVENT_RIGHT_RELEASE
@ MOUSE_EVENT_RIGHT_RELEASE
Definition: hal_gfx_event.h:43
MOUSE_EVENT_MIDDLE_CLICK
@ MOUSE_EVENT_MIDDLE_CLICK
Definition: hal_gfx_event.h:40
hal_gfx_event_t::mouse_state
int mouse_state
Definition: hal_gfx_event.h:85
hal_gfx_event_t::mouse_y
int mouse_y
Definition: hal_gfx_event.h:81
MOUSE_STATE_LEFT_CLICKED
@ MOUSE_STATE_LEFT_CLICKED
Definition: hal_gfx_event.h:65