-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmy_hid.h
98 lines (87 loc) · 2.3 KB
/
my_hid.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#ifndef MY_HID_H
#include <stdint.h>
typedef union {
int32_t val;
struct {
uint32_t a : 1; //1
uint32_t b : 1; //2
uint32_t sel : 1; //3
uint32_t strt : 1; //4
uint32_t d_right : 1; //5
uint32_t d_left : 1; //6
uint32_t d_up : 1; //7
uint32_t d_down : 1; //8
uint32_t r : 1; //9
uint32_t l : 1; //10
uint32_t x : 1; //11
uint32_t y : 1; //12
uint32_t gpio : 2; //14
uint32_t padding : 14; //28
uint32_t c_right : 1; //29
uint32_t c_left : 1; //30
uint32_t c_up : 1; //31
uint32_t c_down : 1; //32
};
} btn_t;
typedef union {
int32_t val;
struct {
int16_t x;
int16_t y;
};
} cp_t;
typedef struct {
btn_t curr;
btn_t pressed;
btn_t released;
cp_t cp;
} pad_t;
struct hid_pad_t {
uint64_t timestamp; // 0
uint64_t timestamp_last; // 8
uint32_t index; //10
uint32_t pad_14[2]; //14
btn_t btn_raw; //1c
cp_t cp_raw; //20
uint8_t pad_24; //24
pad_t pads[8];
};
struct touch_input_t {
int16_t x;
int16_t y;
};
typedef struct {
struct touch_input_t touch;
uint32_t updated;
} touch_t;
struct hid_touch_t {
uint64_t timestamp; // 0
uint64_t timestamp_last; // 8
uint32_t index; //10
uint32_t pad_14; //14
touch_t raw;
touch_t touches[8];
};
typedef struct {
struct hid_pad_t pad;
struct hid_touch_t touch;
} hid_mem_t;
typedef struct {
uint32_t field_00;
struct hid_pad_t* hid_pad;
uint32_t field_08;
struct hid_touch_t* hid_touch;
uint32_t field_10;
uint32_t* hid_accl; //need to add
uint32_t field_18;
uint32_t field_1c;
uint32_t* hid_gyro; //need to add
uint32_t field_24;
uint32_t* hid_debug; //might add
uint32_t mappable_mem_chunk[4];//need to add
uint32_t bool_3c;
uint32_t hid_handle;
uint32_t bool_44;
} hid_ctx_t;
#define MY_HID_H
#endif