atsamd21,atsamd51,nrf52840: improve usb-device initialization

This commit is contained in:
sago35
2022-07-07 19:06:47 +09:00
committed by Ron Evans
parent 335a7ad0b7
commit f1e6997018
4 changed files with 49 additions and 11 deletions
+6
View File
@@ -150,6 +150,10 @@ const (
// Configure the USB peripheral. The config is here for compatibility with the UART interface.
func (dev *USBDevice) Configure(config UARTConfig) {
if dev.initcomplete {
return
}
// reset USB interface
sam.USB_DEVICE.CTRLA.SetBits(sam.USB_DEVICE_CTRLA_SWRST)
for sam.USB_DEVICE.SYNCBUSY.HasBits(sam.USB_DEVICE_SYNCBUSY_SWRST) ||
@@ -185,6 +189,8 @@ func (dev *USBDevice) Configure(config UARTConfig) {
// enable IRQ
interrupt.New(sam.IRQ_USB, handleUSBIRQ).Enable()
dev.initcomplete = true
}
func (usbcdc *USBCDC) Configure(config UARTConfig) {