I'm trying to add a new USB type that combines HID & Raw HID. I think I've worked most of it out from the instructions in "usb_desc.h", but all I get are "XYZ was not declared in this scope" errors when I try to use my new type.
In an attempt to narrow down the problem, I also tried just making an exact duplicate of Raw HID with a different name, and that doesn't work either.
In "boards.txt", I've added:
..in "usb_desc.h":
...and in "usb_inst.cpp":
Here's the full error message when trying to build the Raw HID Basic example code:
Of course, the example code builds just fine if I select "Raw HID" instead of "Raw HID 2". I feel like I must be missing something really simple, but I just can't seem to find it. Any suggestions would be much appreciated!
Setup: Arduino 1.0.5 & Teensyduino 1.19 on a Mac, Teensy 3
In an attempt to narrow down the problem, I also tried just making an exact duplicate of Raw HID with a different name, and that doesn't work either.
In "boards.txt", I've added:
Code:
teensy3.menu.usb.rawhid2.name=Raw HID 2
teensy3.menu.usb.rawhid2.build.define0=-DUSB_RAWHID2
teensy3.menu.usb.rawhid2.fake_serial=teensy_gateway
..in "usb_desc.h":
Code:
#elif defined(USB_RAWHID2)
#define VENDOR_ID 0x16C0
#define PRODUCT_ID 0x0486
#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'}
#define PRODUCT_NAME_LEN 18
#define EP0_SIZE 64
#define NUM_ENDPOINTS 6
#define NUM_USB_BUFFERS 12
#define NUM_INTERFACE 2
#define RAWHID_INTERFACE 0 // RawHID
#define RAWHID_TX_ENDPOINT 3
#define RAWHID_TX_SIZE 64
#define RAWHID_TX_INTERVAL 1
#define RAWHID_RX_ENDPOINT 4
#define RAWHID_RX_SIZE 64
#define RAWHID_RX_INTERVAL 1
#define SEREMU_INTERFACE 1 // Serial emulation
#define SEREMU_TX_ENDPOINT 1
#define SEREMU_TX_SIZE 64
#define SEREMU_TX_INTERVAL 1
#define SEREMU_RX_ENDPOINT 2
#define SEREMU_RX_SIZE 32
#define SEREMU_RX_INTERVAL 2
#define RAWHID_DESC_OFFSET (9 + 9)
#define SEREMU_DESC_OFFSET (9 + 9+9+7+7 + 9)
#define CONFIG_DESC_SIZE (9 + 9+9+7+7 + 9+9+7+7)
#define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
#define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
#define ENDPOINT3_CONFIG ENDPOINT_TRANSIMIT_ONLY
#define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ONLY
...and in "usb_inst.cpp":
Code:
#ifdef USB_RAWHID2
usb_rawhid_class RawHID;
usb_seremu_class Serial;
#endif
Here's the full error message when trying to build the Raw HID Basic example code:
Code:
/Users/lhagan/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/arm-none-eabi/bin/arm-none-eabi-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mcpu=cortex-m4 -DF_CPU=96000000 -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -mthumb -nostdlib -D__MK20DX128__ -DTEENSYDUINO=118 -fno-rtti -felide-constructors -std=gnu++0x -DUSB_RAWHID2 -DLAYOUT_US_ENGLISH -I/Users/lhagan/Applications/Arduino.app/Contents/Resources/Java/hardware/teensy/cores/teensy3 /var/folders/t4/vmhr2xd16439ttrwnpb54_j00000gn/T/build2754205012057077850.tmp/Basic.cpp -o /var/folders/t4/vmhr2xd16439ttrwnpb54_j00000gn/T/build2754205012057077850.tmp/Basic.cpp.o
Basic.pde: In function 'void setup()':
Basic:15: error: 'Serial' was not declared in this scope
Basic.pde: In function 'void loop()':
Basic:29: error: 'RawHID' was not declared in this scope
Basic:34: error: 'Serial' was not declared in this scope
Basic:63: error: 'Serial' was not declared in this scope
Basic:67: error: 'Serial' was not declared in this scope
Of course, the example code builds just fine if I select "Raw HID" instead of "Raw HID 2". I feel like I must be missing something really simple, but I just can't seem to find it. Any suggestions would be much appreciated!
Setup: Arduino 1.0.5 & Teensyduino 1.19 on a Mac, Teensy 3