-
Notifications
You must be signed in to change notification settings - Fork 1
/
commons.h
72 lines (66 loc) · 1.59 KB
/
commons.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
#pragma once
// --- Module ID Type ---
typedef enum {
DISCONNECTED = 0,
ERROR_STATE,
BUTTON_MAINTAINED, // DIN
BUTTON_MOMENTARY, // DIN
XYAB, // DIN x4
DPAD, // DIN x4
JOYSTICK, // AIN x2 Prefers X/Y, Z/RX
SLIDER, // AIN Prefers Slider0/Slider1
TWIST_SWITCH, // AIN Prefers Ry/Rz
ACCEL, // AIN x3 Prefers XYZ/RxRyRz
GYRO, // AIN x3 Prefers XYZ/RxRyRz
LED // DOUT
} moduleID_t;
// --- HID Gamepad Axis Flags ---
// typedef enum {
// NONE = 0,
// X = 1,
// Y = 1 << 1,
// Z = 1 << 2,
// RX = 1 << 3,
// RY = 1 << 4,
// RZ = 1 << 5,
// SLIDER0 = 1 << 6,
// SLIDER1 = 1 << 7
// } axis_flags_t;
// --- HID Gamepad Axis Indices (Must Match HID Report) ---
typedef enum {
X = 0,
Y,
Z,
RX,
RY,
RZ,
SLIDER0,
SLIDER1
} axis_idx_t;
// --- HID Gamepad Button Indices (Must Match HID Report) ---
typedef uint8_t button_idx_t;
typedef struct {
axis_idx_t axis0;
axis_idx_t axis1;
button_idx_t button0;
button_idx_t button1;
button_idx_t button2;
button_idx_t button3;
uint8_t report_num;
} assigned_t;
// --- Module String Descriptors ---
const char module_names[][25] =
{
"DISCONNECTED",
"ERROR STATE",
"BUTTON MAINTAINED MODULE",
"BUTTON MOMENTARY MODULE",
"XYAB MODULE",
"DPAD MODULE",
"JOYSTICK MODULE",
"SLIDER MODULE",
"TWIST SWITCH MODULE",
"ACCELEROMETER MODULE",
"GYROSCOPE MODULE",
"LED MODULE"
};