Added custom gamepad example
This commit is contained in:
parent
fa2135adc0
commit
e0c845d01b
3 changed files with 95 additions and 0 deletions
|
|
@ -388,6 +388,7 @@ Useful Links/Credits
|
|||
* [Paul Stoffregen's Teensy Core](https://github.com/PaulStoffregen/cores)
|
||||
* [Keyboard Led Out report by hartmut_holgraefe](http://forum.arduino.cc/index.php?topic=173583.0)
|
||||
* [Github Pull Request with a lot of new functions](https://github.com/arduino/Arduino/pull/1803)
|
||||
* [Arduino ISP fix](https://petervanhoyweghen.wordpress.com/2012/09/16/arduinoisp-on-the-leonardo/)
|
||||
* A lot of searching through the web
|
||||
* The awesome official Arduino IRC chat!
|
||||
* [The NicoHood Protocol ^.^](https://github.com/NicoHood/NicoHoodProtocol)
|
||||
|
|
|
|||
|
|
@ -83,6 +83,53 @@ HID_REPORT_MOUSE(HID_REPORTID_MOUSE)
|
|||
//#define HID_GAMEPAD_API_ENABLE
|
||||
//#define HID_ENABLE_ALL_APIS // enables all of the ones above
|
||||
|
||||
|
||||
//// 2nd example with a custom Joystick report (the Gamepad API wont work anymor since the report is different)
|
||||
//#define EXTERN_HID_REPORT \ /* Gamepad with 32 buttons and 10 axis*/ \
|
||||
//0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */ \
|
||||
//0x09, 0x04, /* USAGE (Joystick) */ \
|
||||
//0xa1, 0x01, /* COLLECTION (Application) */ \
|
||||
//0x85, HID_REPORTID_GAMEPAD, /* REPORT_ID */ \
|
||||
///* 32 Buttons */ \
|
||||
//0x05, 0x09, /* USAGE_PAGE (Button) */ \
|
||||
//0x19, 0x01, /* USAGE_MINIMUM (Button 1) */ \
|
||||
//0x29, 0x20, /* USAGE_MAXIMUM (Button 32) */ \
|
||||
//0x15, 0x00, /* LOGICAL_MINIMUM (0) */ \
|
||||
//0x25, 0x01, /* LOGICAL_MAXIMUM (1) */ \
|
||||
//0x75, 0x01, /* REPORT_SIZE (1) */ \
|
||||
//0x95, 0x20, /* REPORT_COUNT (32) */ \
|
||||
//0x81, 0x02, /* INPUT (Data,Var,Abs) */ \
|
||||
///* 10 8bit Axis */ \
|
||||
//0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */ \
|
||||
//0xa1, 0x00, /* COLLECTION (Physical) */ \
|
||||
//0x09, 0x30, /* USAGE (X) */ \
|
||||
//0x09, 0x31, /* USAGE (Y) */ \
|
||||
//0x09, 0x33, /* USAGE (Rx) */ \
|
||||
//0x09, 0x34, /* USAGE (Ry) */ \
|
||||
//0x09, 0x32, /* USAGE (Z) */ \
|
||||
//0x09, 0x35, /* USAGE (Rz) */ \
|
||||
//0x09, 0x36, /* Usage (Slider) */ \
|
||||
//0x09, 0x36, /* Usage (Slider) */ \
|
||||
//0x09, 0x36, /* Usage (Slider) */ \
|
||||
//0x09, 0x36, /* Usage (Slider) */ \
|
||||
//0x15, 0x80, /* LOGICAL_MINIMUM (-128) */ \
|
||||
//0x25, 0x7F, /* LOGICAL_MAXIMUM (127) */ \
|
||||
//0x75, 0x08, /* REPORT_SIZE (8) */ \
|
||||
//0x95, 0x0A, /* REPORT_COUNT (10) */ \
|
||||
//0x81, 0x02, /* INPUT (Data,Var,Abs) */ \
|
||||
//0xc0, /* END_COLLECTION */ \
|
||||
//0xc0 /* END_COLLECTION */
|
||||
//
|
||||
//// activate your custom HID-APIs here:
|
||||
////#define HID_MOUSE_API_ENABLE
|
||||
////#define HID_KEYBOARD_API_ENABLE
|
||||
////#define HID_RAWHID_API_ENABLE
|
||||
////#define HID_CONSUMER_API_ENABLE
|
||||
////#define HID_SYSTEM_API_ENABLE
|
||||
////#define HID_GAMEPAD_API_ENABLE
|
||||
////#define HID_ENABLE_ALL_APIS // enables all of the ones above
|
||||
|
||||
|
||||
/*
|
||||
You can use the pre defined reports as well.
|
||||
Keep in mind that changing the ids or reports might confuse your OS.
|
||||
|
|
|
|||
|
|
@ -83,6 +83,53 @@ HID_REPORT_MOUSE(HID_REPORTID_MOUSE)
|
|||
//#define HID_GAMEPAD_API_ENABLE
|
||||
//#define HID_ENABLE_ALL_APIS // enables all of the ones above
|
||||
|
||||
|
||||
//// 2nd example with a custom Joystick report (the Gamepad API wont work anymor since the report is different)
|
||||
//#define EXTERN_HID_REPORT \ /* Gamepad with 32 buttons and 10 axis*/ \
|
||||
//0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */ \
|
||||
//0x09, 0x04, /* USAGE (Joystick) */ \
|
||||
//0xa1, 0x01, /* COLLECTION (Application) */ \
|
||||
//0x85, HID_REPORTID_GAMEPAD, /* REPORT_ID */ \
|
||||
///* 32 Buttons */ \
|
||||
//0x05, 0x09, /* USAGE_PAGE (Button) */ \
|
||||
//0x19, 0x01, /* USAGE_MINIMUM (Button 1) */ \
|
||||
//0x29, 0x20, /* USAGE_MAXIMUM (Button 32) */ \
|
||||
//0x15, 0x00, /* LOGICAL_MINIMUM (0) */ \
|
||||
//0x25, 0x01, /* LOGICAL_MAXIMUM (1) */ \
|
||||
//0x75, 0x01, /* REPORT_SIZE (1) */ \
|
||||
//0x95, 0x20, /* REPORT_COUNT (32) */ \
|
||||
//0x81, 0x02, /* INPUT (Data,Var,Abs) */ \
|
||||
///* 10 8bit Axis */ \
|
||||
//0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */ \
|
||||
//0xa1, 0x00, /* COLLECTION (Physical) */ \
|
||||
//0x09, 0x30, /* USAGE (X) */ \
|
||||
//0x09, 0x31, /* USAGE (Y) */ \
|
||||
//0x09, 0x33, /* USAGE (Rx) */ \
|
||||
//0x09, 0x34, /* USAGE (Ry) */ \
|
||||
//0x09, 0x32, /* USAGE (Z) */ \
|
||||
//0x09, 0x35, /* USAGE (Rz) */ \
|
||||
//0x09, 0x36, /* Usage (Slider) */ \
|
||||
//0x09, 0x36, /* Usage (Slider) */ \
|
||||
//0x09, 0x36, /* Usage (Slider) */ \
|
||||
//0x09, 0x36, /* Usage (Slider) */ \
|
||||
//0x15, 0x80, /* LOGICAL_MINIMUM (-128) */ \
|
||||
//0x25, 0x7F, /* LOGICAL_MAXIMUM (127) */ \
|
||||
//0x75, 0x08, /* REPORT_SIZE (8) */ \
|
||||
//0x95, 0x0A, /* REPORT_COUNT (10) */ \
|
||||
//0x81, 0x02, /* INPUT (Data,Var,Abs) */ \
|
||||
//0xc0, /* END_COLLECTION */ \
|
||||
//0xc0 /* END_COLLECTION */
|
||||
//
|
||||
//// activate your custom HID-APIs here:
|
||||
////#define HID_MOUSE_API_ENABLE
|
||||
////#define HID_KEYBOARD_API_ENABLE
|
||||
////#define HID_RAWHID_API_ENABLE
|
||||
////#define HID_CONSUMER_API_ENABLE
|
||||
////#define HID_SYSTEM_API_ENABLE
|
||||
////#define HID_GAMEPAD_API_ENABLE
|
||||
////#define HID_ENABLE_ALL_APIS // enables all of the ones above
|
||||
|
||||
|
||||
/*
|
||||
You can use the pre defined reports as well.
|
||||
Keep in mind that changing the ids or reports might confuse your OS.
|
||||
|
|
|
|||
Loading…
Reference in a new issue