Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 8 of 8

Thread: Teensy 3.1 Midi Footpedal, possible to send Keystrokes as well as Midi Messages?

  1. #1

    Teensy 3.1 Midi Footpedal, possible to send Keystrokes as well as Midi Messages?

    Hey everybody!
    I have built a 15 button midi footpedal a while ago and am currently working on getting the code to the level I would like it to be.
    Since I am using the pedal with Ableton Live it would be very helpful for me to send midi messages as well as keystrokes at the same time
    (to use delete as well as ctrl-z during live loop recordings, both triggered when one of the buttons remains pushed down for more than three seconds, so far the function i wrote is only for button1 and bankbutton..)
    I can do this with an additional software like bome's midi translator, that translates midi to keyboard messages, but would prefer to keep it on the teensy,
    if that is possible.
    Now, so far I have gotten the midi to run fine, however, it seems that I can only use keystrokes after changing the usb type.
    Is there an easy way to have the board run as both midi and keystroke usb device?
    I have searched online and the forum, but not found any answer.
    I'm new to coding, that is why easy would be better... not on the level of changing libraries, etc yet

    down below is the code. as you can see I am having problems simplifying the bounce buttons into a forloop, if anybody has some advice to give on that,
    please do, but it is not as urgent as the keyboard msgs.

    thanks for your help, wise ones of the forum!

    Code:
    
                                       //LCD & SHIELD Libraries
      #include <Wire.h>
      #include <Adafruit_MCP23017.h>
      #include <Adafruit_RGBLCDShield.h>
      Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();
                                  // LCD backlight color
      #define RED 0x1
      #define YELLOW 0x3
      #define GREEN 0x2
      #define TEAL 0x6
      #define BLUE 0x4
      #define VIOLET 0x5
      #define WHITE 0x7
                                  //Pushbuttons Debounce Library
      #include <Bounce.h>
                                  //Midi Library
      #include <MIDI.h>
      const int MIDI_CHAN = 5;
      
      #define BUTTONBANK 6         //bankswitch button
      #define BUTTONSTOP 11        //stop button (not part of bank)
      #define BUTTONPLAY 23        //play (not part of bank)
      #define CTRLBUTTONS_N 12     //ctrl buttons used to trigger clips
      #define NUM_BANKS 2
      #define CTRL_DEL
      #define CTRL_STOP 71
      #define CTRL_PLAY 72
      #define CTRL_START 72      //begin of control values available to footpedal (71-128) 1 gets added in the code
      int bank = 0;
    
      #define CTRLBUTTONS_N 12
      int buttonPins[] = {2,3,4,5,/*6,*/7,8,9,10,/*11,*/12,20,21,22,/*23*/};  //All button pins except bank, stop and play button
      // int buttons[CTRLBUTTONS_N];
    
      Bounce buttonBank = Bounce(BUTTONBANK, 50);                  
      Bounce buttonStop = Bounce(BUTTONSTOP, 50);
      Bounce buttonPlay = Bounce (BUTTONPLAY, 50);
      
      /*for(int i = 0; i < CTRLBUTTONS_N; i++){                    //BOUNCE FORLOOP HOW???
      Bounce buttons[i] = Bounce (buttonPins[i], 20); 
      }
      */
    
      Bounce button0 = Bounce (buttonPins[0], 50); 
      Bounce button1 = Bounce (buttonPins[1], 50); 
      Bounce button2 = Bounce (buttonPins[2], 50); 
      Bounce button3 = Bounce (buttonPins[3], 50);
      Bounce button4 = Bounce (buttonPins[4], 50);
      Bounce button5 = Bounce (buttonPins[5], 50);
      Bounce button6 = Bounce (buttonPins[6], 50);
      Bounce button7 = Bounce (buttonPins[7], 50);
      Bounce button8 = Bounce (buttonPins[8], 50);
      Bounce button9 = Bounce (buttonPins[9], 50);
      Bounce button10 = Bounce (buttonPins[10], 50);
      Bounce button11 = Bounce (buttonPins[11], 50);
      
      int bankadd = 0;
    
      unsigned long millisTime;                     //millis del-keystroke variables
      unsigned long delTime[CTRLBUTTONS_N];         //for now without arrays...         
      bool delBool[CTRLBUTTONS_N];
      int delHold = 2000;                           //time to hold down buttons to send del-msg
      unsigned long redoTime;
      bool redoBool;
      int redoHold = 2000;
    
      
    void setup(){  
                                 
      Serial.begin(9600);
      
      pinMode (BUTTONBANK, INPUT_PULLUP);
      pinMode (BUTTONSTOP, INPUT_PULLUP);
      pinMode (BUTTONPLAY, INPUT_PULLUP);
      
    //  for(int i=0; i<CTRLBUTTONS_N; i++){                    //PULLUP FORLOOP
    //    pinMode (buttonPins[i], INPUT_PULLUP);
    //  }  
      
      pinMode(buttonPins[0], INPUT_PULLUP);
      pinMode(buttonPins[1], INPUT_PULLUP);
      pinMode(buttonPins[2], INPUT_PULLUP);
      pinMode(buttonPins[3], INPUT_PULLUP);
      pinMode(buttonPins[4], INPUT_PULLUP);
      pinMode(buttonPins[5], INPUT_PULLUP);
      pinMode(buttonPins[6], INPUT_PULLUP);
      pinMode(buttonPins[7], INPUT_PULLUP);
      pinMode(buttonPins[8], INPUT_PULLUP);
      pinMode(buttonPins[9], INPUT_PULLUP);
      pinMode(buttonPins[10], INPUT_PULLUP);
      pinMode(buttonPins[11], INPUT_PULLUP);
                              
      lcd.begin(16, 2);                         //LCD START
     
      lcd.clear();            
      lcd.setCursor(0, 0);
      lcd.print("START");
     
      Serial.println("serial start"); 
    
      for(int i=0; i<CTRLBUTTONS_N; i++){             //reset all del and redo Variables
        delTime[i]=0;
        delBool[i]=false;
      }
      redoTime=0;
      redoBool=false;
      
    }
    
    void loop(){
    
      millisTime = millis();                  //time var running WHATS THE MAX MILLIS VALUE?
      
      while (usbMIDI.read());   
    
      readButtons();
    
      if(buttonBank.fallingEdge()) {     //3 banks, Button+/-, Print LCD and Serial 
        bank++;
        bank %= NUM_BANKS;
        lcd.clear();
        lcd.setCursor(0, 0);
        lcd.print("Bank ");
        lcd.print(bank);
        Serial.print("Bank ");
        Serial.println(bank);
        redoTime=millisTime;
        redoBool=true;
      }
      if (buttonBank.risingEdge()) {
          redoBool=false;
        }
      if (millisTime-redoTime>=redoHold && redoBool==true) {
          redoBool=false;
          Serial.println ("Redo ");
          lcd.clear();
          lcd.setCursor(0,0);
          lcd.print("Redo ");
        }
    
    
    
      bankadd = bank * CTRLBUTTONS_N;     //ATTENTION THAT HE READS 12 HERE
                  
                                  // PUSHBUTTON EDGE DECLARATION
     // for(int i=0; i<CTRLBUTTONS_N; i++){   
    
    
        if (buttonStop.fallingEdge()) {
          usbMIDI.sendControlChange((CTRL_STOP), 127, MIDI_CHAN);
          lcd.clear();
          lcd.setCursor(0,0);
          lcd.print("Stop ");
          Serial.println(String("ch=") + MIDI_CHAN + (", Control=") + (CTRL_STOP) + ("Velocity=127"));
        }
       
        if (buttonPlay.fallingEdge()) {
          usbMIDI.sendControlChange((CTRL_PLAY), 127, MIDI_CHAN);
          lcd.clear();
          lcd.setCursor(0,0);
          lcd.print("Play ");
          Serial.println(String("ch=") + MIDI_CHAN + (", Control=") + (CTRL_PLAY) + ("Velocity=127"));
        }
    
     
        if (button0.fallingEdge()) {
          usbMIDI.sendControlChange((CTRL_START+bankadd+1), 127, MIDI_CHAN);
          lcd.clear();
          lcd.setCursor(0,0);
          lcd.print("CTRL ");
          lcd.print (CTRL_START+bankadd+1);
          Serial.println(String("ch=") + MIDI_CHAN + (", Control=") + (CTRL_START+bankadd+1) + ("Velocity=127"));
          delTime[0]=millisTime;
          delBool[0]=true;
        }
        if (button0.risingEdge()) {
          delBool[0]=false;
        }
        
                                                                      //put this into forloop  
        if (millisTime-delTime[0]>=delHold && delBool[0]==true) {
          delBool[0]=false;
          Serial.println ("DELETE ");
          lcd.clear();
          lcd.setCursor(0,0);
          lcd.print("Delete ");
        }
    
    
           
        else if (button1.fallingEdge()) {
          usbMIDI.sendControlChange((CTRL_START+bankadd+2), 127, MIDI_CHAN);
          lcd.clear();
          lcd.setCursor(0,0);
          lcd.print("CTRL ");
          lcd.print (CTRL_START+bankadd+2);
          Serial.println(String("ch=") + MIDI_CHAN + (", Control=") + (CTRL_START+bankadd+2) + ("Velocity=127"));
        }
        else if (button2.fallingEdge()) {
          usbMIDI.sendControlChange((CTRL_START+bankadd+3), 127, MIDI_CHAN);
          lcd.clear();
          lcd.setCursor(0,0);
          lcd.print("CTRL ");
          lcd.print (CTRL_START+bankadd+3);
          Serial.println(String("ch=") + MIDI_CHAN + (", Control=") + (CTRL_START+bankadd+3) + ("Velocity=127"));
        }
        else if (button3.fallingEdge()) {
          usbMIDI.sendControlChange((CTRL_START+bankadd+4), 127, MIDI_CHAN);
          lcd.clear();
          lcd.setCursor(0,0);
          lcd.print("CTRL ");
          lcd.print (CTRL_START+bankadd+4);
          Serial.println(String("ch=") + MIDI_CHAN + (", Control=") + (CTRL_START+bankadd+4) + ("Velocity=127"));
        }
        else if (button4.fallingEdge()) {
          usbMIDI.sendControlChange((CTRL_START+bankadd+5), 127, MIDI_CHAN);
          lcd.clear();
          lcd.setCursor(0,0);
          lcd.print("CTRL ");
          lcd.print (CTRL_START+bankadd+5);
          Serial.println(String("ch=") + MIDI_CHAN + (", Control=") + (CTRL_START+bankadd+5) + ("Velocity=127"));
        }
        else if (button5.fallingEdge()) {
          usbMIDI.sendControlChange((CTRL_START+bankadd+6), 127, MIDI_CHAN);
          lcd.clear();
          lcd.setCursor(0,0);
          lcd.print("CTRL ");
          lcd.print (CTRL_START+bankadd+6);
          Serial.println(String("ch=") + MIDI_CHAN + (", Control=") + (CTRL_START+bankadd+6) + ("Velocity=127"));
        }
        else if (button6.fallingEdge()) {
          usbMIDI.sendControlChange((CTRL_START+bankadd+7), 127, MIDI_CHAN);
          lcd.clear();
          lcd.setCursor(0,0);
          lcd.print("CTRL ");
          lcd.print (CTRL_START+bankadd+7);
          Serial.println(String("ch=") + MIDI_CHAN + (", Control=") + (CTRL_START+bankadd+7) + ("Velocity=127"));
        }
        else if (button7.fallingEdge()) {
          usbMIDI.sendControlChange((CTRL_START+bankadd+8), 127, MIDI_CHAN);
          lcd.clear();
          lcd.setCursor(0,0);
          lcd.print("CTRL ");
          lcd.print (CTRL_START+bankadd+8);
          Serial.println(String("ch=") + MIDI_CHAN + (", Control=") + (CTRL_START+bankadd+8) + ("Velocity=127"));
        }
        else if (button8.fallingEdge()) {
          usbMIDI.sendControlChange((CTRL_START+bankadd+9), 127, MIDI_CHAN);
          lcd.clear();
          lcd.setCursor(0,0);
          lcd.print("CTRL ");
          lcd.print (CTRL_START+bankadd+9);
          Serial.println(String("ch=") + MIDI_CHAN + (", Control=") + (CTRL_START+bankadd+9) + ("Velocity=127"));
        }
        else if (button9.fallingEdge()) {
          usbMIDI.sendControlChange((CTRL_START+bankadd+10), 127, MIDI_CHAN);
          lcd.clear();
          lcd.setCursor(0,0);
          lcd.print("CTRL ");
          lcd.print (CTRL_START+bankadd+10);
          Serial.println(String("ch=") + MIDI_CHAN + (", Control=") + (CTRL_START+bankadd+10) + ("Velocity=127"));
        }
         else if (button10.fallingEdge()) {
          usbMIDI.sendControlChange((CTRL_START+bankadd+11), 127, MIDI_CHAN);
          lcd.clear();
          lcd.setCursor(0,0);
          lcd.print("CTRL ");
          lcd.print (CTRL_START+bankadd+11);
          Serial.println(String("ch=") + MIDI_CHAN + (", Control=") + (CTRL_START+bankadd+11) + ("Velocity=127"));
        }
        else if (button11.fallingEdge()) {
          usbMIDI.sendControlChange((CTRL_START+bankadd+12), 127, MIDI_CHAN);
          lcd.clear();
          lcd.setCursor(0,0);
          lcd.print("CTRL ");
          lcd.print (CTRL_START+bankadd+12);
          Serial.println(String("ch=") + MIDI_CHAN + (", Control=") + (CTRL_START+bankadd+12) + ("Velocity=127"));
        }
    
      
    }
    
    
    void readButtons(){
      buttonBank.update();
      buttonStop.update();
      buttonPlay.update();
      button0.update();
      button1.update();
      button2.update();
      button3.update();
      button4.update();
      button5.update();
      button6.update();
      button7.update();
      button8.update();
      button9.update();
      button10.update();
      button11.update();
    }

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,606
    You'll need to edit usb_desc.h to create a custom USB type.

  3. #3
    Ok, thanks! That was quick! What lines would I need to edit, and how? I'm sorry to ask such a dumb question, but my knowledge is really limited, I was just barely able to write the code for the pedal... I have found the file, but am not really sure what the different lines mean..

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,606
    There's a lengthy comment at the top of the file which explains the basic process.

    Here's some prior threads:

    https://forum.pjrc.com/threads/26024...a-new-USB-type

    https://forum.pjrc.com/threads/23803...W-HID-Keyboard

    https://forum.pjrc.com/threads/30238...awHID-Keyboard

    https://forum.pjrc.com/threads/26579...Trio-on-Teensy

    https://forum.pjrc.com/threads/26441...-and-USB-Types

    https://forum.pjrc.com/threads/25122...-keyboard-only

    Some of these are older than Teensyduino version 1.21, which simplified this process, mainly by eliminating the step to manually add up the sizes. If you see stuff about adding up the bytes, that's no longer necessary. But you do have to assign unique endpoint numbers and make some other choices. Hopefully these examples will help?

  5. #5
    Great, the examples were really helpful! Its working, thank you so much!!!

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,606
    Any chance you might share your usb_desc.h edits? They might help the next person who needs to do this.

  7. #7
    hey, yeah of course! sry for the late reply, am traveling at the moment and only have internet sporadically...

  8. #8
    as said, I needed midi combined with keyboard send functions. in case anybody is working with ableton live and live looping i can only recommend this as a solution to the clip delete problems. i have built my own midi footpedal but read on several blogs that many other people have problems with looping in live since you cannot delete clips with standard midi pedals (which is necessary in case you record a false loop, etc). im not sure if that is a problem with midi controllers specifically created for ableton, or specific ipad ableton apps, etc, but many people seem to have that problem in live with diy or standard midi machines. one way around is an in between midi software that changes midi messages to key messages, like bome (in which case you sometimes need another software do differentiate into midi channels, otherwise bome doesnt work alongside ableton), but i prefer to keep it simple and send everything directly from the teensy. this now seems to be a great solution to me. you can activate a clip by pressing a button on the pedal and sending a ctrl midi message, and in case you want to stop the clip playing (toggle in ableton) press it again. if you keep the button pressed, a countdown starts and if the button is not released within 2 seconds, teensy sends a KEY_DEL which deletes the clip. another button sends a CTRL_Z do undo wrong steps. since ableton activate clips on tigger i can record/start/stop/delete 4*3 clips clicking only one button at a time without changing banks on my pedal.
    so, the pedal as i programmed it functions very similar to a standard analog looper, like boss or others, which at least to me is pretty intuitiv.


    so, this link paul sent me really helped:
    https://forum.pjrc.com/threads/26024...a-new-USB-type
    namely, the step by step example from lhagan. i basically did everything exactly like that, except doing the xyz stuff, since that is not part of the code in the usb_desc.h anymore anyway as far as i could see..

    so, here is my old usb_desc.h:
    Code:
    /* Teensyduino Core Library
     * http://www.pjrc.com/teensy/
     * Copyright (c) 2013 PJRC.COM, LLC.
     *
     * Permission is hereby granted, free of charge, to any person obtaining
     * a copy of this software and associated documentation files (the
     * "Software"), to deal in the Software without restriction, including
     * without limitation the rights to use, copy, modify, merge, publish,
     * distribute, sublicense, and/or sell copies of the Software, and to
     * permit persons to whom the Software is furnished to do so, subject to
     * the following conditions:
     *
     * 1. The above copyright notice and this permission notice shall be
     * included in all copies or substantial portions of the Software.
     *
     * 2. If the Software is incorporated into a build system that allows
     * selection among a list of target devices, then similar target
     * devices manufactured by PJRC.COM must be included in the list of
     * target devices and selectable in the same manner.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
     * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
     * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
     * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
     * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
     * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
     * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
     * SOFTWARE.
     */
    
    #ifndef _usb_desc_h_
    #define _usb_desc_h_
    
    // This header is NOT meant to be included when compiling
    // user sketches in Arduino.  The low-level functions
    // provided by usb_dev.c are meant to be called only by
    // code which provides higher-level interfaces to the user.
    
    #include <stdint.h>
    #include <stddef.h>
    
    #define ENDPOINT_UNUSED			0x00
    #define ENDPOINT_TRANSIMIT_ONLY		0x15
    #define ENDPOINT_RECEIVE_ONLY		0x19
    #define ENDPOINT_TRANSMIT_AND_RECEIVE	0x1D
    
    /*
    Each group of #define lines below corresponds to one of the
    settings in the Tools > USB Type menu.  This file defines what
    type of USB device is actually created for each of those menu
    options.
    
    Each "interface" is a set of functionality your PC or Mac will
    use and treat as if it is a unique device.  Within each interface,
    the "endpoints" are the actual communication channels.  Most
    interfaces use 1, 2 or 3 endpoints.  By editing only this file,
    you can customize the USB Types to be any collection of interfaces.
    
    To modify a USB Type, delete the XYZ_INTERFACE lines for any
    interfaces you wish to remove, and copy them from another USB Type
    for any you want to add.
    
    Give each interface a unique number, and edit NUM_INTERFACE to
    reflect the total number of interfaces.
    
    Next, assign unique endpoint numbers to all the endpoints across
    all the interfaces your device has.  You can reuse an endpoint
    number for transmit and receive, but the same endpoint number must
    not be used twice to transmit, or twice to receive.
    
    Most endpoints also require their maximum size, and some also
    need an interval specification (the number of milliseconds the
    PC will check for data from that endpoint).  For existing
    interfaces, usually these other settings should not be changed.
    
    Edit NUM_ENDPOINTS to be at least the largest endpoint number used.
    
    Edit NUM_USB_BUFFERS to control how much memory the USB stack will
    allocate.  At least 2 should be used for each endpoint.  More
    memory will allow higher throughput for user programs that have
    high latency (eg, spending time doing things other than interacting
    with the USB).
    
    Edit the ENDPOINT*_CONFIG lines so each endpoint is configured
    the proper way (transmit, receive, or both).
    
    If you are using existing interfaces (making your own device with
    a different set of interfaces) the code in all other files should
    automatically adapt to the new endpoints you specify here.
    
    If you need to create a new type of interface, you'll need to write
    the code which sends and receives packets, and presents an API to
    the user.  Usually, a pair of files are added for the actual code,
    and code is also added in usb_dev.c for any control transfers,
    interrupt-level code, or other very low-level stuff not possible
    from the packet send/receive functons.  Code also is added in
    usb_inst.c to create an instance of your C++ object.
    
    You may edit the Vendor and Product ID numbers, and strings.  If
    the numbers are changed, Teensyduino may not be able to automatically
    find and reboot your board when you click the Upload button in
    the Arduino IDE.  You will need to press the Program button on
    Teensy to initiate programming.
    
    Some operating systems, especially Windows, may cache USB device
    info.  Changes to the device name may not update on the same
    computer unless the vendor or product ID numbers change, or the
    "bcdDevice" revision code is increased.
    
    If these instructions are missing steps or could be improved, please
    let me know?  http://forum.pjrc.com/forums/4-Suggestions-amp-Bug-Reports
    */
    
    
    #if defined(USB_SERIAL)
      #define VENDOR_ID		0x16C0
      #define PRODUCT_ID		0x0483
      #define DEVICE_CLASS		2	// 2 = Communication Class
      #define MANUFACTURER_NAME	{'T','e','e','n','s','y','d','u','i','n','o'}
      #define MANUFACTURER_NAME_LEN	11
      #define PRODUCT_NAME		{'U','S','B',' ','S','e','r','i','a','l'}
      #define PRODUCT_NAME_LEN	10
      #define EP0_SIZE		64
      #define NUM_ENDPOINTS		4
      #define NUM_USB_BUFFERS	12
      #define NUM_INTERFACE		2
      #define CDC_STATUS_INTERFACE	0
      #define CDC_DATA_INTERFACE	1
      #define CDC_ACM_ENDPOINT	2
      #define CDC_RX_ENDPOINT       3
      #define CDC_TX_ENDPOINT       4
      #define CDC_ACM_SIZE          16
      #define CDC_RX_SIZE           64
      #define CDC_TX_SIZE           64
      #define ENDPOINT2_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT3_CONFIG	ENDPOINT_RECEIVE_ONLY
      #define ENDPOINT4_CONFIG	ENDPOINT_TRANSIMIT_ONLY
    
    #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		{'K','e','y','b','o','a','r','d','/','M','o','u','s','e','/','J','o','y','s','t','i','c','k'}
      #define PRODUCT_NAME_LEN	23
      #define EP0_SIZE		64
      #define NUM_ENDPOINTS         5
      #define NUM_USB_BUFFERS	24
      #define NUM_INTERFACE		4
      #define SEREMU_INTERFACE      2	// 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 KEYBOARD_INTERFACE    0	// Keyboard
      #define KEYBOARD_ENDPOINT     3
      #define KEYBOARD_SIZE         8
      #define KEYBOARD_INTERVAL     1
      #define MOUSE_INTERFACE       1	// Mouse
      #define MOUSE_ENDPOINT        5
      #define MOUSE_SIZE            8
      #define MOUSE_INTERVAL        1
      #define JOYSTICK_INTERFACE    3	// Joystick
      #define JOYSTICK_ENDPOINT     4
      #define JOYSTICK_SIZE         16
      #define JOYSTICK_INTERVAL     2
      #define ENDPOINT1_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT2_CONFIG	ENDPOINT_RECEIVE_ONLY
      #define ENDPOINT3_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT4_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT5_CONFIG	ENDPOINT_TRANSIMIT_ONLY
    
    #elif defined(USB_SERIAL_HID)
      #define VENDOR_ID		0x16C0
      #define PRODUCT_ID		0x0487
      #define DEVICE_CLASS		0xEF
      #define DEVICE_SUBCLASS	0x02
      #define DEVICE_PROTOCOL	0x01
      #define MANUFACTURER_NAME	{'T','e','e','n','s','y','d','u','i','n','o'}
      #define MANUFACTURER_NAME_LEN	11
      #define PRODUCT_NAME		{'S','e','r','i','a','l','/','K','e','y','b','o','a','r','d','/','M','o','u','s','e','/','J','o','y','s','t','i','c','k'}
      #define PRODUCT_NAME_LEN	30
      #define EP0_SIZE		64
      #define NUM_ENDPOINTS		6
      #define NUM_USB_BUFFERS	30
      #define NUM_INTERFACE		5
      #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       4
      #define CDC_ACM_SIZE          16
      #define CDC_RX_SIZE           64
      #define CDC_TX_SIZE           64
      #define KEYBOARD_INTERFACE    2	// Keyboard
      #define KEYBOARD_ENDPOINT     1
      #define KEYBOARD_SIZE         8
      #define KEYBOARD_INTERVAL     1
      #define MOUSE_INTERFACE       3	// Mouse
      #define MOUSE_ENDPOINT        5
      #define MOUSE_SIZE            8
      #define MOUSE_INTERVAL        2
      #define JOYSTICK_INTERFACE    4	// Joystick
      #define JOYSTICK_ENDPOINT     6
      #define JOYSTICK_SIZE         16
      #define JOYSTICK_INTERVAL     1
      #define ENDPOINT1_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT2_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT3_CONFIG	ENDPOINT_RECEIVE_ONLY
      #define ENDPOINT4_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT5_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT6_CONFIG	ENDPOINT_TRANSIMIT_ONLY
    
    #elif defined(USB_MIDI)
      #define VENDOR_ID		0x16C0
      #define PRODUCT_ID		0x0485
      #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',' ','M','I','D','I'}
      #define PRODUCT_NAME_LEN	11
      #define EP0_SIZE		64
      #define NUM_ENDPOINTS         4
      #define NUM_USB_BUFFERS	16
      #define NUM_INTERFACE		2
      #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 MIDI_INTERFACE        0	// MIDI
      #define MIDI_TX_ENDPOINT      3
      #define MIDI_TX_SIZE          64
      #define MIDI_RX_ENDPOINT      4
      #define MIDI_RX_SIZE          64
      #define ENDPOINT1_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT2_CONFIG	ENDPOINT_RECEIVE_ONLY
      #define ENDPOINT3_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT4_CONFIG	ENDPOINT_RECEIVE_ONLY
    
    #elif defined(USB_RAWHID)
      #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 ENDPOINT1_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT2_CONFIG	ENDPOINT_RECEIVE_ONLY
      #define ENDPOINT3_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT4_CONFIG	ENDPOINT_RECEIVE_ONLY
    
    #elif defined(USB_FLIGHTSIM)
      #define VENDOR_ID		0x16C0
      #define PRODUCT_ID		0x0488
      #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',' ','F','l','i','g','h','t',' ','S','i','m',' ','C','o','n','t','r','o','l','s'}
      #define PRODUCT_NAME_LEN	26
      #define EP0_SIZE		64
      #define NUM_ENDPOINTS         4
      #define NUM_USB_BUFFERS	20
      #define NUM_INTERFACE		2
      #define FLIGHTSIM_INTERFACE	0	// Flight Sim Control
      #define FLIGHTSIM_TX_ENDPOINT	3
      #define FLIGHTSIM_TX_SIZE	64
      #define FLIGHTSIM_TX_INTERVAL	1
      #define FLIGHTSIM_RX_ENDPOINT	4
      #define FLIGHTSIM_RX_SIZE	64
      #define FLIGHTSIM_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 ENDPOINT1_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT2_CONFIG	ENDPOINT_RECEIVE_ONLY
      #define ENDPOINT3_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT4_CONFIG	ENDPOINT_RECEIVE_ONLY
    
    #endif
    
    #ifdef USB_DESC_LIST_DEFINE
    #if defined(NUM_ENDPOINTS) && NUM_ENDPOINTS > 0
    // NUM_ENDPOINTS = number of non-zero endpoints (0 to 15)
    extern const uint8_t usb_endpoint_config_table[NUM_ENDPOINTS];
    
    typedef struct {
    	uint16_t	wValue;
    	uint16_t	wIndex;
    	const uint8_t	*addr;
    	uint16_t	length;
    } usb_descriptor_list_t;
    
    extern const usb_descriptor_list_t usb_descriptor_list[];
    #endif // NUM_ENDPOINTS
    #endif // USB_DESC_LIST_DEFINE
    
    #endif

    and here the one with the changes:

    Code:
    /* Teensyduino Core Library
     * http://www.pjrc.com/teensy/
     * Copyright (c) 2013 PJRC.COM, LLC.
     *
     * Permission is hereby granted, free of charge, to any person obtaining
     * a copy of this software and associated documentation files (the
     * "Software"), to deal in the Software without restriction, including
     * without limitation the rights to use, copy, modify, merge, publish,
     * distribute, sublicense, and/or sell copies of the Software, and to
     * permit persons to whom the Software is furnished to do so, subject to
     * the following conditions:
     *
     * 1. The above copyright notice and this permission notice shall be
     * included in all copies or substantial portions of the Software.
     *
     * 2. If the Software is incorporated into a build system that allows
     * selection among a list of target devices, then similar target
     * devices manufactured by PJRC.COM must be included in the list of
     * target devices and selectable in the same manner.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
     * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
     * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
     * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
     * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
     * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
     * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
     * SOFTWARE.
     */
    
    #ifndef _usb_desc_h_
    #define _usb_desc_h_
    
    // This header is NOT meant to be included when compiling
    // user sketches in Arduino.  The low-level functions
    // provided by usb_dev.c are meant to be called only by
    // code which provides higher-level interfaces to the user.
    
    #include <stdint.h>
    #include <stddef.h>
    
    #define ENDPOINT_UNUSED			0x00
    #define ENDPOINT_TRANSIMIT_ONLY		0x15
    #define ENDPOINT_RECEIVE_ONLY		0x19
    #define ENDPOINT_TRANSMIT_AND_RECEIVE	0x1D
    
    /*
    Each group of #define lines below corresponds to one of the
    settings in the Tools > USB Type menu.  This file defines what
    type of USB device is actually created for each of those menu
    options.
    
    Each "interface" is a set of functionality your PC or Mac will
    use and treat as if it is a unique device.  Within each interface,
    the "endpoints" are the actual communication channels.  Most
    interfaces use 1, 2 or 3 endpoints.  By editing only this file,
    you can customize the USB Types to be any collection of interfaces.
    
    To modify a USB Type, delete the XYZ_INTERFACE lines for any
    interfaces you wish to remove, and copy them from another USB Type
    for any you want to add.
    
    Give each interface a unique number, and edit NUM_INTERFACE to
    reflect the total number of interfaces.
    
    Next, assign unique endpoint numbers to all the endpoints across
    all the interfaces your device has.  You can reuse an endpoint
    number for transmit and receive, but the same endpoint number must
    not be used twice to transmit, or twice to receive.
    
    Most endpoints also require their maximum size, and some also
    need an interval specification (the number of milliseconds the
    PC will check for data from that endpoint).  For existing
    interfaces, usually these other settings should not be changed.
    
    Edit NUM_ENDPOINTS to be at least the largest endpoint number used.
    
    Edit NUM_USB_BUFFERS to control how much memory the USB stack will
    allocate.  At least 2 should be used for each endpoint.  More
    memory will allow higher throughput for user programs that have
    high latency (eg, spending time doing things other than interacting
    with the USB).
    
    Edit the ENDPOINT*_CONFIG lines so each endpoint is configured
    the proper way (transmit, receive, or both).
    
    If you are using existing interfaces (making your own device with
    a different set of interfaces) the code in all other files should
    automatically adapt to the new endpoints you specify here.
    
    If you need to create a new type of interface, you'll need to write
    the code which sends and receives packets, and presents an API to
    the user.  Usually, a pair of files are added for the actual code,
    and code is also added in usb_dev.c for any control transfers,
    interrupt-level code, or other very low-level stuff not possible
    from the packet send/receive functons.  Code also is added in
    usb_inst.c to create an instance of your C++ object.
    
    You may edit the Vendor and Product ID numbers, and strings.  If
    the numbers are changed, Teensyduino may not be able to automatically
    find and reboot your board when you click the Upload button in
    the Arduino IDE.  You will need to press the Program button on
    Teensy to initiate programming.
    
    Some operating systems, especially Windows, may cache USB device
    info.  Changes to the device name may not update on the same
    computer unless the vendor or product ID numbers change, or the
    "bcdDevice" revision code is increased.
    
    If these instructions are missing steps or could be improved, please
    let me know?  http://forum.pjrc.com/forums/4-Suggestions-amp-Bug-Reports
    */
    
    
    #if defined(USB_SERIAL)
      #define VENDOR_ID		0x16C0
      #define PRODUCT_ID		0x0483
      #define DEVICE_CLASS		2	// 2 = Communication Class
      #define MANUFACTURER_NAME	{'T','e','e','n','s','y','d','u','i','n','o'}
      #define MANUFACTURER_NAME_LEN	11
      #define PRODUCT_NAME		{'U','S','B',' ','S','e','r','i','a','l'}
      #define PRODUCT_NAME_LEN	10
      #define EP0_SIZE		64
      #define NUM_ENDPOINTS		4
      #define NUM_USB_BUFFERS	12
      #define NUM_INTERFACE		2
      #define CDC_STATUS_INTERFACE	0
      #define CDC_DATA_INTERFACE	1
      #define CDC_ACM_ENDPOINT	2
      #define CDC_RX_ENDPOINT       3
      #define CDC_TX_ENDPOINT       4
      #define CDC_ACM_SIZE          16
      #define CDC_RX_SIZE           64
      #define CDC_TX_SIZE           64
      #define ENDPOINT2_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT3_CONFIG	ENDPOINT_RECEIVE_ONLY
      #define ENDPOINT4_CONFIG	ENDPOINT_TRANSIMIT_ONLY
    
    #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		{'K','e','y','b','o','a','r','d','/','M','o','u','s','e','/','J','o','y','s','t','i','c','k'}
      #define PRODUCT_NAME_LEN	23
      #define EP0_SIZE		64
      #define NUM_ENDPOINTS         5
      #define NUM_USB_BUFFERS	24
      #define NUM_INTERFACE		4
      #define SEREMU_INTERFACE      2	// 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 KEYBOARD_INTERFACE    0	// Keyboard
      #define KEYBOARD_ENDPOINT     3
      #define KEYBOARD_SIZE         8
      #define KEYBOARD_INTERVAL     1
      #define MOUSE_INTERFACE       1	// Mouse
      #define MOUSE_ENDPOINT        5
      #define MOUSE_SIZE            8
      #define MOUSE_INTERVAL        1
      #define JOYSTICK_INTERFACE    3	// Joystick
      #define JOYSTICK_ENDPOINT     4
      #define JOYSTICK_SIZE         16
      #define JOYSTICK_INTERVAL     2
      #define ENDPOINT1_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT2_CONFIG	ENDPOINT_RECEIVE_ONLY
      #define ENDPOINT3_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT4_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT5_CONFIG	ENDPOINT_TRANSIMIT_ONLY
    
    #elif defined(USB_SERIAL_HID)
      #define VENDOR_ID		0x16C0
      #define PRODUCT_ID		0x0487
      #define DEVICE_CLASS		0xEF
      #define DEVICE_SUBCLASS	0x02
      #define DEVICE_PROTOCOL	0x01
      #define MANUFACTURER_NAME	{'T','e','e','n','s','y','d','u','i','n','o'}
      #define MANUFACTURER_NAME_LEN	11
      #define PRODUCT_NAME		{'S','e','r','i','a','l','/','K','e','y','b','o','a','r','d','/','M','o','u','s','e','/','J','o','y','s','t','i','c','k'}
      #define PRODUCT_NAME_LEN	30
      #define EP0_SIZE		64
      #define NUM_ENDPOINTS		6
      #define NUM_USB_BUFFERS	30
      #define NUM_INTERFACE		5
      #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       4
      #define CDC_ACM_SIZE          16
      #define CDC_RX_SIZE           64
      #define CDC_TX_SIZE           64
      #define KEYBOARD_INTERFACE    2	// Keyboard
      #define KEYBOARD_ENDPOINT     1
      #define KEYBOARD_SIZE         8
      #define KEYBOARD_INTERVAL     1
      #define MOUSE_INTERFACE       3	// Mouse
      #define MOUSE_ENDPOINT        5
      #define MOUSE_SIZE            8
      #define MOUSE_INTERVAL        2
      #define JOYSTICK_INTERFACE    4	// Joystick
      #define JOYSTICK_ENDPOINT     6
      #define JOYSTICK_SIZE         16
      #define JOYSTICK_INTERVAL     1
      #define ENDPOINT1_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT2_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT3_CONFIG	ENDPOINT_RECEIVE_ONLY
      #define ENDPOINT4_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT5_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT6_CONFIG	ENDPOINT_TRANSIMIT_ONLY
    
    #elif defined(USB_MIDI)
      #define VENDOR_ID		0x16C0
      #define PRODUCT_ID		0x0485
      #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',' ','M','I','D','I'}
      #define PRODUCT_NAME_LEN	11
      #define EP0_SIZE		64
      #define NUM_ENDPOINTS         4
      #define NUM_USB_BUFFERS	16
      #define NUM_INTERFACE		2
      #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 MIDI_INTERFACE        0	// MIDI
      #define MIDI_TX_ENDPOINT      3
      #define MIDI_TX_SIZE          64
      #define MIDI_RX_ENDPOINT      4
      #define MIDI_RX_SIZE          64
      #define ENDPOINT1_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT2_CONFIG	ENDPOINT_RECEIVE_ONLY
      #define ENDPOINT3_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT4_CONFIG	ENDPOINT_RECEIVE_ONLY
    
    #elif defined(USB_RAWHID)
      #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 ENDPOINT1_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT2_CONFIG	ENDPOINT_RECEIVE_ONLY
      #define ENDPOINT3_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT4_CONFIG	ENDPOINT_RECEIVE_ONLY
    
    #elif defined(USB_FLIGHTSIM)
      #define VENDOR_ID		0x16C0
      #define PRODUCT_ID		0x0488
      #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',' ','F','l','i','g','h','t',' ','S','i','m',' ','C','o','n','t','r','o','l','s'}
      #define PRODUCT_NAME_LEN	26
      #define EP0_SIZE		64
      #define NUM_ENDPOINTS         4
      #define NUM_USB_BUFFERS	20
      #define NUM_INTERFACE		2
      #define FLIGHTSIM_INTERFACE	0	// Flight Sim Control
      #define FLIGHTSIM_TX_ENDPOINT	3
      #define FLIGHTSIM_TX_SIZE	64
      #define FLIGHTSIM_TX_INTERVAL	1
      #define FLIGHTSIM_RX_ENDPOINT	4
      #define FLIGHTSIM_RX_SIZE	64
      #define FLIGHTSIM_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 ENDPOINT1_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT2_CONFIG	ENDPOINT_RECEIVE_ONLY
      #define ENDPOINT3_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT4_CONFIG	ENDPOINT_RECEIVE_ONLY
      
    #elif defined(USB_MIDI_KEYBOARD)
      #define VENDOR_ID		0x16C0
      #define PRODUCT_ID		0x0489
      #define MANUFACTURER_NAME	{'T','e','e','n','s','y','d','u','i','n','o'}
      #define MANUFACTURER_NAME_LEN	11
      #define PRODUCT_NAME		{'M','I','D','I','/','K','e','y','b','o','a','r','d'}
      #define PRODUCT_NAME_LEN	13
      #define EP0_SIZE		64
      #define NUM_ENDPOINTS         5
      #define NUM_USB_BUFFERS	30
      #define NUM_INTERFACE		3
      #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 MIDI_INTERFACE        0	// MIDI
      #define MIDI_TX_ENDPOINT      3
      #define MIDI_TX_SIZE          64
      #define MIDI_RX_ENDPOINT      4
      #define MIDI_RX_SIZE          64
      #define KEYBOARD_INTERFACE    2	// Keyboard
      #define KEYBOARD_ENDPOINT     5
      #define KEYBOARD_SIZE         8
      #define KEYBOARD_INTERVAL     1
      #define ENDPOINT1_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT2_CONFIG	ENDPOINT_RECEIVE_ONLY
      #define ENDPOINT3_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT4_CONFIG	ENDPOINT_RECEIVE_ONLY
      #define ENDPOINT5_CONFIG	ENDPOINT_TRANSIMIT_ONLY
    
    #endif
    
    #ifdef USB_DESC_LIST_DEFINE
    #if defined(NUM_ENDPOINTS) && NUM_ENDPOINTS > 0
    // NUM_ENDPOINTS = number of non-zero endpoints (0 to 15)
    extern const uint8_t usb_endpoint_config_table[NUM_ENDPOINTS];
    
    typedef struct {
    	uint16_t	wValue;
    	uint16_t	wIndex;
    	const uint8_t	*addr;
    	uint16_t	length;
    } usb_descriptor_list_t;
    
    extern const usb_descriptor_list_t usb_descriptor_list[];
    #endif // NUM_ENDPOINTS
    #endif // USB_DESC_LIST_DEFINE
    
    #endif
    as you can see i simply followed all the stops from lhagan,
    except for the xyz-changes not being necessary, and i also added a new #define PRODUCT_ID
    for the new midi_keyboard part (im not sure that is actually necessary, but all the parts had a different one and it seems to work...
    again, i dont really have a clue about programming... ):

    this is just the new part of the file, it is part of the new code above.

    Code:
     
    #elif defined(USB_MIDI_KEYBOARD)
      #define VENDOR_ID		0x16C0
      #define PRODUCT_ID		0x0489
      #define MANUFACTURER_NAME	{'T','e','e','n','s','y','d','u','i','n','o'}
      #define MANUFACTURER_NAME_LEN	11
      #define PRODUCT_NAME		{'M','I','D','I','/','K','e','y','b','o','a','r','d'}
      #define PRODUCT_NAME_LEN	13
      #define EP0_SIZE		64
      #define NUM_ENDPOINTS         5
      #define NUM_USB_BUFFERS	30
      #define NUM_INTERFACE		3
      #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 MIDI_INTERFACE        0	// MIDI
      #define MIDI_TX_ENDPOINT      3
      #define MIDI_TX_SIZE          64
      #define MIDI_RX_ENDPOINT      4
      #define MIDI_RX_SIZE          64
      #define KEYBOARD_INTERFACE    2	// Keyboard
      #define KEYBOARD_ENDPOINT     5
      #define KEYBOARD_SIZE         8
      #define KEYBOARD_INTERVAL     1
      #define ENDPOINT1_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT2_CONFIG	ENDPOINT_RECEIVE_ONLY
      #define ENDPOINT3_CONFIG	ENDPOINT_TRANSIMIT_ONLY
      #define ENDPOINT4_CONFIG	ENDPOINT_RECEIVE_ONLY
      #define ENDPOINT5_CONFIG	ENDPOINT_TRANSIMIT_ONLY
    
    #endif
    of course it is also necessary to change the other files mentioned in the post:
    usb_inst.cpp
    boards.txt
    usb_rawhid.h
    usb_seremu.h
    usb_keyboard.h

    but that is all very well explained so I will not repeat it again here, unless somebody wants me to.
    ah, copy the library somewhere else as a backup before you start changing things around.
    thanks again, paul!
    Last edited by 321lupo; 10-11-2015 at 04:07 PM.

Posting Permissions

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