moved SerialFormat settings to serialMIDI.h

This commit is contained in:
Adrien Fauconnet 2021-01-18 20:01:02 +00:00
parent 7e58b9df75
commit 489ccb770d
2 changed files with 19 additions and 20 deletions

View File

@ -99,23 +99,6 @@ struct DefaultSettings
Setting this field to 0 will disable sending MIDI active sensing. Setting this field to 0 will disable sending MIDI active sensing.
*/ */
static const uint16_t SenderActiveSensingPeriodicity = 0; static const uint16_t SenderActiveSensingPeriodicity = 0;
#if defined(TEENSYDUINO)
/*! Teensy supports various Serial data formats.
This allows to use circuits that may require inversion of polarity on the RX, TX
or both signals
Format Name Data Bits Parity Stop Bits RX Polarity TX Polarity
SERIAL_8N1 8 None Normal Normal
SERIAL_8N1_RXINV 8 None Inverted Normal
SERIAL_8N1_TXINV 8 None Normal Inverted
SERIAL_8N1_RXINV_TXINV 8 None Inverted Inverted
Default is SERIAL_8N1
*/
static const uint16_t SerialFormat = SERIAL_8N1;
#endif
}; };
END_MIDI_NAMESPACE END_MIDI_NAMESPACE

View File

@ -30,13 +30,29 @@
BEGIN_MIDI_NAMESPACE BEGIN_MIDI_NAMESPACE
struct DefaultSerialSettings struct DefaultSerialSettings : public MIDI_NAMESPACE::DefaultSettings
{ {
/*! Override the default MIDI baudrate to transmit over USB serial, to /*! Override the default MIDI baudrate to transmit over USB serial, to
a decoding program such as Hairless MIDI (set baudrate to 115200)\n a decoding program such as Hairless MIDI (set baudrate to 115200)\n
http://projectgus.github.io/hairless-midiserial/ http://projectgus.github.io/hairless-midiserial/
*/ */
static const long BaudRate = 31250; static const long BaudRate = 31250;
#if defined(TEENSYDUINO)
/*! Teensy supports various Serial data formats.
Override the default Serial Format to use circuits that may require inversion of
polarity on the RX, TX or both signals.
https://www.pjrc.com/teensy/td_serial.html
Format Name Data Bits Parity RX Polarity TX Polarity
SERIAL_8N1 8 None Normal Normal
SERIAL_8N1_RXINV 8 None Inverted Normal
SERIAL_8N1_TXINV 8 None Normal Inverted
SERIAL_8N1_RXINV_TXINV 8 None Inverted Inverted
*/
static const uint16_t SerialFormat = SERIAL_8N1;
#endif
}; };
template <class SerialPort, class _Settings = DefaultSerialSettings> template <class SerialPort, class _Settings = DefaultSerialSettings>
@ -123,5 +139,5 @@ END_MIDI_NAMESPACE
@see MIDI_CREATE_INSTANCE @see MIDI_CREATE_INSTANCE
*/ */
#define MIDI_CREATE_CUSTOM_INSTANCE(Type, SerialPort, Name, Settings) \ #define MIDI_CREATE_CUSTOM_INSTANCE(Type, SerialPort, Name, Settings) \
MIDI_NAMESPACE::SerialMIDI<Type> serial##Name(SerialPort);\ MIDI_NAMESPACE::SerialMIDI<Type, Settings> serial##Name(SerialPort);\
MIDI_NAMESPACE::MidiInterface<MIDI_NAMESPACE::SerialMIDI<Type>, Settings> Name((MIDI_NAMESPACE::SerialMIDI<Type>&)serial##Name); MIDI_NAMESPACE::MidiInterface<MIDI_NAMESPACE::SerialMIDI<Type, Settings>, Settings> Name((MIDI_NAMESPACE::SerialMIDI<Type, Settings>&)serial##Name);