Code: Select all
reportBuffer[0]=0;//report id
reportBuffer[1]=128;//X-Axis ( main stick )
reportBuffer[2]=128;//Y-Axis ( main stick )
reportBuffer[3]=128;//Z-Axis
reportBuffer[4]=128;//X-rotate( second stick )
reportBuffer[5]=128;//Y-rotate ( second stick )
reportBuffer[6]=128;//Z-rotate
reportBuffer[7]=128;//slider( right trig )psx presure 1
reportBuffer[8]=128;//dial ( left trig )psx presure 2
reportBuffer[9] =0;//buttons 1
reportBuffer[10]=0;//buttons 2
reportBuffer[11]=0;//buttons 3
now this is a generic template that works with a large number of controller. The reality is that non of those controllers use more then 8 packets but I must be able to change controllers on the fly so I can just make a project for each controller. We can skip the id bit [0] as it does not count.
examples:
jaguar uses 1,2,9,10,11
psx uses 1,2,4,3,7,8,9,10
wii nun chuck uses 1,2,3,4,5,6,7,8
So in order to support the nun chuck I need all available analogs but no buttons, to use the jaguar I need all 3 rows of buttons. So the only way to do that is to have the entire usb hid report. I wish there was a way to compress the data in to 8 packets but the user end software is not with in my jurisdiction. So the only way I could do this is patch the descriptor on the fly and always use 8 bytes. From what I know that is not possible once the usb is negotiated.
so why 8 packets and why not just sent it twice? Well I do that now.
Code: Select all
while (!usbInterruptIsReady()){usbPoll(); } usbSetInterrupt((void *)&reportBuffer + 0, 8);
while (!usbInterruptIsReady()){usbPoll(); } usbSetInterrupt((void *)&reportBuffer + 8, 5);
The issue is that low speed means two pulls 16 total ms and its possible the user will see a frame skip "lag" on a monitor running more then 60 fps. Now that is debatable I would guess. Can anyone notice an occasional frame skip? Personally I dont but I'd like to advertise 8ms poll rates.