Skip to content

Commit e5358d0

Browse files
committed
add support for SAMD arch
1 parent 4943940 commit e5358d0

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

src/MIDIUSB.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,23 @@
2626
#else
2727

2828
#include "USB/PluggableUSB.h"
29+
#define EPTYPE_DESCRIPTOR_SIZE uint32_t
30+
31+
#if defined(ARDUINO_ARCH_SAM)
2932
#define USB_SendControl USBD_SendControl
3033
#define USB_Available USBD_Available
3134
#define USB_Recv USBD_Recv
3235
#define USB_Send USBD_Send
3336
#define USB_Flush USBD_Flush
34-
#define EPTYPE_DESCRIPTOR_SIZE uint32_t
37+
#endif
38+
39+
#if defined(__SAMD21G18A__)
40+
#define USB_SendControl USBDevice.sendControl
41+
#define USB_Available USBDevice.available
42+
#define USB_Recv USBDevice.recv
43+
#define USB_Send USBDevice.send
44+
#define USB_Flush USBDevice.flush
45+
#endif
3546

3647
#endif
3748

src/MIDIUSB.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@ typedef struct
1818
uint8_t byte3;
1919
}midiEventPacket_t;
2020

21-
#if !defined(ARDUINO_ARCH_SAM)
22-
21+
#if defined(ARDUINO_ARCH_AVR)
2322
#define EP_TYPE_BULK_OUT_MIDI EP_TYPE_BULK_OUT
2423
#define EP_TYPE_BULK_IN_MIDI EP_TYPE_BULK_IN
24+
#endif
2525

26-
#else
27-
26+
#if defined(ARDUINO_ARCH_SAM)
2827
#define EP_TYPE_BULK_IN_MIDI (UOTGHS_DEVEPTCFG_EPSIZE_64_BYTE | \
2928
UOTGHS_DEVEPTCFG_EPDIR_IN | \
3029
UOTGHS_DEVEPTCFG_EPTYPE_BLK | \
@@ -39,6 +38,11 @@ typedef struct
3938
UOTGHS_DEVEPTCFG_ALLOC)
4039
#endif
4140

41+
#if defined(__SAMD21G18A__)
42+
#define EP_TYPE_BULK_IN_MIDI USB_ENDPOINT_TYPE_BULK | USB_ENDPOINT_IN(0);
43+
#define EP_TYPE_BULK_OUT_MIDI USB_ENDPOINT_TYPE_BULK | USB_ENDPOINT_OUT(0);
44+
#endif
45+
4246
class MIDI_
4347
{
4448
// private:

0 commit comments

Comments
 (0)