bardelli
Joined: 14 Oct 2007 Posts: 3
|
Joystick USB with PIC18f4550 |
Posted: Mon Oct 15, 2007 9:35 am |
|
|
Hello folks, I need some help in this project...
this is my descriptor file:
const char USB_CLASS_SPECIFIC_DESC[] = {
0x05, 0x01,// ;USAGE_PAGE (Generic Desktop)
0x09, 0x05,// ;USAGE (Gamepad)
0xA1, 0x01,// ;COLLECTION (Application)
0x09, 0x01,// ; USAGE (Pointer)
0xA1, 0x00,// ; COLLECTION (Physical)
0x09, 0x30,// ; USAGE (X)
0x09, 0x31,// ; USAGE (Y)
0x15, 0x00,// ; LOGICAL_MINIMUM (0)
0x26, 0xFF, 0x00,// LOGICAL_MAXIMUM (255)
0x75, 0x08,// ; REPORT_SIZE (8)
0x95, 0x02,// ; REPORT_COUNT (2)
0x81, 0x02,// ; INPUT (Data,Var,Abs)
0xC0,// ; END_COLLECTION
0x05, 0x09,// ; USAGE_PAGE (Button)
0x19, 0x01,// ; USAGE_MINIMUM (Button 1)
0x29, 0x06,// ; USAGE_MAXIMUM (Button 6)
0x15, 0x00,// ; LOGICAL_MINIMUM (0)
0x25, 0x01,// ; LOGICAL_MAXIMUM (1)
0x75, 0x01,// ; REPORT_SIZE (1)
0x95, 0x06,// ; REPORT_COUNT (6)
0x81, 0x02,// ; INPUT (Data,Var,Abs)
0x95, 0x02,// ; REPORT_COUNT (2)
0x81, 0x03,// ; INPUT (Constant,Var,Abs)
0xC5
And my Program:
while (TRUE) {
usb_task();
usb_debug_task();
if (usb_enumerated()) {
out_data[0]=mouse_seq[x_seq];
out_data[1]=mouse_seq[y_seq];
out_data[2]=0;
// out_data[3]=0; //wheel state goes here
if (usb_put_packet(1,out_data,3,USB_DTS_TOGGLE))
count++;
if (count > 10) {
if (++x_seq>=MOUSE_SEQUENCE_STEPS) {x_seq=0;}
if (++y_seq>=MOUSE_SEQUENCE_STEPS) {y_seq=0;}
count=0;
}
delay_ms(10);
is there something Wrong?. Windows recognized my hardware as Human interface device , but an exclamation point appears too. Can anyone help?
thanks |
|