2018.07.26
Dependencies: FATFileSystem3 mbed-rtos
Fork of USBHost by
Diff: USBHostHID/USBHostGamepad.cpp
- Revision:
- 33:86c22c0c8aae
- Parent:
- 32:e6717a485577
- Child:
- 34:cac1e8336448
--- a/USBHostHID/USBHostGamepad.cpp Tue Jun 02 05:57:44 2015 +0000 +++ b/USBHostHID/USBHostGamepad.cpp Thu Jun 18 08:05:23 2015 +0000 @@ -37,10 +37,30 @@ gamepad_device_found = false; gamepad_intf = -1; + btnX = 0; btnY = 0; btnABCD = 0; btnSpecial = 0; + + btn00 = 0; + btn01 = 1; + btn02 = 2; + btn03 = 3; + btn04 = 4; + btn05 = 5; + btn06 = 6; + btn07 = 7; + btn08 = 8; + btn09 = 9; + btn01 = 10; + btn11 = 11; + btn12 = 12; + btn13 = 13; + btn14 = 14; + btn15 = 15; + + } bool USBHostGamepad::connected() { @@ -92,6 +112,7 @@ void USBHostGamepad::rxHandler() { int len_listen = int_in->getSize(); +// printf("GamePad Length=%dyryn", len_listen); #if DEBUG > 3 USB_DBG("USBHostGamepad::rxHandler() len_listen=%d\r\n", len_listen); for (int i = 0; i < len_listen; i++) @@ -99,14 +120,48 @@ printf("\r\n\r\n"); #endif if (onUpdate) { - (*onUpdate)(report[0], report[1], report[5], report[6]); +// (*onUpdate)(report[0], report[1], report[5], report[6]); + (*onUpdate)( + report[0], + report[1], + report[2], + report[3], + report[4], + report[5], + report[6], + report[7], + report[8], + report[9], + report[10], + report[11], + report[12], + report[13], + report[14], + report[15] + ); } // update gamepad state - btnX = report[0]; - btnY = report[1]; - btnABCD = report[5]; - btnSpecial = report[6]; +// btnX = report[0]; +// btnY = report[1]; +// btnABCD = report[5]; +// btnSpecial = report[6]; + btn00 = report[0]; + btn01 = report[1]; + btn02 = report[2]; + btn03 = report[3]; + btn04 = report[4]; + btn05 = report[5]; + btn06 = report[6]; + btn07 = report[7]; + btn08 = report[8]; + btn09 = report[9]; + btn10 = report[10]; + btn11 = report[11]; + btn12 = report[12]; + btn13 = report[13]; + btn14 = report[14]; + btn15 = report[15]; if (len_listen > sizeof(report)) { len_listen = sizeof(report); @@ -183,9 +238,9 @@ && buf[2] == 0x09 //Usage ){ if( buf[3] == 0x04 ){ - USB_DBG("GAMEPAD"); + USB_DBG("ゲームパッドです:"); }else if( buf[3] == 0x05){ - USB_DBG("JOYSTICK"); + USB_DBG("ジョイスティックです:"); }else{ ret = false; }