Hello,
i'm trying to create a joystick using my Teensy 3.6... When using default "12" size joystick, everythings work fine. But this joystick is declared with more axes than i need and a 10 bit resolution (0-1023).
What i would have is a 2 axes joystick (X and Y) with a 16bit resolution (0-65535 value) and 32 buttons.
Trying to get this done, i've ended with this par of code to include in the "usb_desc.c" file. But when selected, i've got a compliation error : 'class usb_joystick_class' has no member named 'X' (X is the X axis, wand the main code works well, when using defualt joystick setting.
So the error is in my .c file, here is the stuff that i've added :
....
I've spent some time on this without results... any help is welcome and merry christmas !
i'm trying to create a joystick using my Teensy 3.6... When using default "12" size joystick, everythings work fine. But this joystick is declared with more axes than i need and a 10 bit resolution (0-1023).
What i would have is a 2 axes joystick (X and Y) with a 16bit resolution (0-65535 value) and 32 buttons.
Trying to get this done, i've ended with this par of code to include in the "usb_desc.c" file. But when selected, i've got a compliation error : 'class usb_joystick_class' has no member named 'X' (X is the X axis, wand the main code works well, when using defualt joystick setting.
So the error is in my .c file, here is the stuff that i've added :
Code:
#ifdef JOYSTICK_INTERFACE
#if JOYSTICK_SIZE == 9
// 32 buttons 4
// 2 axes 4
// 4 pov 1
static uint8_t joystick_report_desc[] = {
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x04, // Usage (Joystick)
0xA1, 0x01, // Collection (Application)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x75, 0x01, // Report Size (1)
0x95, 0x20, // Report Count (32)
0x05, 0x09, // Usage Page (Button)
0x19, 0x01, // Usage Minimum (Button #1)
0x29, 0x20, // Usage Maximum (Button #32)
0x81, 0x02, // Input (variable,absolute)
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x01, // Usage (Pointer)
0xA1, 0x00, // Collection ()
0x15, 0x00, // Logical Minimum (0)
0x27, 0xFF, 0xFF, 0, 0, // Logical Maximum (65535)
0x75, 0x10, // Report Size (16)
0x95, 2, // Report Count (2)
0x09, 0x30, // Usage (X)
0x09, 0x31, // Usage (Y)
0x81, 0x02, // Input (variable,absolute)
0xC0, // End Collection
0x15, 0x00, // Logical Minimum (0)
0x25, 0x07, // Logical Maximum (7)
0x35, 0x00, // Physical Minimum (0)
0x46, 0x3B, 0x01, // Physical Maximum (315)
0x75, 0x04, // Report Size (4)
0x95, 0x02, // Report Count (1)
0x65, 0x14, // Unit (20)
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x39, // Usage (Hat switch)
0x81, 0x42, // Input (variable,absolute,null_state)
0xC0 // End Collection
};
#elif JOYSTICK_SIZE == 12
I've spent some time on this without results... any help is welcome and merry christmas !