-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotes.txt
115 lines (90 loc) · 2.78 KB
/
notes.txt
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<Buffer 80 80 80 80 00 00>
data[4] =
state['button:1'] = data[4] >> 4 & 1; //16
state['button:2'] = data[4] >> 5 & 1; //32
state['button:3'] = data[4] >> 6 & 1; //64
state['button:4'] = data[4] >> 7 & 1; //128
state['button:L1'] = data[5] >> 0 & 1; //1
state['button:R1'] = data[5] >> 1 & 1; //2
state['button:L2'] = data[5] >> 2 & 1; //4
state['button:R2'] = data[5] >> 4 & 1; //8
state['button:Start'] = data[5] >> 5 & 1; //32 0x20
state['button:Select'] = data[5] >> 4 & 1; //16 0x10
state['axis:LY'] = data[1];
state['axis:LX'] = data[0];
state['axis:RY'] = data[2];
state['axis:RX'] = data[3];
state["button:Up"] = +(data[4] === 1;
state["button:Right"] = +(data[4] === 3);
state["button:Down"] = +(data[4] === 5);
state["button:Left"] = +(data[4] === 7);
"jesstech": {
"vendorId": 3888,
"productId": 263,
"state": {
"button:1": 0,
"button:2": 0,
"button:3": 0,
"button:4": 0,
"button:L1": 0,
"button:R1": 0,
"button:L2": 0,
"button:R2": 0,
"axis:LY": 0,
"axis:LX": 0,
"axis:RY": 0,
"axis:RX": 0,
"button:Up": 0,
"button:Right": 0,
"button:Down": 0,
"button:Left": 0,
"button:Start": 0,
"button:Select": 0
},
"prev": {// Simple copy of state
"button:1": 0,
"button:2": 0,
"button:3": 0,
"button:4": 0,
"button:L1": 0,
"button:R1": 0,
"button:L2": 0,
"button:R2": 0,
"axis:LY": 0,
"axis:LX": 0,
"axis:RY": 0,
"axis:RX": 0,
"button:Up": 0,
"button:Right": 0,
"button:Down": 0,
"button:Left": 0,
"button:Start": 0,
"button:Select": 0
},
"update": function(data) {
var state = this.state;
state['button:1'] = data[4] >> 4 & 1; //16
state['button:2'] = data[4] >> 5 & 1; //32
state['button:3'] = data[4] >> 6 & 1; //64
state['button:4'] = data[4] >> 7 & 1; //128
state['button:L1'] = data[5] >> 0 & 1; //1
state['button:R1'] = data[5] >> 1 & 1; //2
state['button:L2'] = data[5] >> 2 & 1; //4
state['button:R2'] = data[5] >> 4 & 1; //8
state['button:Start'] = data[5] >> 5 & 1; //32 0x20
state['button:Select'] = data[5] >> 4 & 1; //16 0x10
state['axis:LY'] = data[1];
state['axis:LX'] = data[0];
state['axis:RY'] = data[2];
state['axis:RX'] = data[3];
state["button:Up"] = +(data[4] === 1;
state["button:Right"] = +(data[4] === 3);
state["button:Down"] = +(data[4] === 5);
state["button:Left"] = +(data[4] === 7);
return state;
},
"setRumble": function() {
},
"setLED": function(led, val) {
}
},