Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/midi_Defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ struct RPN
#define MIDI_CREATE_INSTANCE(Type, SerialPort, Name) \
midi::MidiInterface<Type> Name((Type&)SerialPort);

#if defined(ARDUINO_SAM_DUE) || defined(USBCON)
#if defined(ARDUINO_SAM_DUE) || defined(USBCON) || defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MKL26Z64__)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any other definitions that could be used to precisely identify a Teensy 3.x ?

I'm thinking that if someone else uses the same arch/processor with a different core, they might not end up with the same Serial mapping.

This is highly theoretical though, so if there's no better alternative, I'll merge this change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, seems like this was mentioned a while ago already, in #33.

Also PR #29 seems to propose similar changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have been looking around in the Teensy source code and could not find any other flags/defines that tell the compiler about the Teensy. Also, it is highly unlikely that anyone would want to use these Kinetis devices with the Arduino core without using Paul Stoffregen's Teensy code as a base.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not find any specific defines either (apart from TEENSYDUINO=version), but there's something more interesting: SERIAL_PORT_HARDWARE_OPEN, defined in pins_arduino.h (or variant.h on non-avr architectures). It seems to suited for our needs, see #65.

// Leonardo, Due and other USB boards use Serial1 by default.
#define MIDI_CREATE_DEFAULT_INSTANCE() \
MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, MIDI);
Expand Down