VSF Documented
vsf_input_sensor.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_SENSOR_H__
21#define __VSF_INPUT_SENSOR_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
34#define vsf_input_sensor_set(__event, __type, __subtype, __min, __max, __res, __value)\
35 do { \
36 (__event)->id = ((uint64_t)(__type) << 0) | ((uint64_t)(__subtype) << 32);\
37 (__event)->info.minimum = (__min); \
38 (__event)->info.maximum = (__max); \
39 (__event)->info.resolution = (__res); \
40 (__event)->cur.val64 = (__value); \
41 } while (0)
42
43#define vsf_input_sensor_get_type(__event) \
44 ((vk_sensor_type_t)(((__event)->id >> 0) & 0xFFFFFFFF))
45#define vsf_input_sensor_get_subtype(__event) \
46 ((vk_sensor_subtype_t)(((__event)->id >> 32) & 0xFFFFFFFF))
47
48/*============================ MACROFIED FUNCTIONS ===========================*/
49/*============================ TYPES =========================================*/
50
51enum {
53};
54
55typedef enum vk_sensor_type_t {
59
62
63typedef enum vk_sensor_subtype_t {
67
71
74
75typedef struct vk_sensor_info_t {
80
81typedef struct vk_sensor_evt_t {
82 implement(vk_input_evt_t)
85
86/*============================ GLOBAL VARIABLES ==============================*/
87/*============================ LOCAL VARIABLES ===============================*/
88/*============================ PROTOTYPES ====================================*/
89
90#ifdef __cplusplus
91}
92#endif
93
94#endif
95/* EOF */
unsigned uint32_t
Definition stdint.h:9
int int32_t
Definition stdint.h:8
Definition vsf_input.h:94
Definition vsf_input_sensor.h:81
vk_input_evt_t vk_sensor_info_t info
Definition vsf_input_sensor.h:83
Definition vsf_input_sensor.h:75
int32_t maximum
Definition vsf_input_sensor.h:77
uint32_t resolution
Definition vsf_input_sensor.h:78
int32_t minimum
Definition vsf_input_sensor.h:76
#define VSF_INPUT_USER_TYPE
Definition vsf_input_get_type_1bit.h:103
vk_sensor_subtype_t
Definition vsf_input_sensor.h:63
@ SENSOR_SUBTYPE_ROLL
Definition vsf_input_sensor.h:70
@ SENSOR_SUBTYPE_PITCH
Definition vsf_input_sensor.h:68
@ SENSOR_SUBTYPE_YAW
Definition vsf_input_sensor.h:69
@ SENSOR_SUBTYPE_X
Definition vsf_input_sensor.h:64
@ SENSOR_SUBTYPE_USER
Definition vsf_input_sensor.h:72
@ SENSOR_SUBTYPE_Z
Definition vsf_input_sensor.h:66
@ SENSOR_SUBTYPE_Y
Definition vsf_input_sensor.h:65
vk_sensor_type_t
Definition vsf_input_sensor.h:55
@ SENSOR_TYPE_ACC
Definition vsf_input_sensor.h:56
@ SENSOR_TYPE_GYRO
Definition vsf_input_sensor.h:57
@ SENSOR_TYPE_USER
Definition vsf_input_sensor.h:60
@ SENSOR_TYPE_MAG
Definition vsf_input_sensor.h:58
@ VSF_INPUT_TYPE_SENSOR
Definition vsf_input_sensor.h:52