arduino_midi_library
arduino_midi_library copied to clipboard
Normalise default serial ports for common platforms
Arduino / Genuino platforms currently in production
| Name | Processor | SERIAL_PORT_HARDWARE_OPEN |
USBCON |
Definition |
|---|---|---|---|---|
| Uno | ATmega328P | N.A. | ❌ | ARDUINO_AVR_UNO |
| Leonardo | ATmega32U4 | Serial1 |
✅ | ARDUINO_AVR_LEONARDO |
| 101 | ARCV2EM | Serial1 |
❌ | ARDUINO_ARC32_TOOLS |
| Micro | ATmega32U4 | Serial1 |
✅ | ARDUINO_AVR_MICRO |
| Esplora | ATmega32U4 | Serial1 |
✅ | ARDUINO_AVR_ESPLORA |
| Robot | ATmega32U4 | N.A. | ✅ | ARDUINO_AVR_ROBOT_xxx |
| Mini | ATmega328P | N.A. | ❌ | ARDUINO_AVR_MINI |
| Mega 2560 | ATmega2560 | Serial1 |
❌ | ARDUINO_AVR_MEGA2560 |
| Zero | SAMD21G18A | Serial1 |
✅ | ARDUINO_SAMD_ZERO |
| Due | SAM3X8E | Serial1 |
✅ | ARDUINO_SAM_DUE |
| Mega ADK | ATmega2560 | Serial1 |
❌ | ARDUINO_AVR_ADK |
| Ethernet | ATmega328P | N.A. | ❌ | ARDUINO_AVR_ETHERNET |
| Yún | ATmega32U4 | N.A. | ✅ | ARDUINO_AVR_YUN |
Teensy platforms currently in production
| Name | Processor | SERIAL_PORT_HARDWARE_OPEN |
USBCON |
Definition |
|---|---|---|---|---|
| Teensy 2.0 | ATmega32U4 | Serial1 |
❌ | None |
| Teensy++ 2.0 | AT90USB1286 | Serial1 |
❌ | None |
| Teensy LC | MKL26Z64 | Serial1 |
❌ | __MKL26Z64__ |
| Teensy 3.2 | MK20DX256 | Serial1 |
❌ | __MK20DX256__ |
| Teensy 3.5 | MK62FX512 | Serial1 |
❌ | __MK62FX512__ |
| Teensy 3.6 | MK66FX1M0 | Serial1 |
❌ | __MK66FX1M0__ |
Discontinued platforms
| Name | Processor | SERIAL_PORT_HARDWARE_OPEN |
USBCON |
Definition |
|---|---|---|---|---|
| Pro | ATmega328P | N.A. | ❌ | ARDUINO_AVR_PRO |
| Fio | ATmega328P | N.A. | ❌ | ARDUINO_AVR_FIO |
| Nano | ATmega328P | N.A. | ❌ | ARDUINO_AVR_NANO |
| Pro Mini | ATmega328P | N.A. | ❌ | ARDUINO_AVR_NANO |
| Teensy 3.0 | MK20DX128 | Serial1 |
❌ | __MK20DX128__ |
| Teensy 3.1 | MK20DX256 | Serial1 |
❌ | __MK20DX256__ |
Relates to the following issues & PR:
- #11 - Default serial port is wrong on Leonardo
- #29 - USBCON is defined only for AVR
- #33 - Digging out definitions for default serial port (lost in the middle of other topics)
- #63 - Teensy handling
When SERIAL_PORT_HARDWARE_OPEN is defined, it points to the hardware UART that is available for external serial IO, which is what we're after:
// These serial port names are intended to allow libraries and architecture-neutral
// sketches to automatically default to the correct port name for a particular type
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
//
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
//
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
//
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
//
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
//
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
// pins are NOT connected to anything by default.
Should the USB part of this table be moved over to https://github.com/lathoub/Arduino-USBMIDI?