Hello everyone,
I apologize I am a bit of a newbee to microcontrollers and coding stuff. I am in the process of creating a joystick interface with the teensy board. I would like to create my own customized USB descripter that uses 2 16 bit axis controllers and 32 buttons. I have followed hamaluik's tutorial for doing just this (located here http://hamaluik.com/posts/making-a-custom-teensy3-hid-joystick/) but I am hung up on the portion regarding byte count that is supposed to be inserted in the usb_desc.h file.
#define ARCADE_DESC_OFFSET (9)
#define CONFIG_DESC_SIZE (9 + 9+9+7)
I don't understand how you come up with 9 and 9 + 9+9+7
He describes it as "The remaining parameters all relate to sizes of the data fields that describe the USB device. Nothing to do here but count bytes in the usb_desc.c file."
How do I get those values from this...
static uint8_t arcade_report_desc[] = {
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x04, // USAGE (Joystick)
0xa1, 0x01, // COLLECTION (Application)
0x09, 0x04, // USAGE (Joystick)
0xa1, 0x00, // COLLECTION (Physical)
0x09, 0x30, // USAGE (X)
0x09, 0x31, // USAGE (Y)
0x09, 0x33, // USAGE (Rx)
0x09, 0x34, // USAGE (Ry)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x04, // REPORT_COUNT (4)
0x45, 0x7f, // PHYSICAL_MAXIMUM (127)
0x35, 0x81, // PHYSICAL_MINIMUM (-127)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x05, 0x09, // USAGE_PAGE (Button)
0x19, 0x01, // USAGE_MINIMUM (Button 1)
0x29, 0x10, // USAGE_MAXIMUM (Button 16)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x01, // LOGICAL_MAXIMUM (1)
0x75, 0x01, // REPORT_SIZE (1)
0x95, 0x10, // REPORT_COUNT (16)
0x81, 0x02, // INPUT (Data,Var,Abs)
0xc0, // END_COLLECTION
0xc0 // END_COLLECTION
};
This is his example. I was thinking his was a little simpler so if someone can explain how to do it with his I can then figure mine out.
Oh yeah and one more question. Does the arduino software always recognize the arduino/teensy board when you plug it in regardless of the USB descripter that has been uploaded to it? or does a part of it define that? I'm just worried that if I get rid of the wrong thing I might not be able to upload anything else to it because the software will not recognize it.
I apologize I am a bit of a newbee to microcontrollers and coding stuff. I am in the process of creating a joystick interface with the teensy board. I would like to create my own customized USB descripter that uses 2 16 bit axis controllers and 32 buttons. I have followed hamaluik's tutorial for doing just this (located here http://hamaluik.com/posts/making-a-custom-teensy3-hid-joystick/) but I am hung up on the portion regarding byte count that is supposed to be inserted in the usb_desc.h file.
#define ARCADE_DESC_OFFSET (9)
#define CONFIG_DESC_SIZE (9 + 9+9+7)
I don't understand how you come up with 9 and 9 + 9+9+7
He describes it as "The remaining parameters all relate to sizes of the data fields that describe the USB device. Nothing to do here but count bytes in the usb_desc.c file."
How do I get those values from this...
static uint8_t arcade_report_desc[] = {
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x04, // USAGE (Joystick)
0xa1, 0x01, // COLLECTION (Application)
0x09, 0x04, // USAGE (Joystick)
0xa1, 0x00, // COLLECTION (Physical)
0x09, 0x30, // USAGE (X)
0x09, 0x31, // USAGE (Y)
0x09, 0x33, // USAGE (Rx)
0x09, 0x34, // USAGE (Ry)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x04, // REPORT_COUNT (4)
0x45, 0x7f, // PHYSICAL_MAXIMUM (127)
0x35, 0x81, // PHYSICAL_MINIMUM (-127)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x05, 0x09, // USAGE_PAGE (Button)
0x19, 0x01, // USAGE_MINIMUM (Button 1)
0x29, 0x10, // USAGE_MAXIMUM (Button 16)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x01, // LOGICAL_MAXIMUM (1)
0x75, 0x01, // REPORT_SIZE (1)
0x95, 0x10, // REPORT_COUNT (16)
0x81, 0x02, // INPUT (Data,Var,Abs)
0xc0, // END_COLLECTION
0xc0 // END_COLLECTION
};
This is his example. I was thinking his was a little simpler so if someone can explain how to do it with his I can then figure mine out.
Oh yeah and one more question. Does the arduino software always recognize the arduino/teensy board when you plug it in regardless of the USB descripter that has been uploaded to it? or does a part of it define that? I'm just worried that if I get rid of the wrong thing I might not be able to upload anything else to it because the software will not recognize it.