Gamepad fix
This commit is contained in:
parent
6dd1158ec2
commit
a1120f9a32
8 changed files with 167 additions and 161 deletions
40
Gamepad.h
40
Gamepad.h
|
|
@ -37,6 +37,16 @@ void HID_SendReport(uint8_t id, const void* data, int len);
|
|||
// Gamepad
|
||||
//================================================================================
|
||||
|
||||
#define GAMEPAD_DPAD_CENTERED 0
|
||||
#define GAMEPAD_DPAD_UP 1
|
||||
#define GAMEPAD_DPAD_UP_RIGHT 2
|
||||
#define GAMEPAD_DPAD_RIGHT 3
|
||||
#define GAMEPAD_DPAD_DOWN_RIGHT 4
|
||||
#define GAMEPAD_DPAD_DOWN 5
|
||||
#define GAMEPAD_DPAD_DOWN_LEFT 6
|
||||
#define GAMEPAD_DPAD_LEFT 7
|
||||
#define GAMEPAD_DPAD_UP_LEFT 8
|
||||
|
||||
class Gamepad{
|
||||
public:
|
||||
inline Gamepad(uint8_t num){
|
||||
|
|
@ -45,14 +55,14 @@ public:
|
|||
_reportID = HID_REPORTID_Gamepad1Report;
|
||||
break;
|
||||
case 2:
|
||||
_reportID = HID_REPORTID_Gamepad1Report;
|
||||
break;
|
||||
case 3:
|
||||
_reportID = HID_REPORTID_Gamepad1Report;
|
||||
break;
|
||||
case 4:
|
||||
_reportID = HID_REPORTID_Gamepad1Report;
|
||||
_reportID = HID_REPORTID_Gamepad2Report;
|
||||
break;
|
||||
//case 3:
|
||||
// _reportID = HID_REPORTID_Gamepad3Report;
|
||||
// break;
|
||||
//case 4:
|
||||
// _reportID = HID_REPORTID_Gamepad4Report;
|
||||
// break;
|
||||
default:
|
||||
_reportID = HID_REPORTID_NotAReport;
|
||||
break;
|
||||
|
|
@ -71,14 +81,14 @@ public:
|
|||
inline void releaseAll(void){ _report.buttons = 0;}
|
||||
|
||||
inline void buttons(uint32_t b){ _report.buttons = b; }
|
||||
inline void xAxis(uint16_t a){ _report.xAxis = a; }
|
||||
inline void yAxis(uint16_t a){ _report.yAxis = a; }
|
||||
inline void zAxis(uint8_t a){ _report.zAxis = a; }
|
||||
inline void rxAxis(uint16_t a){ _report.rxAxis = a; }
|
||||
inline void ryAxis(uint16_t a){ _report.ryAxis = a; }
|
||||
inline void rzAxis(uint8_t a){ _report.rzAxis = a; }
|
||||
inline void dPad1(uint8_t d){ _report.dPad1 = d; }
|
||||
inline void dPad2(uint8_t d){ _report.dPad2 = d; }
|
||||
inline void xAxis(int16_t a){ _report.xAxis = a; }
|
||||
inline void yAxis(int16_t a){ _report.yAxis = a; }
|
||||
inline void zAxis(int8_t a){ _report.zAxis = a; }
|
||||
inline void rxAxis(int16_t a){ _report.rxAxis = a; }
|
||||
inline void ryAxis(int16_t a){ _report.ryAxis = a; }
|
||||
inline void rzAxis(int8_t a){ _report.rzAxis = a; }
|
||||
inline void dPad1(int8_t d){ _report.dPad1 = d; }
|
||||
inline void dPad2(int8_t d){ _report.dPad2 = d; }
|
||||
private:
|
||||
HID_GamepadReport_Data_t _report;
|
||||
uint8_t _reportID;
|
||||
|
|
|
|||
3
HID.cpp
3
HID.cpp
|
|
@ -73,6 +73,9 @@ void HID_SendReport(uint8_t id, const void* data, int len)
|
|||
// valid HID reports start at Address 2
|
||||
NHPwriteChecksum(2 + i / 2, (data1 << 8) | data0);
|
||||
}
|
||||
#ifdef HID_EXTRADELAY
|
||||
delay(HID_EXTRADELAY);
|
||||
#endif
|
||||
}
|
||||
|
||||
// simple copy/modification of the NicoHoodProtocol writechecksum function
|
||||
|
|
|
|||
3
HID.h
3
HID.h
|
|
@ -51,6 +51,9 @@ THE SOFTWARE.
|
|||
//#define HID_JOYSTICK1_ENABLE 51
|
||||
//#define HID_JOYSTICK2_ENABLE 51
|
||||
|
||||
// extra delay for raspberry. Only needed for Hoodloader and slow devices
|
||||
//#define HID_EXTRADELAY 20
|
||||
|
||||
//================================================================================
|
||||
// NHP
|
||||
//================================================================================
|
||||
|
|
|
|||
135
HID_Reports.h
135
HID_Reports.h
|
|
@ -43,12 +43,12 @@ THE SOFTWARE.
|
|||
typedef union{
|
||||
// mouse report: 5 buttons, position, wheel
|
||||
uint8_t whole8[4];
|
||||
uint16_t whole16[4 / 2];
|
||||
uint32_t whole32[4 / 4];
|
||||
uint16_t whole16[4/2];
|
||||
uint32_t whole32[4/4];
|
||||
|
||||
struct{
|
||||
uint8_t buttons : 5;
|
||||
uint8_t reserved : 3;
|
||||
uint8_t buttons:5;
|
||||
uint8_t reserved:3;
|
||||
int8_t xAxis;
|
||||
int8_t yAxis;
|
||||
int8_t wheel;
|
||||
|
|
@ -59,8 +59,8 @@ typedef union{
|
|||
typedef union{
|
||||
// Low level key report: up to 6 keys and shift, ctrl etc at once
|
||||
uint8_t whole8[8];
|
||||
uint16_t whole16[8 / 2];
|
||||
uint32_t whole32[8 / 4];
|
||||
uint16_t whole16[8/2];
|
||||
uint32_t whole32[8/4];
|
||||
|
||||
struct{
|
||||
uint8_t modifiers;
|
||||
|
|
@ -82,8 +82,8 @@ typedef union{
|
|||
typedef union{
|
||||
// every usable media key possible. Only one at the same time.
|
||||
uint8_t whole8[8];
|
||||
uint16_t whole16[8 / 2];
|
||||
uint32_t whole32[8 / 4];
|
||||
uint16_t whole16[8/2];
|
||||
uint32_t whole32[8/4];
|
||||
|
||||
struct{
|
||||
uint16_t key1;
|
||||
|
|
@ -104,57 +104,58 @@ typedef union{
|
|||
typedef union {
|
||||
// 32 Buttons, 6 Axis, 2 D-Pads
|
||||
uint8_t whole8[15];
|
||||
uint16_t whole16[15 / 2];
|
||||
uint32_t whole32[15 / 4];
|
||||
uint16_t whole16[15/2];
|
||||
uint32_t whole32[15/4];
|
||||
uint32_t buttons;
|
||||
|
||||
struct{
|
||||
uint8_t button1 : 1;
|
||||
uint8_t button2 : 1;
|
||||
uint8_t button3 : 1;
|
||||
uint8_t button4 : 1;
|
||||
uint8_t button5 : 1;
|
||||
uint8_t button6 : 1;
|
||||
uint8_t button7 : 1;
|
||||
uint8_t button8 : 1;
|
||||
uint8_t button1 :1;
|
||||
uint8_t button2 :1;
|
||||
uint8_t button3 :1;
|
||||
uint8_t button4 :1;
|
||||
uint8_t button5 :1;
|
||||
uint8_t button6 :1;
|
||||
uint8_t button7 :1;
|
||||
uint8_t button8 :1;
|
||||
|
||||
uint8_t button9 : 1;
|
||||
uint8_t button10 : 1;
|
||||
uint8_t button11 : 1;
|
||||
uint8_t button12 : 1;
|
||||
uint8_t button13 : 1;
|
||||
uint8_t button14 : 1;
|
||||
uint8_t button15 : 1;
|
||||
uint8_t button16 : 1;
|
||||
uint8_t button9 :1;
|
||||
uint8_t button10 :1;
|
||||
uint8_t button11 :1;
|
||||
uint8_t button12 :1;
|
||||
uint8_t button13 :1;
|
||||
uint8_t button14 :1;
|
||||
uint8_t button15 :1;
|
||||
uint8_t button16 :1;
|
||||
|
||||
uint8_t button17 : 1;
|
||||
uint8_t button18 : 1;
|
||||
uint8_t button19 : 1;
|
||||
uint8_t button20 : 1;
|
||||
uint8_t button21 : 1;
|
||||
uint8_t button22 : 1;
|
||||
uint8_t button23 : 1;
|
||||
uint8_t button24 : 1;
|
||||
uint8_t button17 :1;
|
||||
uint8_t button18 :1;
|
||||
uint8_t button19 :1;
|
||||
uint8_t button20 :1;
|
||||
uint8_t button21 :1;
|
||||
uint8_t button22 :1;
|
||||
uint8_t button23 :1;
|
||||
uint8_t button24 :1;
|
||||
|
||||
uint8_t button25 : 1;
|
||||
uint8_t button26 : 1;
|
||||
uint8_t button27 : 1;
|
||||
uint8_t button28 : 1;
|
||||
uint8_t button29 : 1;
|
||||
uint8_t button30 : 1;
|
||||
uint8_t button31 : 1;
|
||||
uint8_t button32 : 1;
|
||||
uint8_t button25 :1;
|
||||
uint8_t button26 :1;
|
||||
uint8_t button27 :1;
|
||||
uint8_t button28 :1;
|
||||
uint8_t button29 :1;
|
||||
uint8_t button30 :1;
|
||||
uint8_t button31 :1;
|
||||
uint8_t button32 :1;
|
||||
|
||||
uint16_t xAxis;
|
||||
uint16_t yAxis;
|
||||
uint8_t zAxis;
|
||||
int16_t xAxis;
|
||||
int16_t yAxis;
|
||||
|
||||
uint16_t rxAxis;
|
||||
uint16_t ryAxis;
|
||||
uint8_t rzAxis;
|
||||
int16_t rxAxis;
|
||||
int16_t ryAxis;
|
||||
|
||||
uint8_t dPad1 : 4;
|
||||
uint8_t dPad2 : 4;
|
||||
int8_t zAxis;
|
||||
int8_t rzAxis;
|
||||
|
||||
uint8_t dPad1: 4;
|
||||
uint8_t dPad2: 4;
|
||||
};
|
||||
} HID_GamepadReport_Data_t;
|
||||
|
||||
|
|
@ -162,15 +163,15 @@ typedef union {
|
|||
typedef union{
|
||||
// 2 Buttons, 2 Axis
|
||||
uint8_t whole8[3];
|
||||
uint16_t whole16[3 / 2];
|
||||
uint8_t buttons : 2;
|
||||
uint16_t whole16[3/2];
|
||||
uint8_t buttons :2;
|
||||
|
||||
struct{
|
||||
uint16_t button1 : 1;
|
||||
uint16_t button2 : 1;
|
||||
uint16_t xAxis : 10;
|
||||
uint16_t yAxis : 10;
|
||||
uint16_t reserved : 2;
|
||||
uint16_t button1 :1;
|
||||
uint16_t button2 :1;
|
||||
uint16_t xAxis :10;
|
||||
uint16_t yAxis :10;
|
||||
uint16_t reserved :2;
|
||||
};
|
||||
} HID_JoystickReport_Data_t;
|
||||
|
||||
|
|
@ -189,16 +190,16 @@ typedef union{
|
|||
|
||||
/** Enum for the HID report IDs used in the device. */
|
||||
typedef enum{
|
||||
HID_REPORTID_NotAReport = 0x00, // first entry is always zero for multireports
|
||||
HID_REPORTID_MouseReport = 0x01, /**< Report ID for the Mouse report within the device. */
|
||||
HID_REPORTID_KeyboardReport = 0x02, /**< Report ID for the Keyboard report within the device. */
|
||||
HID_REPORTID_RawKeyboardReport = 0x03, /**< Report ID for the Raw Keyboard report within the device. */
|
||||
HID_REPORTID_MediaReport = 0x04, /**< Report ID for the Media report within the device. */
|
||||
HID_REPORTID_SystemReport = 0x05, /**< Report ID for the Power report within the device. */
|
||||
HID_REPORTID_Gamepad1Report = 0x06, /**< Report ID for the Gamepad1 report within the device. */
|
||||
HID_REPORTID_Gamepad2Report = 0x07, /**< Report ID for the Gamepad2 report within the device. */
|
||||
HID_REPORTID_Joystick1Report = 0x08, /**< Report ID for the Joystick1 report within the device. */
|
||||
HID_REPORTID_Joystick2Report = 0x09, /**< Report ID for the Joystick2 report within the device. */
|
||||
HID_REPORTID_NotAReport = 0x00, // first entry is always zero for multireports
|
||||
HID_REPORTID_MouseReport = 0x01, /**< Report ID for the Mouse report within the device. */
|
||||
HID_REPORTID_KeyboardReport = 0x02, /**< Report ID for the Keyboard report within the device. */
|
||||
HID_REPORTID_RawKeyboardReport = 0x03, /**< Report ID for the Raw Keyboard report within the device. */
|
||||
HID_REPORTID_MediaReport = 0x04, /**< Report ID for the Media report within the device. */
|
||||
HID_REPORTID_SystemReport = 0x05, /**< Report ID for the Power report within the device. */
|
||||
HID_REPORTID_Gamepad1Report = 0x06, /**< Report ID for the Gamepad1 report within the device. */
|
||||
HID_REPORTID_Gamepad2Report = 0x07, /**< Report ID for the Gamepad2 report within the device. */
|
||||
HID_REPORTID_Joystick1Report = 0x08, /**< Report ID for the Joystick1 report within the device. */
|
||||
HID_REPORTID_Joystick2Report = 0x09, /**< Report ID for the Joystick2 report within the device. */
|
||||
HID_REPORTID_LastNotAReport, // determinate whats the maximum number of reports -1
|
||||
} HID_Report_IDs;
|
||||
|
||||
|
|
|
|||
10
Keyboard.h
10
Keyboard.h
|
|
@ -37,6 +37,11 @@ void HID_SendReport(uint8_t id, const void* data, int len);
|
|||
// Keyboard
|
||||
//================================================================================
|
||||
|
||||
//Keyboard fixed/added missing Keys
|
||||
#define KEY_PRINT 0xCE
|
||||
#define KEY_SCROLL_LOCK 0xCF
|
||||
#define KEY_PAUSE 0xD0
|
||||
|
||||
#ifndef USBCON
|
||||
|
||||
#define KEY_LEFT_CTRL 0x80
|
||||
|
|
@ -76,11 +81,6 @@ void HID_SendReport(uint8_t id, const void* data, int len);
|
|||
#define KEY_F11 0xCC
|
||||
#define KEY_F12 0xCD
|
||||
|
||||
//Keyboard fixed/added missing Keys
|
||||
#define KEY_PRINT 0xCE
|
||||
#define KEY_SCROLL_LOCK 0xCF
|
||||
#define KEY_PAUSE 0xD0
|
||||
|
||||
//Raw Keyboard definitions
|
||||
#define RAW_KEYBOARD_LEFT_CTRL B00000001
|
||||
#define RAW_KEYBOARD_LEFT_SHIFT B00000010
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ void loop() {
|
|||
|
||||
// direct without library. Always send RAWHID_RX_SIZE bytes!
|
||||
uint8_t buff[RAWHID_RX_SIZE]; // unitialized, has random values
|
||||
HID.sendReport(HID_REPORTID_RawKeyboardReport, buff, sizeof(buff));
|
||||
HID_SendReport(HID_REPORTID_RawKeyboardReport, buff, sizeof(buff));
|
||||
|
||||
// with library
|
||||
memset(&buff, 42, sizeof(buff));
|
||||
|
|
@ -47,7 +47,7 @@ void loop() {
|
|||
RawHID.write(0xCD);
|
||||
|
||||
// huge buffer with library, will fill the rest with zeros
|
||||
uint8_t megabuff[256];
|
||||
uint8_t megabuff[64];
|
||||
for (int i = 0; i < sizeof(megabuff); i++)
|
||||
megabuff[i] = i;
|
||||
RawHID.write(megabuff, sizeof(megabuff));
|
||||
|
|
@ -68,82 +68,47 @@ void loop() {
|
|||
Expected output:
|
||||
|
||||
// manual with unintialized buff
|
||||
recv 63 bytes:
|
||||
1B B7 0B 88 1F 99 1F 5A 95 A9 F7 80 95 90 95 BC
|
||||
01 CD 01 08 95 A1 E2 1A 2E AA 1B BB 1B FD 01 0D
|
||||
C0 AA 1F BB 1F EE 1F FF 1F A2 17 B3 07 E4 07 F5
|
||||
07 20 F0 A2 1B B3 0B E4 0B F5 0B 66 1F 77 1F
|
||||
recv 15 bytes:
|
||||
01 55 C1 FF 01 01 01 00 00 01 00 00 01 00 20
|
||||
|
||||
// filled buff
|
||||
recv 63 bytes:
|
||||
2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A
|
||||
2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A
|
||||
2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A
|
||||
recv 15 bytes:
|
||||
2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A
|
||||
|
||||
// single byte filled with zero
|
||||
recv 63 bytes:
|
||||
CD 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
recv 15 bytes:
|
||||
CD 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
|
||||
// huge buffer filled with zero at the end
|
||||
recv 63 bytes:
|
||||
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
|
||||
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
|
||||
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
|
||||
30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E
|
||||
recv 15 bytes:
|
||||
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E
|
||||
|
||||
recv 63 bytes:
|
||||
3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E
|
||||
4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E
|
||||
5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E
|
||||
6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D
|
||||
recv 15 bytes:
|
||||
0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D
|
||||
|
||||
recv 63 bytes:
|
||||
7E 7F 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D
|
||||
8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D
|
||||
9E 9F A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD
|
||||
AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC
|
||||
recv 15 bytes:
|
||||
1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C
|
||||
|
||||
recv 63 bytes:
|
||||
BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC
|
||||
CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC
|
||||
DD DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC
|
||||
ED EE EF F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB
|
||||
recv 15 bytes:
|
||||
2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B
|
||||
|
||||
recv 63 bytes:
|
||||
FC FD FE FF 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
recv 15 bytes:
|
||||
3C 3D 3E 3F 00 00 00 00 00 00 00 00 00 00 00
|
||||
|
||||
// print
|
||||
recv 63 bytes:
|
||||
48 65 6C 6C 6F 20 57 6F 72 6C 64 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
recv 15 bytes:
|
||||
48 65 6C 6C 6F 20 57 6F 72 6C 64 00 00 00 00
|
||||
|
||||
//\r
|
||||
recv 63 bytes:
|
||||
0D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
recv 15 bytes:
|
||||
0D 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
|
||||
//\n
|
||||
recv 63 bytes:
|
||||
0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
recv 15 bytes:
|
||||
0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
|
||||
//write
|
||||
recv 63 bytes:
|
||||
48 65 6C 6C 6F 20 57 6F 72 6C 64 0D 0A 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
recv 15 bytes:
|
||||
48 65 6C 6C 6F 20 57 6F 72 6C 64 0D 0A 00 00
|
||||
|
||||
*/
|
||||
|
|
@ -11,6 +11,7 @@ Press a button and demonstrate Gamepad actions
|
|||
|
||||
// create a new Gamepad instance (1-4)
|
||||
Gamepad Gamepad1(1);
|
||||
//Gamepad Gamepad2(2);
|
||||
|
||||
const int pinLed = 13;
|
||||
const int pinButton = 8;
|
||||
|
|
@ -47,12 +48,13 @@ void loop() {
|
|||
|
||||
// go through all dPad positions
|
||||
// values: 0-8 (0==centred)
|
||||
static uint8_t dpad1 = 0;
|
||||
static uint8_t dpad1 = GAMEPAD_DPAD_CENTERED;
|
||||
Gamepad1.dPad1(dpad1++);
|
||||
if (dpad1 == 9) dpad1 = 0;
|
||||
static int8_t dpad2 = 0;
|
||||
if(dpad1>GAMEPAD_DPAD_UP_LEFT) dpad1 = GAMEPAD_DPAD_CENTERED;
|
||||
static int8_t dpad2 = GAMEPAD_DPAD_CENTERED;
|
||||
Gamepad1.dPad2(dpad2--);
|
||||
if (dpad2 == -1) dpad2 = 8;
|
||||
if(dpad2<GAMEPAD_DPAD_CENTERED) dpad2 = GAMEPAD_DPAD_UP_LEFT;
|
||||
|
||||
|
||||
// functions before only set the values
|
||||
// this writes the report to the host
|
||||
|
|
@ -74,12 +76,23 @@ void press(uint8_t b);
|
|||
void release(uint8_t b);
|
||||
void releaseAll(void);
|
||||
void buttons(uint32_t b);
|
||||
void xAxis(uint16_t a);
|
||||
void yAxis(uint16_t a);
|
||||
void zAxis(uint16_t a);
|
||||
void rxAxis(uint16_t a);
|
||||
void ryAxis(uint16_t a);
|
||||
void rzAxis(uint16_t a);
|
||||
void dPad1(uint8_t d);
|
||||
void dPad2(uint8_t d);
|
||||
void xAxis(int16_t a);
|
||||
void yAxis(int16_t a);
|
||||
void rxAxis(int16_t a);
|
||||
void ryAxis(int16_t a);
|
||||
void zAxis(int8_t a);
|
||||
void rzAxis(int8_t a);
|
||||
void dPad1(int8_t d);
|
||||
void dPad2(int8_t d);
|
||||
|
||||
Definitions:
|
||||
GAMEPAD_DPAD_CENTERED 0
|
||||
GAMEPAD_DPAD_UP 1
|
||||
GAMEPAD_DPAD_UP_RIGHT 2
|
||||
GAMEPAD_DPAD_RIGHT 3
|
||||
GAMEPAD_DPAD_DOWN_RIGHT 4
|
||||
GAMEPAD_DPAD_DOWN 5
|
||||
GAMEPAD_DPAD_DOWN_LEFT 6
|
||||
GAMEPAD_DPAD_LEFT 7
|
||||
GAMEPAD_DPAD_UP_LEFT 8
|
||||
*/
|
||||
|
|
|
|||
13
keywords.txt
13
keywords.txt
|
|
@ -27,7 +27,7 @@ ryAxis KEYWORD2
|
|||
rzAxis KEYWORD2
|
||||
dPad1 KEYWORD2
|
||||
dPad2 KEYWORD2
|
||||
sendReport KEYWORD2
|
||||
HID_SendReport KEYWORD2
|
||||
|
||||
#######################################
|
||||
# Classes (KEYWORD3)
|
||||
|
|
@ -183,3 +183,14 @@ MEDIA_BROWSER_BOOKMARKS LITERAL1
|
|||
SYSTEM_POWER_DOWN LITERAL1
|
||||
SYSTEM_SLEEP LITERAL1
|
||||
SYSTEM_WAKE_UP LITERAL1
|
||||
|
||||
#Gamepad
|
||||
GAMEPAD_DPAD_CENTERED LITERAL1
|
||||
GAMEPAD_DPAD_UP LITERAL1
|
||||
GAMEPAD_DPAD_UP_RIGHT LITERAL1
|
||||
GAMEPAD_DPAD_RIGHT LITERAL1
|
||||
GAMEPAD_DPAD_DOWN_RIGHT LITERAL1
|
||||
GAMEPAD_DPAD_DOWN LITERAL1
|
||||
GAMEPAD_DPAD_DOWN_LEFT LITERAL1
|
||||
GAMEPAD_DPAD_LEFT LITERAL1
|
||||
GAMEPAD_DPAD_UP_LEFT LITERAL1
|
||||
|
|
|
|||
Loading…
Reference in a new issue