mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-15 00:13:43 +00:00
machine/usb: allow USB Endpoint settings to be changed externally
This commit is contained in:
@@ -3,6 +3,7 @@ package midi
|
||||
import (
|
||||
"machine"
|
||||
"machine/usb"
|
||||
"machine/usb/descriptor"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -40,7 +41,23 @@ func newMidi() *midi {
|
||||
m := &midi{
|
||||
buf: NewRingBuffer(),
|
||||
}
|
||||
machine.EnableMIDI(m.Handler, m.RxHandler, nil)
|
||||
machine.ConfigureUSBEndpoint(descriptor.CDCMIDI,
|
||||
[]usb.EndpointConfig{
|
||||
{
|
||||
No: usb.MIDI_ENDPOINT_OUT,
|
||||
IsIn: false,
|
||||
Type: usb.ENDPOINT_TYPE_BULK,
|
||||
RxHandler: m.RxHandler,
|
||||
},
|
||||
{
|
||||
No: usb.MIDI_ENDPOINT_IN,
|
||||
IsIn: true,
|
||||
Type: usb.ENDPOINT_TYPE_BULK,
|
||||
TxHandler: m.Handler,
|
||||
},
|
||||
},
|
||||
[]usb.SetupConfig{},
|
||||
)
|
||||
return m
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user