Strictly necessary cookies are on by default and cannot be turned off. Functional, Performance and Tracking/targeting/sharing cookies can be turned on below based on your preferences (this banner will remain available for you to accept cookies). You may change your cookie settings by deleting cookies from your browser. Then this banner will appear again. You can learn more details about cookies HERE.
Strictly necessary (always on)
Functional, Performance and Tracking/targeting/sharing (default off)
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.
I played with the HID report and changed a couple items so it now enumerates as a composite device in windows 7 with two hid devices that load correctly whereas the first project attached didn't enumerate correctly. I am using a world tour board so there is one button and 5 LED's for troubleshooting. I'm using a C# USBlibrary program for communication with the raw device. The HID software program sees the device and does not get an error when sending a message, but does not get a response. I'm not sure if the joystick emulation works. Perhaps having the joystick change axis movement every few seconds will be a simple way to diagnose if it is working.