CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

[Help] USB HID With 2 Interfaces - Dual Game Pad

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
robo_z



Joined: 11 Dec 2014
Posts: 5

View user's profile Send private message

[Help] USB HID With 2 Interfaces - Dual Game Pad
PostPosted: Sun Feb 23, 2020 9:49 am     Reply with quote

Hi Everyone

I'm trying to implement a dual game pad with a PIC18F4550 with 2 interfaces, not only one with report IDs. I need create a Game pad with 2 interfaces, same as ex_usb_kbmouse.c & usb_desc_kbmouse.h files of examples.

This is my descriptor (Only recognize one game pad):
Code:

#define USB_CONFIG_PID          0x0020
#define USB_CONFIG_VID          0x0461
#define USB_CONFIG_BUS_POWER    500   //100mA
#define USB_CONFIG_VERSION      0x0100      //01.00
#define USB_CONFIG_HID_TX_SIZE  64 //Bytes
#define USB_CONFIG_HID_RX_SIZE  0 //Bytes
#define USB_CONFIG_HID_TX_POLL  10 //for full speed devices, valid range is 1-255 & for slow speed devices, valid range is 10-255
#define USB_CONFIG_HID_RX_POLL  1
#define USB_HID_DEVICE          TRUE

#define USB_HID_ENDPOINT        2
#define USB_EP1_TX_ENABLE       USB_ENABLE_INTERRUPT   //turn on EP1 for IN bulk/interrupt transfers
#define USB_EP1_TX_SIZE         USB_CONFIG_HID_TX_SIZE
#define USB_EP1_RX_SIZE         USB_CONFIG_HID_RX_SIZE

//#define USB_HID_ENDPOINT        1
#define USB_EP2_TX_ENABLE       USB_ENABLE_INTERRUPT   //turn on EP2 for IN bulk/interrupt transfers
#define USB_EP2_TX_SIZE         USB_CONFIG_HID_TX_SIZE
#define USB_EP2_RX_SIZE         USB_CONFIG_HID_RX_SIZE

...


Thanks for you help. Rolling Eyes


Last edited by robo_z on Wed Mar 11, 2020 8:37 am; edited 7 times in total
Ttelmah



Joined: 11 Mar 2010
Posts: 19451

View user's profile Send private message

PostPosted: Sun Feb 23, 2020 12:55 pm     Reply with quote

OK.
First

#define USB_HID_ENDPOINT 1
is overridden by the second line:
#define USB_HID_ENDPOINT 2
A #define is processed sequentially before compilation.
You can't have two defines like this.

You are not posting the rest of the descriptors. The class descriptors. The
config descriptor, the endpoint descriptors etc..
Nor the #define USB_MAX_NUM_INTERFACES setting.

Also you are looking at the wrong example. Look at ex_usb_multihid, and
ex_usb_multhid2. You will see that the two devices are one descriptor.
Only one configuration, and one size. Two report ID's in the single
descriptor.
robo_z



Joined: 11 Dec 2014
Posts: 5

View user's profile Send private message

PostPosted: Mon Feb 24, 2020 3:15 am     Reply with quote

Ttelmah wrote:
OK.
First

#define USB_HID_ENDPOINT 1
is overridden by the second line:
#define USB_HID_ENDPOINT 2
...
descriptor.


Thank you very much for your help

I have corrected and added the rest of the code, so you can have a better idea.

I will review those examples that you recommend.
Ttelmah



Joined: 11 Mar 2010
Posts: 19451

View user's profile Send private message

PostPosted: Mon Feb 24, 2020 7:13 am     Reply with quote

As I said, look at the example of how to do two HID devices. The format
is very different from what you are posting....
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group