Skip to content

Commit

Permalink
adafruit samd support
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Freed authored and Adrian Freed committed May 8, 2024
1 parent 8ea3de5 commit df3bf97
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions SLIPEncodedSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Extends the Serial class to encode SLIP over serial



#if (defined(TEENSYDUINO) && (defined(USB_SERIAL) || defined(USB_DUAL_SERIAL) || defined(USB_TRIPLE_SERIAL) || defined(USB_SERIAL_HID) || defined(USB_MIDI_SERIAL) || defined(USB_MIDI_AUDIO_DUAL_SERIAL) || defined(USB_MIDI4_SERIAL) || defined(USB_MIDI16_SERIAL) || defined(USB_MIDI_AUDIO_SERIAL) || defined(USB_MIDI16_AUDIO_SERIAL))) || (!defined(TEENSYDUINO) && defined(__AVR_ATmega32U4__)) || defined(__SAM3X8E__) || (defined(_USB) && defined(_USE_USB_FOR_SERIAL_)) || defined(_SAMD21_) || defined(__PIC32MX__) || defined(__PIC32MZ__) || defined(ARDUINO_USB_CDC_ON_BOOT) || defined(ARDUINO_ARCH_RP2040)
#if (defined(TEENSYDUINO) && (defined(USB_SERIAL) || defined(USB_DUAL_SERIAL) || defined(USB_TRIPLE_SERIAL) || defined(USB_SERIAL_HID) || defined(USB_MIDI_SERIAL) || defined(USB_MIDI_AUDIO_DUAL_SERIAL) || defined(USB_MIDI4_SERIAL) || defined(USB_MIDI16_SERIAL) || defined(USB_MIDI_AUDIO_SERIAL) || defined(USB_MIDI16_AUDIO_SERIAL))) || (!defined(TEENSYDUINO) && defined(__AVR_ATmega32U4__)) || defined(ARDUINO_SAMD_ADAFRUIT)|| defined(__SAM3X8E__) || (defined(_USB) && defined(_USE_USB_FOR_SERIAL_)) || defined(_SAMD21_) || defined(__PIC32MX__) || defined(__PIC32MZ__) || defined(ARDUINO_USB_CDC_ON_BOOT) || defined(ARDUINO_ARCH_RP2040)
#define BOARD_HAS_USB_SERIAL


Expand All @@ -35,6 +35,8 @@ Extends the Serial class to encode SLIP over serial
#include <avr/wdt.h>
#elif defined(ARDUINO_ARCH_RP2040)
#include <SerialUSB.h>
#elif defined(ARDUINO_SAMD_ADAFRUIT)
#include "USB/USBAPI.h"
#else
#error Unknown USB port
#endif
Expand Down Expand Up @@ -244,8 +246,7 @@ using SLIPEncodedSerial = _SLIPSerial<HardwareSerial> ;

// }

#ifdef BOARD_HAS_USB_SERIAL

#ifdef BOARD_HAS_USB_SERIAL
#if defined(_SAMD21_)
// Required for Serial on Zero based boards
#if defined(ARDUINO_SAMD_ZERO)
Expand All @@ -256,13 +257,14 @@ typedef decltype(Serial) actualUSBtype;
#define thisBoardsSerialUSB SerialUSB
typedef decltype(SerialUSB) actualUSBtype;
#endif

#elif defined(__SAM3X8E__)
// Required for Serial on Zero based boards
#define thisBoardsSerialUSB SerialUSB
typedef decltype(SerialUSB) actualUSBtype;

// defined(__SAM3X8E__)
#elif defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_USB_CDC_ON_BOOT) || defined(CORE_TEENSY) || defined(__AVR_ATmega32U4__) || (defined(__PIC32MX__) || defined(__PIC32MZ__))
#elif defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_SAMD_ADAFRUIT) || defined(ARDUINO_USB_CDC_ON_BOOT) || defined(CORE_TEENSY) || defined(__AVR_ATmega32U4__) || (defined(__PIC32MX__) || defined(__PIC32MZ__))
#define thisBoardsSerialUSB Serial
typedef decltype(Serial) actualUSBtype;
#endif
Expand All @@ -274,7 +276,7 @@ template <> void _SLIPSerial<actualUSBtype>::endPacket(){
}
#endif

#endif
#endif // BOARD_HAS_USB_SERIAL

// Bluetooth Example

Expand Down

0 comments on commit df3bf97

Please sign in to comment.