-
Notifications
You must be signed in to change notification settings - Fork 9
/
constants.js
114 lines (107 loc) · 2.11 KB
/
constants.js
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
// Various constants used by the Loupedeck firmware
const BUTTONS = {
0x00: 'knobCT',
0x01: 'knobTL',
0x02: 'knobCL',
0x03: 'knobBL',
0x04: 'knobTR',
0x05: 'knobCR',
0x06: 'knobBR',
0x07: 0,
0x08: 1,
0x09: 2,
0x0a: 3,
0x0b: 4,
0x0c: 5,
0x0d: 6,
0x0e: 7,
0x0f: 'home',
0x10: 'undo',
0x11: 'keyboard',
0x12: 'enter',
0x13: 'save',
0x14: 'fnL',
0x15: 'a',
0x16: 'c',
0x17: 'fnR',
0x18: 'b',
0x19: 'd',
0x1a: 'e',
// Below seem to be used only on the Razer Stream Controller X
0x1b: 0,
0x1c: 1,
0x1d: 2,
0x1e: 3,
0x1f: 4,
0x20: 5,
0x21: 6,
0x22: 7,
0x23: 8,
0x24: 9,
0x25: 10,
0x26: 11,
0x27: 12,
0x28: 13,
0x29: 14,
}
// How long without ticks until a connection is considered "timed out"
const CONNECTION_TIMEOUT = 3000
const COMMANDS = {
BUTTON_PRESS: 0x00,
KNOB_ROTATE: 0x01,
SET_COLOR: 0x02,
SERIAL: 0x03,
RESET: 0x06,
VERSION: 0x07,
SET_BRIGHTNESS: 0x09,
FRAMEBUFF: 0x10,
SET_VIBRATION: 0x1b,
MCU: 0x0d,
DRAW: 0x0f,
TOUCH: 0x4d,
TOUCH_CT: 0x52,
TOUCH_END: 0x6d,
TOUCH_END_CT: 0x72,
}
// How long until trying to reconnect after a disconnect
const DEFAULT_RECONNECT_INTERVAL = 3000
const HAPTIC = {
SHORT: 0x01,
MEDIUM: 0x0a,
LONG: 0x0f,
LOW: 0x31,
SHORT_LOW: 0x32,
SHORT_LOWER: 0x33,
LOWER: 0x40,
LOWEST: 0x41,
DESCEND_SLOW: 0x46,
DESCEND_MED: 0x47,
DESCEND_FAST: 0x48,
ASCEND_SLOW: 0x52,
ASCEND_MED: 0x53,
ASCEND_FAST: 0x58,
REV_SLOWEST: 0x5e,
REV_SLOW: 0x5f,
REV_MED: 0x60,
REV_FAST: 0x61,
REV_FASTER: 0x62,
REV_FASTEST: 0x63,
RISE_FALL: 0x6a,
BUZZ: 0x70,
RUMBLE5: 0x77, // lower frequencies in descending order
RUMBLE4: 0x78,
RUMBLE3: 0x79,
RUMBLE2: 0x7a,
RUMBLE1: 0x7b,
VERY_LONG: 0x76, // 10 sec high freq (!)
}
// Maximum brightness value
const MAX_BRIGHTNESS = 10
module.exports = {
MAX_BRIGHTNESS,
BUTTONS,
COMMANDS,
CONNECTION_TIMEOUT,
DEFAULT_RECONNECT_INTERVAL,
HAPTIC,
}