#elif JOYSTICK_SIZE == 64
// extreme joystick (to use this, edit JOYSTICK_SIZE to 64 in usb_desc.h)
// 128 buttons 16
// 6 axes 12
// 4 pov 2
// 17 sliders 34
static uint8_t joystick_report_desc[] = {
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x04, // Usage (Joystick)
0xA1, 0x01, // Collection (Application)
0xA1, 0x00, // Collection (Buttons)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x75, 0x01, // Report Size (1)
0x95, 0x80, // Report Count (128)
0x05, 0x09, // Usage Page (Button)
0x19, 0x01, // Usage Minimum (Button #1)
0x29, 0x80, // Usage Maximum (Button #128)
0x81, 0x02, // Input (variable,absolute)
0xC0, // End Collection
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x01, // Usage (Pointer)
0xA1, 0x00, // Collection (Axes) - Default Axis Collection
0x15, 0x00, // Logical Minimum (0)
0x27, 0xFF, 0xFF, 0x00, 0x00, // Logical Maximum (65535)
0x75, 0x10, // Report Size (16)
0x95, 0x06, // Report Count (6)
0x09, 0x30, // Usage (X) DX X
0x09, 0x31, // Usage (Y) DX Y
0x09, 0x32, // Usage (Z) DXSlider #1
0x09, 0x33, // Usage (Rx) DX Rx
0x09, 0x34, // Usage (Ry) DX Ry
0x09, 0x35, // Usage (Rz) DX Rz
0x81, 0x42, // Input (variable,absolute,null_state)
0xC0, // End Collection
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x01, // Usage (Pointer)
0xA1, 0x00, // Collection (Axes) - Default Slider Collection
0x15, 0x00, // Logical Minimum (0)
0x27, 0xFF, 0xFF, 0x00, 0x00, // Logical Maximum (65535)
0x75, 0x10, // Report Size (16)
0x95, 0x02, // Report Count (2)
0x09, 0x36, // Usage (Slider) DX Z
0x09, 0x36, // Usage (Slider) DXSlider #2
0x81, 0x42, // Input (variable,absolute,null_state)
0xC0, // End Collection
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x01, // Usage (Pointer)
0xA1, 0x00, // Collection (Axes)
0x15, 0x00, // Logical Minimum (0)
0x27, 0xFF, 0xFF, 0x00, 0x00, // Logical Maximum (65535)
0x75, 0x10, // Report Size (16)
0x95, 0x0F, // Report Count (15)
0x09, 0x36, // Usage (Slider) DXSlider #17
0x09, 0x36, // Usage (Slider) DXSlider #16
0x09, 0x36, // Usage (Slider) DXSlider #15
0x09, 0x36, // Usage (Slider) DXSlider #14
0x09, 0x36, // Usage (Slider) DXSlider #13
0x09, 0x36, // Usage (Slider) DXSlider #12
0x09, 0x36, // Usage (Slider) DXSlider #11
0x09, 0x36, // Usage (Slider) DXSlider #10
0x09, 0x36, // Usage (Slider) DXSlider #9
0x09, 0x36, // Usage (Slider) DXSlider #8
0x09, 0x36, // Usage (Slider) DXSlider #7
0x09, 0x36, // Usage (Slider) DXSlider #6
0x09, 0x36, // Usage (Slider) DXSlider #5
0x09, 0x36, // Usage (Slider) DXSlider #4
0x09, 0x36, // Usage (Slider) DXSlider #3
0x81, 0x42, // Input (variable,absolute,null_state)
0xC0, // End Collection
0x05, 0x01, // Usage Page (Generic Desktop)
0xA1, 0x00, // Collection (Hats)
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, 0x04, // Report Count (3)
0x65, 0x14, // Unit (Eng Rot: Degree)
0x09, 0x39, // Usage (Hat switch)
0x09, 0x39, // Usage (Hat switch)
0x09, 0x39, // Usage (Hat switch)
0x09, 0x39, // Usage (Hat switch)
0x81, 0x02, // Input (variable,absolute,null_state)
0xC0, // End Collection
0xC0 // End Collection
};
#endif // JOYSTICK_SIZE
Hello all, I am currently working on a button box using a Teensy 4.1 and the extreme joystick "setting". I have got all of the buttons functioning but my four sliders (https://uk.farnell.com/bourns/ptv09a-4020u-b104/pot-rotary-100kohm-9mm-20/dp/2469526) are not being read correctly.
I am using the Joystick test program that was posted in this thread a few years ago to test the button box and using DCS World (Flight Sim that can handle all the inputs) as back up testing.
The issue is when not using the extreme joystick "setting" the first 32 buttons work fine and so do all four pots, but when I use the extreme "setting" all of my buttons work (38 in total) but the effect my pots have in joystick test are negligible and are not picked up by DCS. In my code I added a serial print for the
analogue values being read from the pots and they are working fine (reading between 0 and 1023 as expected).
My belief is that the Teensy is reading the pots in 10bit but for some reason windows (and there for both my testing programs) are reading the number in 16bit.
Any help on this matter would be greatly appreciated with either changing what windows sees or what the Teensy sees.
Thank you for the response, I have now modified my usb_dec.c file, as backwards compatibility is always a good thing, but alas my issue still persists. I am getting minute movement on the X and Y axis and no movement being picked up on Z and Xrotate.
I have currently got it working via brute force. I have mapped all of the pot outputs to 0-65535 instead of 0-1023 and it works now.
Actually that would be what you have to do.. With the USB Headers that I developed above it has (17) 16bit sliders.. SO if you were only sending 10bit data raw there would be only minor movement on the sliders.. You need to use the map() function to remap the 1024 output to a 65535 output to use them without having to modify the header file.. You can modify the header file to tell windows that the sliders are 1024 (10bit) but that is definitely more involved.. The good side of doing that would be that you would not have to be doing the mapping calculations..
#elif defined(USB_HID)
#define VENDOR_ID 0x16C0
#define PRODUCT_ID 0x0482
#define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
#define MANUFACTURER_NAME_LEN 11
#define PRODUCT_NAME {'H','I','D','-','J','o','y','s','t','i','c','k'}
#define PRODUCT_NAME_LEN 12
#define EP0_SIZE 64
#define NUM_ENDPOINTS 3
#define NUM_USB_BUFFERS 24
#define NUM_INTERFACE 2
#define SEREMU_INTERFACE 1 // Serial emulation
#define SEREMU_TX_ENDPOINT 2
#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 JOYSTICK_INTERFACE 3 // Joystick
#define JOYSTICK_ENDPOINT 3
#define JOYSTICK_SIZE 64 // 12 = normal, 64 = extreme joystick
#define JOYSTICK_INTERVAL 1
#define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
#define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
Unclear from your question. Do you need the normal Serial port or only the ability for Serial monitor? Why I am asking is that by the"Hello, after setup my custom joystick, I want to have the interface USB Serial and Joystick only. However, the COM port doesn't appear, so I can't use the serial monitor. Can anyone help me?"
Thankyou so much for your reply. yes i want serial monitor.Unclear from your question. Do you need the normal Serial port or only the ability for Serial monitor? Why I am asking is that by the
looks of your USB descriptor, it looks like you have defined
I am assuming T3.x as your listing matches the USB_HID data minus keyboard and mouse.
If you are needing normal serial as well, you should look at the next section of the usb_desc.h
USB_SERIAL_HID which is setup to create a normal serial port, like COM10 or the like on windows (10 was just example)
#elif defined(USB_HID)
#define VENDOR_ID 0x16C0
#define PRODUCT_ID 0x0482
#define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
#define MANUFACTURER_NAME_LEN 11
#define PRODUCT_NAME {'H','I','D','-','J','o','y','s','t','i','c','k'}
#define PRODUCT_NAME_LEN 12
#define EP0_SIZE 64
#define NUM_ENDPOINTS 4
#define NUM_USB_BUFFERS 24
#define NUM_INTERFACE 3
#define CDC_IAD_DESCRIPTOR 1
#define CDC_STATUS_INTERFACE 0
#define CDC_DATA_INTERFACE 1 // Serial
#define CDC_ACM_ENDPOINT 2
#define CDC_RX_ENDPOINT 3
#define CDC_TX_ENDPOINT 3
#define CDC_ACM_SIZE 16
#define CDC_RX_SIZE_480 512
#define CDC_TX_SIZE_480 512
#define CDC_RX_SIZE_12 64
#define CDC_TX_SIZE_12 64
#define JOYSTICK_INTERFACE 3 // Joystick
#define JOYSTICK_ENDPOINT 4
#define JOYSTICK_SIZE 64 // 12 = normal, 64 = extreme joystick
#define JOYSTICK_INTERVAL 1
#define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
#define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
#define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
Thank you! I have been pulling my hair out for days! I finally buckled down and just started reading EVERY comment on this post. How to fix slider 0 by using slider 17 Now I gotta figure out slider 1!I solved my issue, I was unaware that number 17 corresponded to slider 0, makes no sense to me :/
Joystick.slider(17, 512 * 64);
Joystick.slider(16, 128 * 64);