Skip to content

Commit

Permalink
Move SoftwareSerial MIDI to separate header files
Browse files Browse the repository at this point in the history
(not included by default)
  • Loading branch information
tttapa committed Aug 10, 2021
1 parent 3c8ac15 commit c35f29c
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 121 deletions.
83 changes: 0 additions & 83 deletions src/MIDI_Interfaces/DebugMIDI_Interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,47 +167,6 @@ class USBDebugMIDI_Output : public SerialDebugMIDI_Output<decltype(Serial)> {
: SerialDebugMIDI_Output(Serial, prefix) {}
};

END_CS_NAMESPACE

// TODO: Teensy 4.0 SoftwareSerial bug
#if defined(__AVR__) || (defined(TEENSYDUINO) && TEENSYDUINO != 147) || \
(defined(TEENSYDUINO) && !defined(__IMXRT1052__) && \
!defined(__IMXRT1062__))
#include <SoftwareSerial.h>

BEGIN_CS_NAMESPACE

/**
* @brief A class for debug MIDI outputs sending
* human-readable MIDI messages over a SoftwareSerial interface.
*
* @ingroup MIDIInterfaces
*/
class SoftwareSerialDebugMIDI_Output
: public SerialDebugMIDI_Output<SoftwareSerial> {
public:
/**
* @brief Construct a SoftwareSerialDebugMIDI_Output on the given
* SoftwareSerial interface with the given baud rate.
*
* @param serial
* The SoftwareSerial interface.
* @param baud
* The baud rate for the serial interface.
* @param prefix
* An optional string to print before each message.
*/
SoftwareSerialDebugMIDI_Output(SoftwareSerial &serial, unsigned long baud,
const char *prefix = nullptr)
: SerialDebugMIDI_Output(serial, baud, prefix) {}
};

END_CS_NAMESPACE

#endif

BEGIN_CS_NAMESPACE

/**
* @brief A class for MIDI interfaces sending and receiving
* human-readable MIDI messages over a Stream.
Expand Down Expand Up @@ -368,45 +327,3 @@ class USBDebugMIDI_Interface
};

END_CS_NAMESPACE

// TODO: Teensy 4.0 SoftwareSerial bug
#if defined(__AVR__) || (defined(TEENSYDUINO) && TEENSYDUINO != 147) || \
(defined(TEENSYDUINO) && !defined(__IMXRT1052__) && \
!defined(__IMXRT1062__))
#include <SoftwareSerial.h>

BEGIN_CS_NAMESPACE

/**
* @brief A class for debug MIDI interfaces sending and receiving
* human-readable MIDI messages over a SoftwareSerial interface.
*
* @ingroup MIDIInterfaces
*/
class SoftwareSerialDebugMIDI_Interface
: public SerialDebugMIDI_Interface<SoftwareSerial> {
public:
/**
* @brief Construct a SoftwareSerialDebugMIDI_Interface on the given
* SoftwareSerial interface with the given baud rate.
*
* @param serial
* The SoftwareSerial interface.
* @param baud
* The baud rate for the serial interface.
* @param prefix
* An optional string to print before each message.
*/
SoftwareSerialDebugMIDI_Interface(SoftwareSerial &serial,
unsigned long baud,
const char *prefix = nullptr)
: SerialDebugMIDI_Interface(serial, baud, prefix) {}
/// @see @ref SoftwareSerialDebugMIDI_Interface(SoftwareSerial &,unsigned long,const char *)
SoftwareSerialDebugMIDI_Interface(SoftwareSerial &serial,
const char *prefix)
: SerialDebugMIDI_Interface(serial, prefix) {}
};

END_CS_NAMESPACE

#endif
39 changes: 1 addition & 38 deletions src/MIDI_Interfaces/SerialMIDI_Interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,41 +160,4 @@ class HairlessMIDI_Interface : public USBSerialMIDI_Interface {
};
#endif

END_CS_NAMESPACE

// -------------------------------------------------------------------------- //

// TODO: Teensy 4.0 SoftwareSerial bug
#if defined(__AVR__) || (defined(TEENSYDUINO) && TEENSYDUINO != 147) || \
(defined(TEENSYDUINO) && !defined(__IMXRT1052__) && \
!defined(__IMXRT1062__))

#include <SoftwareSerial.h>

BEGIN_CS_NAMESPACE

/**
* @brief A class for MIDI interfaces sending and receiving
* MIDI messages over a SoftwareSerial interface.
*
* @ingroup MIDIInterfaces
*/
class SoftwareSerialMIDI_Interface
: public SerialMIDI_Interface<SoftwareSerial> {
public:
/**
* @brief Create a SoftwareSerialMIDI_Interface on the given
* SoftwareSerial interface with the given baud rate.
*
* @param serial
* The SoftwareSerial interface.
* @param baud
* The baud rate for the serial interface.
*/
SoftwareSerialMIDI_Interface(SoftwareSerial &serial, unsigned long baud)
: SerialMIDI_Interface(serial, baud) {}
};

END_CS_NAMESPACE

#endif
END_CS_NAMESPACE
70 changes: 70 additions & 0 deletions src/MIDI_Interfaces/SoftwareSerialDebugMIDI_Interface.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#pragma once

// TODO: Teensy 4.0 SoftwareSerial bug
#if defined(__AVR__) || (defined(TEENSYDUINO) && TEENSYDUINO != 147) || \
(defined(TEENSYDUINO) && !defined(__IMXRT1052__) && \
!defined(__IMXRT1062__))

#include "DebugMIDI_Interface.hpp"
#include <SoftwareSerial.h>

BEGIN_CS_NAMESPACE

/**
* @brief A class for debug MIDI interfaces sending and receiving
* human-readable MIDI messages over a SoftwareSerial interface.
*
* @ingroup MIDIInterfaces
*/
class SoftwareSerialDebugMIDI_Interface
: public SerialDebugMIDI_Interface<SoftwareSerial> {
public:
/**
* @brief Construct a SoftwareSerialDebugMIDI_Interface on the given
* SoftwareSerial interface with the given baud rate.
*
* @param serial
* The SoftwareSerial interface.
* @param baud
* The baud rate for the serial interface.
* @param prefix
* An optional string to print before each message.
*/
SoftwareSerialDebugMIDI_Interface(SoftwareSerial &serial,
unsigned long baud,
const char *prefix = nullptr)
: SerialDebugMIDI_Interface(serial, baud, prefix) {}
/// @see @ref SoftwareSerialDebugMIDI_Interface(SoftwareSerial &,unsigned long,const char *)
SoftwareSerialDebugMIDI_Interface(SoftwareSerial &serial,
const char *prefix)
: SerialDebugMIDI_Interface(serial, prefix) {}
};

/**
* @brief A class for debug MIDI outputs sending
* human-readable MIDI messages over a SoftwareSerial interface.
*
* @ingroup MIDIInterfaces
*/
class SoftwareSerialDebugMIDI_Output
: public SerialDebugMIDI_Output<SoftwareSerial> {
public:
/**
* @brief Construct a SoftwareSerialDebugMIDI_Output on the given
* SoftwareSerial interface with the given baud rate.
*
* @param serial
* The SoftwareSerial interface.
* @param baud
* The baud rate for the serial interface.
* @param prefix
* An optional string to print before each message.
*/
SoftwareSerialDebugMIDI_Output(SoftwareSerial &serial, unsigned long baud,
const char *prefix = nullptr)
: SerialDebugMIDI_Output(serial, baud, prefix) {}
};

END_CS_NAMESPACE

#endif
37 changes: 37 additions & 0 deletions src/MIDI_Interfaces/SoftwareSerialMIDI_Interface.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#pragma once

// TODO: Teensy 4.0 SoftwareSerial bug
#if defined(__AVR__) || (defined(TEENSYDUINO) && TEENSYDUINO != 147) || \
(defined(TEENSYDUINO) && !defined(__IMXRT1052__) && \
!defined(__IMXRT1062__))

#include "SerialMIDI_Interface.hpp"
#include <SoftwareSerial.h>

BEGIN_CS_NAMESPACE

/**
* @brief A class for MIDI interfaces sending and receiving
* MIDI messages over a SoftwareSerial interface.
*
* @ingroup MIDIInterfaces
*/
class SoftwareSerialMIDI_Interface
: public SerialMIDI_Interface<SoftwareSerial> {
public:
/**
* @brief Create a SoftwareSerialMIDI_Interface on the given
* SoftwareSerial interface with the given baud rate.
*
* @param serial
* The SoftwareSerial interface.
* @param baud
* The baud rate for the serial interface.
*/
SoftwareSerialMIDI_Interface(SoftwareSerial &serial, unsigned long baud)
: SerialMIDI_Interface(serial, baud) {}
};

END_CS_NAMESPACE

#endif

0 comments on commit c35f29c

Please sign in to comment.