Hi again Paul,
This has become more challenging than initially thought.
I have modified the USB_MIDI type in order to use the normal Serial mode along with the MIDI, instead of the seremu serial. (It would be great if you can explain what is exactly the serial emulator)
The USB_desc.h is as follows:
Code:
#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 8
#define NUM_USB_BUFFERS 28
#define NUM_INTERFACE 3
#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 MIDI_INTERFACE 2 // MIDI
#define MIDI_TX_ENDPOINT 5
#define MIDI_TX_SIZE 64
#define MIDI_RX_ENDPOINT 6
#define MIDI_RX_SIZE 64
#define CONFIG_DESC_SIZE (9 +9+5+5+4+5+7+9+7+7 +9+7+6+6+9+9+9+5+9+5)
#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_RECEIVE_ONLY
I struggled to find a sense for every bit of configuration, so probably I done something wrong; mainly because with this configuration Windows only detects one MIDI interface, and another Unidentified HID device, and with errors.
Obviously, I also had to modify files usb_inst.cpp:
Code:
#ifdef USB_MIDI
usb_midi_class usbMIDI;
usb_serial_class Serial;
#endif
In order to use normal USB serial and not Serial Emulator
usb_serial.h:
Code:
#if defined(USB_SERIAL) || defined(USB_SERIAL_HID) || defined(USB_MIDI)
#include <inttypes.h>
// C language implementation
#ifdef __cplusplus
extern "C" {
#endif
int usb_serial_getchar(void);
int usb_serial_peekchar(void);
int usb_serial_available(void);
int usb_serial_read(void *buffer, uint32_t size);
void usb_serial_flush_input(void);
In order to have the normal serial code compiled when the MIDI interface is used
And usb_seremu.h:
Code:
#ifndef USBseremu_h_
#define USBseremu_h_
#if defined(USB_HID) || defined(USB_RAWHID) || defined(USB_FLIGHTSIM)
#include <inttypes.h>
// C language implementation
#ifdef __cplusplus
extern "C" {
#endif
int usb_seremu_getchar(void);
int usb_seremu_peekchar(void);
int usb_seremu_available(void);
For not using it when MIDI is selected
So, I was running the following sketch, in order to test Serial and MIDI together:
Code:
const int led = 13;
const int channel = 1;
void setup()
{
Serial.begin(9600);
pinMode(led, OUTPUT);
}
void loop()
{
tocar(60,500);
tocar(62,500);
tocar(64,500);
tocar(66,500);
tocar(68,500);
tocar(70,5000);
}
void tocar (int nota,int duracion)
{
usbMIDI.sendNoteOn(nota, 99, channel); // 60 = C4
digitalWrite(led,HIGH);
Serial.println("Tocando nota");
delay(duracion);
usbMIDI.sendNoteOff(nota, 0, channel); // 60 = C4
digitalWrite(led,LOW);
delay(200);
}
Everything compiles ok, runs ok, but Windows just detects this:

EDIT: The double Teensy MIDI Interface is because I initially named it differently, only for the sake of trying; reverted to original name when I realised it didn't work, and ¿maybe Windows cached it?
So, that's where I reached, with my zero USB programming knowledge I will need some help from an expert.
Greetings and thanks in advance.