@@ -8,6 +8,11 @@ import (
8
8
"machine/usb/descriptor"
9
9
)
10
10
11
+ const (
12
+ EPxIN = usb .MIDI_ENDPOINT_IN
13
+ EPxOUT = usb .MIDI_ENDPOINT_OUT
14
+ )
15
+
11
16
func init () {
12
17
// vial-gui requires the following magic word.
13
18
usb .Serial = "vial:f64c2b3c"
@@ -42,19 +47,19 @@ func init() {
42
47
// Descriptor Length: 34 bytes (0x0022)
43
48
44
49
// Endpoint Descriptor
45
- 0x07 , 0x05 , 0x86 , 0x03 , 0x20 , 0x00 , 0x01 ,
50
+ 0x07 , 0x05 , 0x80 | EPxIN , 0x03 , 0x20 , 0x00 , 0x01 ,
46
51
// Length: 7 bytes
47
52
// Descriptor Type: Endpoint (0x05)
48
- // Endpoint Address: 0x86 (Endpoint 6 , IN direction)
53
+ // Endpoint Address: 0x8x (Endpoint X , IN direction)
49
54
// Attributes: 3 (Interrupt transfer type)
50
55
// Maximum Packet Size: 32 bytes (0x0020)
51
56
// Interval: 1 ms
52
57
53
58
// Endpoint Descriptor
54
- 0x07 , 0x05 , 0x07 , 0x03 , 0x20 , 0x00 , 0x01 ,
59
+ 0x07 , 0x05 , 0x00 | EPxOUT , 0x03 , 0x20 , 0x00 , 0x01 ,
55
60
// Length: 7 bytes
56
61
// Descriptor Type: Endpoint (0x05)
57
- // Endpoint Address: 0x07 (Endpoint 7 , OUT direction)
62
+ // Endpoint Address: 0x0x (Endpoint X , OUT direction)
58
63
// Attributes: 3 (Interrupt transfer type)
59
64
// Maximum Packet Size: 32 bytes (0x0020)
60
65
// Interval: 1 ms
@@ -83,13 +88,13 @@ func init() {
83
88
machine .ConfigureUSBEndpoint (descriptor .CDCHID ,
84
89
[]usb.EndpointConfig {
85
90
{
86
- Index : usb . MIDI_ENDPOINT_OUT ,
91
+ Index : EPxOUT ,
87
92
IsIn : false ,
88
93
Type : usb .ENDPOINT_TYPE_INTERRUPT ,
89
94
RxHandler : rxHandler ,
90
95
},
91
96
{
92
- Index : usb . MIDI_ENDPOINT_IN ,
97
+ Index : EPxIN ,
93
98
IsIn : true ,
94
99
Type : usb .ENDPOINT_TYPE_INTERRUPT ,
95
100
},
@@ -278,7 +283,7 @@ func rxHandler2(b []byte) bool {
278
283
default :
279
284
return false
280
285
}
281
- machine .SendUSBInPacket (6 , txb [:32 ])
286
+ machine .SendUSBInPacket (EPxIN , txb [:32 ])
282
287
//fmt.Printf("Tx % X\n", txb[:32])
283
288
284
289
return true
0 commit comments