I've been trying to use RAW HID on the Teensy 3.2 with some existing code, and ran into problems with having two HID interfaces in the RAW HID configuration. My tools didn't know what to make of it.
So I made a variant of RAW HID without serial emulation.
In usb_desc.h, I created a new interface definition:
In usb_raw.h I added RAWHID_INTERFACE_NOSERIAL to the #ifdefined guard:
I added my variant to boards.txt:
I added this to usb_inst.cpp:
Finally, I found that I needed to modify yield.cpp to avoid trying to use the uninstantiated Serial instance. I wrapped the call to Serial in a SEREMU_INTERFACE #ifdef.
This works, and now my older tools that expect a single HID endpoint work again.
So I made a variant of RAW HID without serial emulation.
In usb_desc.h, I created a new interface definition:
Code:
#elif defined(USB_RAWHID_NOSERIAL)
#define VENDOR_ID 0x16C0
#define PRODUCT_ID 0x0486 // Not unique!
#define RAWHID_USAGE_PAGE 0xFFAB // recommended: 0xFF00 to 0xFFFF
#define RAWHID_USAGE 0x0200 // recommended: 0x0100 to 0xFFFF
#define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
#define MANUFACTURER_NAME_LEN 11
#define PRODUCT_NAME {'T','e','e','n','s','y','d','u','i','n','o',' ','R','a','w','H','I','D',' ','N','o',' ','S','e','r','i','a','l'}
#define PRODUCT_NAME_LEN 28
#define EP0_SIZE 64
#define NUM_ENDPOINTS 2
#define NUM_USB_BUFFERS 12
#define NUM_INTERFACE 1
#define RAWHID_INTERFACE 0 // RawHID
#define RAWHID_TX_ENDPOINT 1
#define RAWHID_TX_SIZE 64
#define RAWHID_TX_INTERVAL 1
#define RAWHID_RX_ENDPOINT 2
#define RAWHID_RX_SIZE 64
#define RAWHID_RX_INTERVAL 1
#define RAWHID_DESC_OFFSET (9 + 9)
#define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
#define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
In usb_raw.h I added RAWHID_INTERFACE_NOSERIAL to the #ifdefined guard:
Code:
#if defined(RAWHID_INTERFACE) [B]|| defined(RAWHID_INTERFACE_NOSERIAL)[/B]
I added my variant to boards.txt:
Code:
teensy31.menu.usb.rawhidnoserial=Raw HID No Serial
teensy31.menu.usb.rawhidnoserial.build.usbtype=USB_RAWHID_NOSERIAL
I added this to usb_inst.cpp:
Code:
#ifdef RAWHID_INTERFACE_NOSERIAL
usb_rawhid_class RawHID;
#endif
Finally, I found that I needed to modify yield.cpp to avoid trying to use the uninstantiated Serial instance. I wrapped the call to Serial in a SEREMU_INTERFACE #ifdef.
Code:
[B]#if defined (SEREMU_INTERFACE)[/B]
if (Serial.available()) serialEvent();
[B]#endif[/B]
This works, and now my older tools that expect a single HID endpoint work again.