16
16
#error MIDIUSB can only be used with an USB MCU.
17
17
#endif
18
18
19
- #if defined(USBCON)
20
-
21
19
typedef struct
22
20
{
23
21
uint8_t header;
@@ -29,52 +27,56 @@ typedef struct
29
27
#if defined(ARDUINO_ARCH_AVR)
30
28
31
29
#include " PluggableUSB.h"
30
+
32
31
#define EPTYPE_DESCRIPTOR_SIZE uint8_t
33
- #define EP_TYPE_BULK_OUT_MIDI EP_TYPE_BULK_OUT
34
- #define EP_TYPE_BULK_IN_MIDI EP_TYPE_BULK_IN
35
- #define MIDI_BUFFER_SIZE 64
32
+ #define EP_TYPE_BULK_IN_MIDI USB_ENDPOINT_TYPE_BULK | USB_ENDPOINT_IN( 0 );
33
+ #define EP_TYPE_BULK_OUT_MIDI USB_ENDPOINT_TYPE_BULK | USB_ENDPOINT_OUT( 0 );
34
+ #define MIDI_BUFFER_SIZE USB_EP_SIZE
36
35
#define is_write_enabled (x ) (1 )
37
36
38
- #else
37
+ #elif defined(ARDUINO_ARCH_SAM)
39
38
40
39
#include " USB/PluggableUSB.h"
41
- #define EPTYPE_DESCRIPTOR_SIZE uint32_t
42
- #define MIDI_BUFFER_SIZE 512
43
-
44
- #if defined(ARDUINO_ARCH_SAM)
45
- #define USB_SendControl USBD_SendControl
46
- #define USB_Available USBD_Available
47
- #define USB_Recv USBD_Recv
48
- #define USB_Send USBD_Send
49
- #define USB_Flush USBD_Flush
50
- #define is_write_enabled (x ) Is_udd_write_enabled(x)
51
40
41
+ #define EPTYPE_DESCRIPTOR_SIZE uint32_t
52
42
#define EP_TYPE_BULK_IN_MIDI (UOTGHS_DEVEPTCFG_EPSIZE_512_BYTE | \
53
43
UOTGHS_DEVEPTCFG_EPDIR_IN | \
54
44
UOTGHS_DEVEPTCFG_EPTYPE_BLK | \
55
45
UOTGHS_DEVEPTCFG_EPBK_1_BANK | \
56
46
UOTGHS_DEVEPTCFG_NBTRANS_1_TRANS | \
57
47
UOTGHS_DEVEPTCFG_ALLOC)
58
-
59
48
#define EP_TYPE_BULK_OUT_MIDI (UOTGHS_DEVEPTCFG_EPSIZE_512_BYTE | \
60
49
UOTGHS_DEVEPTCFG_EPTYPE_BLK | \
61
50
UOTGHS_DEVEPTCFG_EPBK_1_BANK | \
62
51
UOTGHS_DEVEPTCFG_NBTRANS_1_TRANS | \
63
52
UOTGHS_DEVEPTCFG_ALLOC)
64
- #endif
53
+ #define MIDI_BUFFER_SIZE EPX_SIZE
54
+ #define USB_SendControl USBD_SendControl
55
+ #define USB_Available USBD_Available
56
+ #define USB_Recv USBD_Recv
57
+ #define USB_Send USBD_Send
58
+ #define USB_Flush USBD_Flush
59
+ #define is_write_enabled (x ) Is_udd_write_enabled(x)
60
+
61
+ #elif defined(ARDUINO_ARCH_SAMD)
65
62
66
- #if defined(__SAMD21G18A__)
67
- #define USB_SendControl USBDevice.sendControl
68
- #define USB_Available USBDevice.available
69
- #define USB_Recv USBDevice.recv
70
- #define USB_Send USBDevice.send
71
- #define USB_Flush USBDevice.flush
72
- #define is_write_enabled (x ) (1 )
63
+ #include " USB/PluggableUSB.h"
73
64
65
+ #define EPTYPE_DESCRIPTOR_SIZE uint32_t
74
66
#define EP_TYPE_BULK_IN_MIDI USB_ENDPOINT_TYPE_BULK | USB_ENDPOINT_IN(0 );
75
67
#define EP_TYPE_BULK_OUT_MIDI USB_ENDPOINT_TYPE_BULK | USB_ENDPOINT_OUT(0 );
68
+ #define MIDI_BUFFER_SIZE EPX_SIZE
69
+ #define USB_SendControl USBDevice.sendControl
70
+ #define USB_Available USBDevice.available
71
+ #define USB_Recv USBDevice.recv
72
+ #define USB_Send USBDevice.send
73
+ #define USB_Flush USBDevice.flush
74
+ #define is_write_enabled (x ) (1 )
75
+
76
+ #else
77
+
78
+ #error "Unsupported architecture"
76
79
77
- #endif
78
80
#endif
79
81
80
82
#define MIDI_AUDIO 0x01
@@ -220,5 +222,4 @@ class MIDI_ : public PluggableUSBModule
220
222
};
221
223
extern MIDI_ MidiUSB;
222
224
223
- #endif /* USBCON */
224
- #endif /* MIDIUSB_h */
225
+ #endif /* MIDIUSB_h */
0 commit comments