VSF Documented
vsf_input_touchscreen.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2022 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
15 * *
16 ****************************************************************************/
17
18
19
20#ifndef __VSF_INPUT_TOUCHSCREEN_H__
21#define __VSF_INPUT_TOUCHSCREEN_H__
22
23/*============================ INCLUDES ======================================*/
24#include "../vsf_input_cfg.h"
25
26#include "../vsf_input_get_type.h"
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32/*============================ MACROS ========================================*/
33/*============================ MACROFIED FUNCTIONS ===========================*/
34
35// prototype: vsf_input_touchscreen_set(vk_touchscreen_evt_t *evt, uint8_t id,
36// bool is_done, uint16_t x, uint16_t y, uint16_t pressure);
37#define vsf_input_touchscreen_set(__evt, __id, __is_down, __pressure, __x, __y) \
38 do { \
39 (__evt)->id = ((__id) | (!!(__is_down) << 8)); \
40 (__evt)->cur.valu64 = (__x) | ((__y) << 16) | ((uint64_t)(__pressure) << 32);\
41 } while (0)
42
43#define vsf_input_touchscreen_get_id(__evt) \
44 ((uint8_t)(((__evt)->id >> 0) & 0xFF))
45#define vsf_input_touchscreen_is_down(__evt) \
46 (!!(((__evt)->id >> 8) & 0xFF))
47#define vsf_input_touchscreen_get_x(__evt) \
48 ((uint16_t)(((__evt)->cur.valu64 >> 0) & 0xFFFF))
49#define vsf_input_touchscreen_get_y(__evt) \
50 ((uint16_t)(((__evt)->cur.valu64 >> 16) & 0xFFFF))
51#define vsf_input_touchscreen_get_pressure(__evt) \
52 ((uint16_t)(((__evt)->cur.valu64 >> 32) & 0xFFFF))
53
54/*============================ TYPES =========================================*/
55
56enum {
58};
59
60typedef struct vk_touchscreen_info_t {
64
65typedef struct vk_touchscreen_evt_t {
66 implement(vk_input_evt_t)
69
70/*============================ GLOBAL VARIABLES ==============================*/
71/*============================ LOCAL VARIABLES ===============================*/
72/*============================ PROTOTYPES ====================================*/
73
74#ifdef __cplusplus
75}
76#endif
77
78#endif
79/* EOF */
unsigned short uint16_t
Definition stdint.h:7
Definition vsf_input.h:94
Definition vsf_input_touchscreen.h:65
vk_input_evt_t vk_touchscreen_info_t info
Definition vsf_input_touchscreen.h:67
Definition vsf_input_touchscreen.h:60
uint16_t width
Definition vsf_input_touchscreen.h:61
uint16_t height
Definition vsf_input_touchscreen.h:62
#define VSF_INPUT_USER_TYPE
Definition vsf_input_get_type_1bit.h:103
@ VSF_INPUT_TYPE_TOUCHSCREEN
Definition vsf_input_touchscreen.h:57