-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathusb_midi_serial.h
More file actions
140 lines (108 loc) · 4.05 KB
/
usb_midi_serial.h
File metadata and controls
140 lines (108 loc) · 4.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
//Modify the chips's USB settings to allow for a MIDI connection AND an emulated serial port connection
//PlatformIO teensy core files location
//Windows: %userprofile%/.platformio/packages/framework-arduinoteensy/cores/usb_midi
//Unix: ~/.platformio/packages/framework-arduinoteensy/cores/usb_midi
//Modify usb_private.h STR_PRODUCT to change hardware name
#define STR_PRODUCT L"Mega MIDI"
#if defined(USB_MIDI)
#define VENDOR_ID 0x16C0
#define PRODUCT_ID 0x0480
//#define PRODUCT_ID 0x0500
#define MANUFACTURER_NAME {'A','i','d','a','n',' ','L','a','w','r','e','n','c','e'}
#define MANUFACTURER_NAME_LEN 14
#define PRODUCT_NAME {'M','e','g','a',' ','M','I','D','I'}
#define PRODUCT_NAME_LEN 9
#define EP0_SIZE 64
#define NUM_ENDPOINTS 5
#define NUM_USB_BUFFERS 30
#define NUM_INTERFACE 3
#define CDC_IAD_DESCRIPTOR 1
#define CDC_STATUS_INTERFACE 0
#define CDC_DATA_INTERFACE 1 // Serial
#define CDC_ACM_ENDPOINT 1
#define CDC_RX_ENDPOINT 2
#define CDC_TX_ENDPOINT 3
#define CDC_ACM_SIZE 16
#define CDC_RX_SIZE 64
#define CDC_TX_SIZE 64
#define MIDI_INTERFACE 2 // MIDI
#define MIDI_TX_ENDPOINT 4
#define MIDI_TX_SIZE 64
#define MIDI_RX_ENDPOINT 5
#define MIDI_RX_SIZE 64
#define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
#define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
#define ENDPOINT3_CONFIG ENDPOINT_TRANSIMIT_ONLY
#define ENDPOINT4_CONFIG ENDPOINT_TRANSIMIT_ONLY
#define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_ONLY
#endif
// usb_private.h example
// #ifndef usb_serial_h__
// #define usb_serial_h__
// #include <stdint.h>
// #ifdef __cplusplus
// extern "C"{
// #endif
// /**************************************************************************
// *
// * Configurable Options
// *
// **************************************************************************/
// #define VENDOR_ID 0x16C0
// #define PRODUCT_ID 0x0485
// #define TRANSMIT_FLUSH_TIMEOUT 4 /* in milliseconds */
// #define TRANSMIT_TIMEOUT 25 /* in milliseconds */
// /**************************************************************************
// *
// * Endpoint Buffer Configuration
// *
// **************************************************************************/
// // These buffer sizes are best for most applications, but perhaps if you
// // want more buffering on some endpoint at the expense of others, this
// // is where you can make such changes. The AT90USB162 has only 176 bytes
// // of DPRAM (USB buffers) and only endpoints 3 & 4 can double buffer.
// // 0: control
// // 1: debug IN
// // 2: debug OUT
// // 3: midi IN
// // 4: midi OUT
// #if defined(__AVR_ATmega32U4__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
// // Some operating systems, especially Windows, may cache USB device
// // info. Changes to the device name may not update on the same
// // computer unless the vendor or product ID numbers change, or the
// // "bcdDevice" revision code is increased.
// #ifndef STR_PRODUCT
// //#define STR_PRODUCT L"Teensy MIDI"
// #define STR_PRODUCT L"Mega MIDI"
// #endif
// #define ENDPOINT0_SIZE 64
// #define DEBUG_INTERFACE 1
// #define DEBUG_TX_ENDPOINT 1
// #define DEBUG_TX_SIZE 64
// #define DEBUG_TX_BUFFER EP_DOUBLE_BUFFER
// #define DEBUG_TX_INTERVAL 1
// #define DEBUG_RX_ENDPOINT 2
// #define DEBUG_RX_SIZE 32
// #define DEBUG_RX_BUFFER EP_DOUBLE_BUFFER
// #define DEBUG_RX_INTERVAL 2
// #define MIDI_INTERFACE 0
// #define MIDI_TX_ENDPOINT 3
// #define MIDI_TX_SIZE 64
// #define MIDI_TX_BUFFER EP_DOUBLE_BUFFER
// #define MIDI_RX_ENDPOINT 4
// #define MIDI_RX_SIZE 64
// #define MIDI_RX_BUFFER EP_DOUBLE_BUFFER
// #define NUM_ENDPOINTS 5
// #define NUM_INTERFACE 2
// #endif
// // setup
// void usb_init(void); // initialize everything
// void usb_shutdown(void); // shut off USB
// // variables
// extern volatile uint8_t usb_configuration;
// extern volatile uint8_t usb_suspended;
// extern volatile uint8_t debug_flush_timer;
// #ifdef __cplusplus
// } // extern "C"
// #endif
// #endif