Hello
I am trying to use encoders of my midi controller to act as mousescroll. Having read some posts I found that this one ( https://forum.pjrc.com/threads/23814-MIDI-HID-combo ) is the one that gets me closer to my goal, but I get stuck at some point…..
I summarise what I have done so far (I followed Yeahtuna post step by step):
1- Added these lines to boards.txt file
As you can see I have substituted “hidMidi” (of yeahtuna example) with “midiMouse” but I have no idea if this is correct.
2- Added these lines to teensy/usb_private.h file
3- I created a copy of the “usb_midi” folder and renamed it to “usb_midi_mouse”
4- Edited the USB_private.h in my usb_midi_mouse folder:
5- edited usb.c - added last line (mouse) respecting order of endpoints:
I hope I have done everything correctly up to this point.
The final part of the post is what I find hard to understand.
Paul and Yeahtuna talk about “copying stuff into the descriptor data arrays” but I have no idea where I can copy this information from and where to paste it….
Thanks in advance for any help.
I am trying to use encoders of my midi controller to act as mousescroll. Having read some posts I found that this one ( https://forum.pjrc.com/threads/23814-MIDI-HID-combo ) is the one that gets me closer to my goal, but I get stuck at some point…..
I summarise what I have done so far (I followed Yeahtuna post step by step):
1- Added these lines to boards.txt file
Code:
teensy2.menu.usb.midiMouse.name=MIDI + MOUSE
teensy2.menu.usb.midiMouse.build.define0=-DUSB_MIDI_MOUSE
teensy2.menu.usb.midiMouse.fake_serial=teensy_gateway
As you can see I have substituted “hidMidi” (of yeahtuna example) with “midiMouse” but I have no idea if this is correct.
2- Added these lines to teensy/usb_private.h file
Code:
#elif defined(USB_MIDI_MOUSE)
#include "../usb_midi_mouse/usb_private.h"
3- I created a copy of the “usb_midi” folder and renamed it to “usb_midi_mouse”
4- Edited the USB_private.h in my usb_midi_mouse folder:
Code:
#define VENDOR_ID 0x16C0 // left unchanged
#define PRODUCT_ID 0x0485 //changed this value from 0x0489
#define TRANSMIT_FLUSH_TIMEOUT 4 /* in milliseconds */ // left unchanged
#define TRANSMIT_TIMEOUT 25 /* in milliseconds */ // left unchanged
#if defined(__AVR_ATmega32U4__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__) // left unchanged
#ifndef STR_PRODUCT // left unchanged
#define STR_PRODUCT L"INHKontrol" //this is the name of my controller
#endif
#define ENDPOINT0_SIZE 64
#define DEBUG_INTERFACE 1
#define DEBUG_TX_ENDPOINT 1
#define DEBUG_TX_SIZE 64
#define DEBUG_TX_BUFFER EP_DOUBLE_BUFFER
#define DEBUG_TX_INTERVAL 1
#define DEBUG_RX_ENDPOINT 2
#define DEBUG_RX_SIZE 32
#define DEBUG_RX_BUFFER EP_DOUBLE_BUFFER
#define DEBUG_RX_INTERVAL 2
#define MIDI_INTERFACE 0
#define MIDI_TX_ENDPOINT 3
#define MIDI_TX_SIZE 64
#define MIDI_TX_BUFFER EP_DOUBLE_BUFFER
#define MIDI_RX_ENDPOINT 4
#define MIDI_RX_SIZE 64
#define MIDI_RX_BUFFER EP_DOUBLE_BUFFER
// ADDED MOUSE, CHANGED INTERFACE NAME TO 2 AND ENDPINT TO 5
#define MOUSE_INTERFACE 2 // changed
#define MOUSE_ENDPOINT 5 // changed
#define MOUSE_SIZE 8
#define MOUSE_BUFFER EP_DOUBLE_BUFFER
#define MOUSE_INTERVAL 1
#define NUM_ENDPOINTS 6
#define NUM_INTERFACE 3
#endif
5- edited usb.c - added last line (mouse) respecting order of endpoints:
Code:
static const uint8_t PROGMEM endpoint_config_table[] = {
1, EP_TYPE_INTERRUPT_IN, EP_SIZE(DEBUG_TX_SIZE) | DEBUG_TX_BUFFER,
1, EP_TYPE_INTERRUPT_OUT, EP_SIZE(DEBUG_RX_SIZE) | DEBUG_RX_BUFFER,
1, EP_TYPE_BULK_IN, EP_SIZE(MIDI_TX_SIZE) | MIDI_TX_BUFFER,
1, EP_TYPE_BULK_OUT, EP_SIZE(MIDI_RX_SIZE) | MIDI_RX_BUFFER,
1, EP_TYPE_INTERRUPT_IN, EP_SIZE (MOUSE_SIZE) | MOUSE_BUFFER
};
I hope I have done everything correctly up to this point.
The final part of the post is what I find hard to understand.
Paul and Yeahtuna talk about “copying stuff into the descriptor data arrays” but I have no idea where I can copy this information from and where to paste it….
Thanks in advance for any help.