mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-19 12:04:03 +00:00
atsamd21,atsamd51,nrf52840: improve usb-device initialization
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user