-
Notifications
You must be signed in to change notification settings - Fork 1
/
controller_data.h
76 lines (65 loc) · 1.86 KB
/
controller_data.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
/*
* Copyright (C) 2019 Medusalix
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/*
* extracted pieces from here:
* https://github.com/360Controller/360Controller/blob/8dbc5dbd76ec42e039220238f743c2e82be0ad10/WirelessOneController/WirelessOneDongle.h
*/
#include <stdint.h>
#define PAIR_REQUEST 0x01
#define PAIR_RESPONSE 0x02
struct ControllerFrame
{
uint8_t command;
uint8_t message;
uint8_t sequence;
uint8_t length;
} __attribute__((packed));
struct LedModeData
{
uint8_t unknown;
uint8_t mode;
uint8_t brightness;
} __attribute__((packed));
struct Buttons
{
uint32_t unknown : 2;
uint32_t start : 1;
uint32_t back : 1;
uint32_t a : 1;
uint32_t b : 1;
uint32_t x : 1;
uint32_t y : 1;
uint32_t dpadUp : 1;
uint32_t dpadDown : 1;
uint32_t dpadLeft : 1;
uint32_t dpadRight : 1;
uint32_t bumperLeft : 1;
uint32_t bumperRight : 1;
uint32_t stickLeft : 1;
uint32_t stickRight : 1;
} __attribute__((packed));
struct InputData
{
Buttons buttons;
uint16_t triggerLeft;
uint16_t triggerRight;
int16_t stickLeftX;
int16_t stickLeftY;
int16_t stickRightX;
int16_t stickRightY;
} __attribute__((packed));