Forum Rule: Always post complete source code & details to reproduce any issue!
Page 10 of 10 FirstFirst ... 8 9 10
Results 226 to 228 of 228

Thread: Many axis joystick

  1. #226
    Junior Member
    Join Date
    Apr 2020
    Posts
    3
    Is it possible with the current teensyduino 1.56 and arduino IDE to get the teensy 2.0++ with 64 or 128 joystick buttons working somehow? I have encountered the files for teensy 3 and teensy 4, but not for the 2.

  2. #227
    Junior Member
    Join Date
    Apr 2020
    Posts
    3
    I have ordered myself a Teensy 3.2 to get around this.
    The 128 buttons are working fine by editing the header file. However the axis do not seem to respond, even when not assigned to analogreads but just sending values. As soon as a button is sent as a joystick "command", all axis get reset to 0 and the hat switches have angle 0. No axis change can be manipulated.

  3. #228
    So this is something that I have been working on for a while and actually have had working for a while..

    THIS HID Header Stack that I figured out some months ago should give you all you need to get an extended Joystick Working properly WITH backwards compatibility to Legacy Windows HID Devices..

    Even though this is an extended joystick I have been able to get full referencing in the standard Windows HID Tester..

    NOTE: this is for the Teensy 3 and LC for sure.. not sure if the setup is the same for other Teensy's but the header stack should work anywhere.

    These Headers will offer up a Joystick with the capability of:

    128 - Buttons
    6 - Primary Axes (16bit)
    4 - Hats
    17 - Sliders (16bit)

    You can adjust these but in order to see the HID backwards compatibility you will not want to change the
    // Collection (Axes) - Default Axis Collection or the
    // Collection (Axes) - Default Slider Collection sections.

    This goes into the usb_dec.c file replacing the JOYSTICK_SIZE == 64 section, you must set the rest of the system to use this set of descriptors.

    Code:
    #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
    I hope this helps those trying to make a Workable Extended Joystick as it took a lot of Research and trial and error to figure these out.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •