It has been a couple years since I've been using encore and Psoc. I'm now a mentor for the first robotics team my son is involved with. I'm helping the team program their robots and I'd like to make it so the team can test and debug code individually between group meetings using the simulation environment. The problem is that not everyone has a joystick at home and a joystick is required by the driver station software to operate the robot in the simulator.
ENTER PSOC... I have several encore III and a couple 24x94 boards that I can program and pass around for debugging. This is that I was thinking:
Make a joystick emulator device that also has a data device built in. It could enumerate as both an HID joystick AND an HID raw device... both of which I have made successfully before, but I've never tried to make them work on the same physical chip. The raw device could take data from a program running on the PC and then send joystick movements to the PC based on the data. Effectively the keyboard could be used to emulate a joystick. I am not familiar with software drivers that do this without any hardware and there may already be a solution, but it seems like a cool idea, so if you have some insight to help, it would be appreciated. The code will be open and posted, so there aren't any secrets on this one.
Here's the two main questions:
1. How to create a composite device? (A. Multiple interfaces or B. multiple report ID's)
2. How to communicate with the device? (joystick will be easy, but the raw device will be more difficult to use a driver)
I'm attaching one of my early attempts. It is a gamepad example that I changed somewhat and added a second interface, so there are two HID reports. One for the joystick and one for the raw array.
Endpoint 3 is for the joystick input using "joystick" HID report
Endpoint 1 is a 16 byte array input
Endpoint 2 is a 16 byte array output
The code compiles, but the device isn't functional. I'm looking for some insight on how to make it simpler to send data and get it functional. If it makes more sense to have a single extra 8 bit character in the HID report and just make a joystick and use that one character to send the report back to the device via the IN endpoint, I'm open to suggestions.
USB_Joystick_Sim.zip 153.7 K