-
Notifications
You must be signed in to change notification settings - Fork 15
/
XInputPad.h
104 lines (90 loc) · 3.35 KB
/
XInputPad.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
99
100
101
102
103
/*
.k8GOGGNqkSFS5XkqXPSkSkkqXXFS5kSkSS15U22F2515U2uujuu1U1u2U1U2uUuFS.
:0qE JS5uuJuuFFX51jU2SSk12jU2SSXF5uuu15SFS5k12ujj21S5kFS5S12jJYu11
5XS: 1UYYLu. vUUX U22r SUF SUF ;YYLuU5
1F5i NNSkS7 2uLJui 51u S5. .PX .XX LJvLLu1.
kUk 0iLk5FFu vuYY2: 5F Xkk7 78 E0 i0 GEXPXk2uLLvLLuk
X25, 8O 2kX0 5YJUi M 555 PkXk i q1FU 7 ONNkP12YLvLvLYS
S25 8888 888 5uY5 FuS PS50 . FuUU 7 uJvLvLLJ2i
kUF SJjU. P02UF P25k . Su2Y v 2LLvLvLL17
S21 XJj88 0u 1uY2. X2k . k11E v 7;ii:JuJvLvLvJ2:
2257 jqv Pqq 1LJur PP. 7 EX: q OqqXP51JYvLvYYS.
X2F kXkXSXk kJYLU: O ,Z 0PXZ i ii q0 i:::,,.jLLvLLuF'
ik1k ;qkPj .uJvYu: UN : XU2F : S5S iJLLvjUF8
:PSq 72uLLLui uSi .; 2uY1 r. 72j1 LYYLYJSU88
XqE2 rP12juJuu1FX55U5FqXXSXkXF1juUkkPSXSPXPXPF1Jju5FkFSFXFSF5uujUu5j28V
.uGOZESS5S5SFkkPkPkXkPXqXPXqXXFkSkkPXPXPkqSkSS1521252121U2u2u12Suv7
*
* Arduino Micro (Leonardo) XInput Pad Emulator firmware
*
* Copyright (c) 2017
* Bruno Freitas - [email protected]
* Jon Wilson - [email protected]
* Kevin Mackett - [email protected]
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _XINPUTPAD_H_
#define _XINPUTPAD_H_
/* Includes: */
#include <avr/io.h>
#include <avr/wdt.h>
#include <avr/power.h>
#include <avr/interrupt.h>
#include <string.h>
#include "Descriptors.h"
#include <LUFA/Drivers/USB/USB.h>
/* Type Defines: */
/** Type define for the joystick HID report structure, for creating and sending HID reports to the host PC.
* This mirrors the layout described to the host in the HID report descriptor, in Descriptors.c.
*/
typedef struct {
uint8_t rid;
uint8_t rsize;
uint8_t digital_buttons_1;
uint8_t digital_buttons_2;
uint8_t lt;
uint8_t rt;
int l_x;
int l_y;
int r_x;
int r_y;
uint8_t reserved_1[6];
} USB_JoystickReport_Data_t;
extern USB_JoystickReport_Data_t gamepad_state;
/* Function Prototypes: */
void xbox_reset_pad_status(void);
void xbox_send_pad_state(void);
void xbox_reset_watchdog(void);
void xbox_init(bool watchdog);
void xbox_set_connect_callback(void (*callbackPtr)(void));
void xbox_set_disconnect_callback(void (*callbackPtr)(void));
// digital_buttons_1
#define XBOX_DPAD_UP 0x01
#define XBOX_DPAD_DOWN 0x02
#define XBOX_DPAD_LEFT 0x04
#define XBOX_DPAD_RIGHT 0x08
#define XBOX_START 0x10
#define XBOX_BACK 0x20
#define XBOX_LEFT_STICK 0x40
#define XBOX_RIGHT_STICK 0x80
// digital_buttons_2
#define XBOX_LB 0x01
#define XBOX_RB 0x02
#define XBOX_HOME 0x04
#define XBOX_A 0x10
#define XBOX_B 0x20
#define XBOX_X 0x40
#define XBOX_Y 0x80
#endif